Changeset 9624cda in sasview for sanscalculator/src/sans
- Timestamp:
- Mar 13, 2013 11:10:51 AM (12 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 49a8843
- Parents:
- 5f248f6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sanscalculator/src/sans/calculator/sans_gen.py
r11363ee r9624cda 30 30 sld_m = factor * mag 31 31 return sld_m 32 33 def transform_center(pos_x, pos_y, pos_z): 34 """ 35 re-center 36 37 :return: posx, posy, posz [arrays] 38 """ 39 posx = pos_x - (min(pos_x) + max(pos_x)) / 2.0 40 posy = pos_y - (min(pos_y) + max(pos_y)) / 2.0 41 posz = pos_z - (min(pos_z) + max(pos_z)) / 2.0 42 return posx, posy, posz 32 43 33 44 class GenSAS(BaseComponent): … … 101 112 :return: function value 102 113 """ 103 len_x = len(self.data_x) 104 if self.is_avg: 114 pos_x = self.data_x 115 pos_y = self.data_y 116 pos_z = self.data_z 117 len_x = len(pos_x) 118 if self.is_avg == None: 105 119 len_x *= -1 120 pos_x, pos_y, pos_z = transform_center(pos_x, pos_y, pos_z) 106 121 len_q = len(x) 107 122 sldn = copy.deepcopy(self.data_sldn) 108 123 sldn -= self.params['solvent_SLD'] 109 model = mod.new_GenI(len_x, self.data_x, self.data_y, self.data_z,124 model = mod.new_GenI(len_x, pos_x, pos_y, pos_z, 110 125 sldn, self.data_mx, self.data_my, 111 126 self.data_mz, self.data_vol, … … 113 128 self.params['Up_frac_out'], 114 129 self.params['Up_theta']) 115 116 mod.genicom(model, len_q, x, y, i) 130 if y == []: 131 mod.genicom(model, len_q, x, i) 132 else: 133 mod.genicomXY(model, len_q, x, y, i) 117 134 vol_correction = self.data_total_volume / self.params['total_volume'] 118 135 return self.params['scale'] * vol_correction * i + \ … … 151 168 """ 152 169 if x.__class__.__name__ == 'list': 170 if len(x[1]) > 0: 171 msg = "Not a 1D." 172 raise ValueError, msg 153 173 i_out = numpy.zeros_like(x[0]) 154 y_in = numpy.zeros_like(x[0]) 174 #import time 175 #s = time.time() 155 176 # 1D I is found at y =0 in the 2D pattern 156 return self._gen(x[0], y_in, i_out ) 177 out = self._gen(x[0], [], i_out ) 178 #print "i_out_time", time.time() - s 179 return out 157 180 else: 158 181 msg = "Q must be given as list of qx's and qy's" … … 168 191 if x.__class__.__name__ == 'list': 169 192 i_out = numpy.zeros_like(x[0]) 170 import time171 s = time.time()193 #import time 194 #s = time.time() 172 195 out = self._gen(x[0], x[1], i_out) 173 print "i_out_time", time.time() - s196 #print "i_out_time", time.time() - s 174 197 return out 175 198 else: … … 189 212 """ 190 213 if qdist.__class__.__name__ == 'list': 191 out = self.runXY(qdist) 214 if len(qdist[1]) < 1: 215 out = self.run(qdist) 216 else: 217 out = self.runXY(qdist) 192 218 return out 193 219 else:
Note: See TracChangeset
for help on using the changeset viewer.