Changeset d74d751 in sasview
- Timestamp:
- Jan 11, 2009 7:09:28 PM (16 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:
- db709e4
- Parents:
- 20be946
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitting.py
r20be946 rd74d751 595 595 596 596 self.fit_panel.add_model_page(model=model,description=model.description,page_title=name) 597 self._draw_model2D(model,name,model.description, enable2D,qmin,qmax,qstep) 597 self._draw_model2D(model=model, 598 description=model.description, 599 enable2D= enable2D, 600 qmin=qmin, 601 qmax=qmax, 602 qstep=qstep) 598 603 self._draw_model1D(model,name,model.description, enable1D,qmin,qmax, qstep) 599 604 -
sansview/perspectives/fitting/model_thread.py
r20be946 rd74d751 153 153 value1 = self.model.runXY([self.x[i_x]-center_x, self.y[i_y]-center_y]) 154 154 value2 = self.model.runXY([self.x[i_x]-center_x, self.y[lx-i_y-1]-center_y]) 155 output[i_y][i_x] = value1 +value2 156 output[lx-i_y-1][lx-i_x-1] = value1 + value2 157 output[lx-i_y-1][i_x] = value1 + value2 158 output[i_y][lx-i_x-1] = value1 + value2 159 160 155 value3 = self.model.runXY([self.x[lx-i_x-1]-center_x, self.y[i_y]-center_y]) 156 value4 = self.model.runXY([self.x[lx-i_x-1]-center_x, self.y[lx-i_y-1]-center_y]) 157 158 output[i_x] [i_y]=value1 159 output[lx-i_x-1][lx-i_y-1] =value4 160 output[i_x] [lx-i_y-1]= value2 161 output[lx-i_x-1][i_y] = value3 162 163 161 164 except: 162 165 wx.PostEvent(self.parent, StatusEvent(status=\ … … 168 171 qmin= self.qmin, 169 172 qmax=self.qmax) 170 171 class Calc2D_old(CalcThread):172 """173 Compute 2D model174 This calculation assumes a 2-fold symmetry of the model175 where points are computed for one half of the detector176 and I(qx, qy) = I(-qx, -qy) is assumed.177 """178 179 def __init__(self, x, y, model,qmin, qmax,180 completefn = None,181 updatefn = None,182 yieldtime = 0.01,183 worktime = 0.01184 ):185 CalcThread.__init__(self,completefn,186 updatefn,187 yieldtime,188 worktime)189 self.qmin= qmin190 self.qmax=qmax191 self.x = x192 self.y = y193 self.model = model194 self.starttime = 0195 196 def isquit(self):197 try:198 CalcThread.isquit(self)199 except KeyboardInterrupt:200 #printEVT("Calc %s interrupted" % self.model.name)201 wx.PostEvent(self.parent, StatusEvent(status=\202 "Calc %s interrupted" % self.model.name))203 204 raise KeyboardInterrupt205 206 def compute(self):207 import numpy208 x = self.x209 y = self.y210 output = numpy.zeros((len(x),len(y)))211 212 self.starttime = time.time()213 lx = len(self.x)214 215 for i_x in range(int(len(self.x)/2)):216 if i_x%2==1:217 continue218 219 # Check whether we need to bail out (before updating!)220 self.isquit()221 self.update(output=output)222 223 for i_y in range(len(self.y)):224 try:225 value = self.model.runXY([self.x[i_x], self.y[i_y]])226 #output[i_x][i_y] = value227 #output[lx-i_x-1][lx-i_y-1] = value228 output[i_y][i_x] = value229 output[lx-i_y-1][lx-i_x-1] = value230 except:231 wx.PostEvent(self.parent, StatusEvent(status=\232 "Error computing %s at [%g,%g]" %(self.model.name, self.x[i_x],self.y[i_y])))233 234 if lx%2==1:235 i_x = int(len(self.x)/2)236 for i_y in range(len(self.y)):237 try:238 value = self.model.runXY([self.x[i_x], self.y[i_y]])239 #output[i_x][i_y] = value240 output[i_y][i_x] = value241 except:242 243 wx.PostEvent(self.parent, StatusEvent(status=\244 "Error computing %s at [%g,%g]" %(self.model.name, self.x[i_x],self.y[i_y])))245 246 for i_x in range(int(len(self.x)/2)):247 if not i_x%2==1:248 continue249 250 # Check whether we need to bail out251 self.isquit()252 self.update(output=output)253 254 for i_y in range(len(self.y)):255 try:256 value = self.model.runXY([self.x[i_x], self.y[i_y]])257 #output[i_x][i_y] = value258 #output[lx-i_x-1][lx-i_y-1] = value259 output[i_y][i_x] = value260 output[lx-i_y-1][lx-i_x-1] = value261 except:262 263 wx.PostEvent(self.parent, StatusEvent(status=\264 "Error computing %s at [%g,%g]" %(self.model.name, self.x[i_x],self.y[i_y])))265 266 elapsed = time.time()-self.starttime267 self.complete(268 output=output, elapsed=elapsed,model= self.model,269 qmin= self.qmin,270 qmax=self.qmax)271 272 173 273 174 class Calc2D_4fold(CalcThread): -
sansview/perspectives/fitting/modelpage.py
r20be946 rd74d751 181 181 self.enable2D=True 182 182 self.manager.draw_model(model=self.model, 183 name=self.model.name, 183 184 description=None, 184 185 enable2D=self.enable2D, … … 227 228 self.manager.draw_model(model, name) 228 229 229 230 self.model_view.SetFocus() 230 231 231 232 def get_model_box(self): … … 395 396 # enable1D=True,qmin=None,qmax=None, qstep=None) 396 397 397 398 399 400 398 self.model_view.SetFocus() 399 400 401
Note: See TracChangeset
for help on using the changeset viewer.