Changeset a9e04aa in sasview for park_integration
- Timestamp:
- Sep 30, 2008 10:33:02 AM (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:
- 8bbab51
- Parents:
- 3755d77
- Location:
- park_integration
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
re71440c ra9e04aa 50 50 self._model.details[self.name][1:] = r 51 51 range = property(_getrange,_setrange) 52 53 54 class Model(object): 52 53 class Model(park.Model): 55 54 """ 56 55 PARK wrapper for SANS models. … … 60 59 @param sans_model: the sans model to wrap using park interface 61 60 """ 61 park.Model.__init__(self, **kw) 62 62 self.model = sans_model 63 63 self.name = sans_model.name … … 108 108 109 109 110 111 110 112 class Data(object): 111 113 """ Wrapper class for SANS data """ … … 314 316 if self.fitArrangeDict.has_key(Uid): 315 317 del self.fitArrangeDict[Uid] 316 318 319 def select_problem_for_fit(self,Uid,value): 320 """ 321 select a couple of model and data at the Uid position in dictionary 322 and set in self.selected value to value 323 @param value: the value to allow fitting. can only have the value one or zero 324 """ 325 if self.fitArrangeDict.has_key(Uid): 326 self.fitArrangeDict[Uid].set_to_fit( value) 327 def get_problem_to_fit(self,Uid): 328 """ 329 return the self.selected value of the fit problem of Uid 330 @param Uid: the Uid of the problem 331 """ 332 if self.fitArrangeDict.has_key(Uid): 333 self.fitArrangeDict[Uid].get_to_fit() 317 334 318 335 class FitArrange: … … 328 345 self.model = None 329 346 self.dList =[] 347 #self.selected is zero when this fit problem is not schedule to fit 348 #self.selected is 1 when schedule to fit 349 self.selected = 0 330 350 331 351 def set_model(self,model): … … 359 379 if data in self.dList: 360 380 self.dList.remove(data) 361 362 363 364 381 def set_to_fit (self, value=0): 382 """ 383 set self.selected to 0 or 1 for other values raise an exception 384 @param value: integer between 0 or 1 385 """ 386 self.selected= value 387 388 def get_to_fit(self): 389 """ 390 @return self.selected value 391 """ 392 return self.selected 393 394 395 396 -
park_integration/Fitting.py
rca6d914 ra9e04aa 69 69 self._engine.remove_Fit_Problem(Uid) 70 70 71 def select_problem_for_fit(self,Uid,value): 72 """ 73 select a couple of model and data at the Uid position in dictionary 74 and set in self.selected value to value 75 @param value: the value to allow fitting. can only have the value one or zero 76 """ 77 self._engine.select_problem_for_fit(Uid,value) 71 78 79 def get_problem_to_fit(self,Uid): 80 """ 81 return the self.selected value of the fit problem of Uid 82 @param Uid: the Uid of the problem 83 """ 84 return self._engine.get_problem_to_fit(Uid) -
park_integration/ParkFitting.py
r916a15f ra9e04aa 58 58 listmodel=[] 59 59 i=0 60 for k,value in self.fitArrangeDict.iteritems(): 61 parkmodel = value.get_model() 60 fitproblems=[] 61 for id ,fproblem in self.fitArrangeDict.iteritems(): 62 if fproblem.get_to_fit()==1: 63 fitproblems.append(fproblem) 64 65 if len(fitproblems)==0 : 66 raise RuntimeError, "No Assembly scheduled for Park fitting." 67 return 68 for item in fitproblems: 69 parkmodel = item.get_model() 62 70 for p in parkmodel.parameterset: 63 71 if p._getname()in self.paramList and not p.iscomputed(): … … 66 74 67 75 i+=1 68 Ldata= value.get_data()76 Ldata=item.get_data() 69 77 parkdata=self._concatenateData(Ldata) 70 78 -
park_integration/ScipyFitting.py
re71440c ra9e04aa 60 60 self.paramList=[] 61 61 def fit(self,qmin=None, qmax=None): 62 # Protect against simultanous fitting attempts 63 if len(self.fitArrangeDict)>1: 62 # Protect against simultanous fitting attempts 63 #if len(self.fitArrangeDict)>1: 64 # raise RuntimeError, "Scipy can't fit more than a single fit problem at a time." 65 # fitproblem contains first fitArrange object(one model and a list of data) 66 #list of fitproblem 67 fitproblem=[] 68 for id ,fproblem in self.fitArrangeDict.iteritems(): 69 print "ScipyFitting:fproblem.get_to_fit() ",fproblem.get_to_fit() 70 if fproblem.get_to_fit()==1: 71 fitproblem.append(fproblem) 72 if len(fitproblem)>1 : 64 73 raise RuntimeError, "Scipy can't fit more than a single fit problem at a time." 65 66 # fitproblem contains first fitArrange object(one model and a list of data) 67 fitproblem=self.fitArrangeDict.values()[0] 74 return 75 elif len(fitproblem)==0 : 76 raise RuntimeError, "No Assembly scheduled for Scipy fitting." 77 return 78 68 79 listdata=[] 69 model = fitproblem .get_model()70 listdata = fitproblem .get_data()80 model = fitproblem[0].get_model() 81 listdata = fitproblem[0].get_data() 71 82 # Concatenate dList set (contains one or more data)before fitting 72 83 data=self._concatenateData( listdata)
Note: See TracChangeset
for help on using the changeset viewer.