Changeset 904713c in sasview for sansview/perspectives/fitting
- Timestamp:
- Mar 28, 2009 12:52:48 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:
- ead38a7
- Parents:
- ff54ce7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/model_thread.py
rc77d859 r904713c 2 2 from calcthread import CalcThread 3 3 import sys 4 import numpy 4 5 5 6 class Calc2D_all(CalcThread): … … 27 28 self.starttime = 0 28 29 29 def isquit(self):30 try:31 CalcThread.isquit(self)32 except KeyboardInterrupt:33 wx.PostEvent(self.parent, StatusEvent(status=\34 "Calc %s interrupted" % self.model.name))35 raise KeyboardInterrupt36 37 30 def compute(self): 38 import numpy39 31 x = self.x 40 32 y = self.y … … 108 100 ## the model on to calculate 109 101 self.model = model 110 self.starttime = 0 111 112 113 def isquit(self): 114 try: 115 CalcThread.isquit(self) 116 except KeyboardInterrupt: 117 wx.PostEvent(self.parent, StatusEvent(status=\ 118 "Calc %s interrupted" % self.model.name)) 119 120 raise KeyboardInterrupt 121 102 self.starttime = 0 122 103 123 104 def compute(self): … … 125 106 Compute the data given a model function 126 107 """ 127 import numpy128 108 x = self.x 129 109 y = self.y … … 133 113 self.qmin = 0 134 114 if self.qmax== None: 135 if data ==None:115 if self.data ==None: 136 116 return 137 newx= math.pow(max(math.fabs( data.xmax),math.fabs(data.xmin)),2)138 newy= math.pow(max(math.fabs( data.ymax),math.fabs(data.ymin)),2)117 newx= math.pow(max(math.fabs(self.data.xmax),math.fabs(self.data.xmin)),2) 118 newy= math.pow(max(math.fabs(self.data.ymax),math.fabs(self.data.ymin)),2) 139 119 self.qmax=math.sqrt( newx + newy ) 140 120 … … 189 169 self.starttime = 0 190 170 191 def isquit(self):192 try:193 CalcThread.isquit(self)194 except KeyboardInterrupt:195 #printEVT("Calc %s interrupted" % self.model.name)196 wx.PostEvent(self.parent, StatusEvent(status=\197 "Calc %s interrupted" % self.model.name))198 199 raise KeyboardInterrupt200 201 171 def compute(self): 202 import numpy203 172 x = self.x 204 173 y = self.y … … 284 253 Compute model 1d value given qmin , qmax , x value 285 254 """ 286 import numpy287 288 255 output = numpy.zeros(len(self.x)) 289 256 … … 312 279 #print thread.get_ident() 313 280 from sans.models.CylinderModel import CylinderModel 314 from sans.models.DisperseModel import DisperseModel 315 import pylab 316 317 submodel = CylinderModel() 318 319 model = DisperseModel(submodel, ['cyl_phi', 'cyl_theta', 'length'], 320 [0.2, 0.2, 10.0]) 321 model.setParam('n_pts', 10) 281 282 model = CylinderModel() 283 322 284 323 285 print model.runXY([0.01, 0.02]) … … 327 289 self.done = False 328 290 329 x = pylab.arange(-qmax, qmax+qstep*0.01, qstep) 330 y = pylab.arange(-qmax, qmax+qstep*0.01, qstep) 331 332 calc_thread_2D = Calc2D(x, y, model.clone(),-qmax, qmax,qstep, 291 x = numpy.arange(-qmax, qmax+qstep*0.01, qstep) 292 y = numpy.arange(-qmax, qmax+qstep*0.01, qstep) 293 294 295 calc_thread_2D = Calc2D(x, y, None, model.clone(),-qmax, qmax,qstep, 333 296 completefn=self.complete, 334 297 updatefn=self.update , … … 344 307 print "update" 345 308 346 def complete(self, output, model, elapsed, qmin, qmax, qstep ):309 def complete(self, image, data, model, elapsed, qmin, qmax, qstep ): 347 310 print "complete" 348 311 self.done = True
Note: See TracChangeset
for help on using the changeset viewer.