Changeset 386ffe1 in sasview for src/sas/fit
- Timestamp:
- Feb 20, 2015 5:02:38 AM (10 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:
- cda1cf8
- Parents:
- 018582f
- Location:
- src/sas/fit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/fit/AbstractFitEngine.py
rfd5ac0d r386ffe1 10 10 _SMALLVALUE = 1.0e-10 11 11 12 # Note: duplicated from park13 12 class FitHandler(object): 14 13 """ … … 69 68 def __init__(self, sas_model, sas_data=None, **kw): 70 69 """ 71 :param sas_model: the sas model to wrap using park interface70 :param sas_model: the sas model to wrap for fitting 72 71 73 72 """ … … 100 99 def eval(self, x): 101 100 """ 102 Override eval method of parkmodel.101 Override eval method of model. 103 102 104 103 :param x: the x value used to compute a function … … 394 393 def __init__(self): 395 394 """ 396 Base class for scipy and parkfit engine395 Base class for the fit engine 397 396 """ 398 397 #Dictionnary of fitArrange element (fit problems) -
src/sas/fit/BumpsFitting.py
rfd5ac0d r386ffe1 10 10 from bumps.mapper import SerialMapper, MPMapper 11 11 from bumps import parameter 12 13 # TODO: remove globals from interface to bumps options! 14 # Default bumps to use the levenberg-marquardt optimizer 12 15 from bumps.fitproblem import FitProblem 16 fitters.FIT_DEFAULT = 'lm' 13 17 14 18 from sas.fit.AbstractFitEngine import FitEngine -
src/sas/fit/Fitting.py
r79492222 r386ffe1 1 1 """ 2 Class Fit contains ScipyFit and ParkFit methods declaration 3 allows to create instance of type ScipyFit or ParkFit to perform either 4 a park fit or a scipy fit. 2 Class Fit contains fitting engine methods declaration 5 3 """ 6 4 7 #from scipy import optimize8 from sas.fit.ScipyFitting import ScipyFit9 from sas.fit.ParkFitting import ParkFit10 5 from sas.fit.BumpsFitting import BumpsFit 11 6 12 7 ENGINES={ 13 'scipy': ScipyFit,14 'park': ParkFit,15 8 'bumps': BumpsFit, 16 9 } … … 23 16 from sas.fit.Fitting import Fit 24 17 fitter= Fit() 25 fitter.fit_engine(' scipy') or fitter.fit_engine('park')18 fitter.fit_engine('bumps') 26 19 engine = fitter.returnEngine() 27 20 engine.set_data(data,id) … … 32 25 33 26 """ 34 def __init__(self, engine=' scipy', *args, **kw):27 def __init__(self, engine='bumps', *args, **kw): 35 28 """ 36 29 """ 37 #self._engine will contain an instance of ScipyFit or ParkFit38 30 self._engine = None 39 31 self.fitter_id = None … … 61 53 :param word: the keyword to select the fit type 62 54 63 :raise: if the user does not enter 'scipy' or 'park', 64 a valueError is raised 65 55 :raise: KeyError if the user does not enter an available engine 56 66 57 """ 67 58 try: 68 59 self._engine = ENGINES[word](*args, **kw) 69 60 except KeyError, exc: 70 raise KeyError("fit engine should be one of scipy, park or bumps") 61 raise KeyError("fit engine should be bumps") 62 #raise KeyError("fit engine should be one of "+", ".join(sorted(ENGINES.keys()))) 71 63 72 64 def fit(self, msg_q=None, q=None, handler=None, … … 75 67 reset_flag=False): 76 68 """Perform the fit """ 77 return self._engine.fit(msg_q=msg_q, 69 return self._engine.fit(msg_q=msg_q, 78 70 q=q, handler=handler, curr_thread=curr_thread, 79 71 ftol=ftol, reset_flag=reset_flag) -
src/sas/fit/ParkFitting.py
rfd5ac0d r386ffe1 7 7 to perform a simple fit with park optimizer. 8 8 """ 9 10 _ = ''' 9 11 #import time 10 12 import numpy … … 615 617 return q 616 618 return result_list 617 619 620 ''' -
src/sas/fit/ScipyFitting.py
ra10364b r386ffe1 4 4 simple fit with scipy optimizer. 5 5 """ 6 _ = ''' 6 7 import sys 7 8 import copy … … 265 266 if it is out of range. 266 267 267 : model: parkmodel object268 : model: model object 268 269 """ 269 270 # loop through parameterset … … 306 307 # return call_result 307 308 308 309 310 '''
Note: See TracChangeset
for help on using the changeset viewer.