Changeset ee5b04c in sasview
- Timestamp:
- Aug 11, 2008 5:57:21 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:
- f44dbc7
- Parents:
- 0eb801a
- Location:
- park_integration
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
rd53bc33 ree5b04c 1 1 2 2 class FitEngine: 3 3 def __init__(self): 4 self.paramList=[] 4 5 def _concatenateData(self, listdata=[]): 5 6 """ … … 29 30 dytemp.append(data.dy[i]) 30 31 else: 31 raise RuntimeError, "Fit._concatenateData: y-errors missing e"32 raise RuntimeError, "Fit._concatenateData: y-errors missing" 32 33 return xtemp, ytemp,dytemp 33 34 … … 47 48 """ 48 49 print "AbstractFitEngine: fitting parmater",pars 49 temp=[]50 50 51 if pars !={}: 51 52 self.parameters=[] 52 self.paramList=[]53 53 54 if model==None: 54 55 raise ValueError, "Cannot set parameters for empty model" … … 58 59 param = Parameter(model, key, value) 59 60 self.parameters.append(param) 60 temp.append(key)61 self.paramList.append(temp)61 62 self.paramList.append(key) 62 63 print "AbstractFitEngine: self.paramList2", self.paramList 63 64 #A fitArrange is already created but contains dList only at Uid -
park_integration/ParkFitting.py
r37d9521 ree5b04c 141 141 """ 142 142 self.fitArrangeList={} 143 143 self.paramList=[] 144 144 145 145 def createProblem(self): … … 204 204 localfit.ftol = 1e-8 205 205 fitter = FitMC(localfit=localfit) 206 try:207 208 result = fit.fit(self.problem,209 fitter=fitter,210 handler= fitresult.ConsoleUpdate(improvement_delta=0.1))211 206 207 result = fit.fit(self.problem, 208 fitter=fitter, 209 handler= fitresult.ConsoleUpdate(improvement_delta=0.1)) 210 print "ParkFitting: result",result 211 if result !=None: 212 212 #for p in result.parameters: 213 213 # print "fit in park fitting", p.name, p.value,p.stderr 214 214 return result.fitness,result.pvec,result.cov,result 215 216 except :217 raise218 return215 else: 216 raise ValueError, "SVD did not converge" 217 218 219 219 220 220 -
park_integration/ScipyFitting.py
r0eb801a ree5b04c 41 41 """ 42 42 self.fitArrangeList={} 43 self.paramList=[] 43 44 44 45 def fit(self,qmin=None, qmax=None): … … 64 65 model = fitproblem.get_model() 65 66 listdata = fitproblem.get_data() 66 67 68 67 # Concatenate dList set (contains one or more data)before fitting 69 68 xtemp,ytemp,dytemp=self._concatenateData( listdata) 70 71 #print "dytemp",dytemp72 69 #Assign a fit range is not boundaries were given 73 70 if qmin==None: … … 75 72 if qmax==None: 76 73 qmax= max(xtemp) 77 78 74 #perform the fit 79 75 chisqr, out, cov = fitHelper(model,self.parameters, xtemp,ytemp, dytemp ,qmin,qmax) 80 81 76 return chisqr, out, cov 82 77 … … 108 103 residuals = [] 109 104 for j in range(len(x)): 110 if x[j] >qmin and x[j]<qmax:105 if x[j] >= qmin and x[j] <= qmax: 111 106 residuals.append( ( y[j] - model.runXY(x[j]) ) / err_y[j] ) 112 107
Note: See TracChangeset
for help on using the changeset viewer.