source: sasview/park_integration/Fitting.py @ 83ca047

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 83ca047 was 93f0a586, checked in by Mathieu Doucet <doucetm@…>, 16 years ago

Esthetics…

  • Property mode set to 100644
File size: 2.3 KB
RevLine 
[792db7d5]1"""
2    @organization: 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.
5"""
[7705306]6from sans.guitools.plottables import Data1D
7from Loader import Load
8from scipy import optimize
9from ScipyFitting import ScipyFit
10from ParkFitting import ParkFit
11
12
13class Fit:
14    """
[792db7d5]15        Wrap class that allows to select the fitting type.this class
16        can be used as follow :
17       
18        from sans.fit.Fitting import Fit
19        fitter= Fit()
20        fitter.fit_engine('scipy') or fitter.fit_engine('park')
21        engine = fitter.returnEngine()
22        engine.set_data(data,Uid)
23        engine.set_param( model,model.name, pars)
24        engine.set_model(model,Uid)
25       
26        chisqr1, out1, cov1=engine.fit(pars,qmin,qmax)
[7705306]27    """ 
[93f0a586]28    def __init__(self, engine='scipy'):
[792db7d5]29        """
30            self._engine will contain an instance of ScipyFit or ParkFit
31        """
[7705306]32        self._engine=None
[93f0a586]33        self.set_engine(engine)
[7705306]34         
[93f0a586]35    def set_engine(self,word):
[7705306]36        """
37            Select the type of Fit
38            @param word: the keyword to select the fit type
[792db7d5]39            @raise: if the user does not enter 'scipy' or 'park',
40             a valueError is rase
[7705306]41        """
42        if word=="scipy":
43            self._engine=ScipyFit()
44        elif word=="park":
45            self._engine=ParkFit()
46        else:
47            raise ValueError, "enter the keyword scipy or park"
48    def returnEngine(self):
[792db7d5]49        """ @return self._engine""" 
[7705306]50        return self._engine
51   
52    def fit(self,pars, qmin=None, qmax=None):
[792db7d5]53        """Perform the fit """
[7705306]54     
55    def set_model(self,model,Uid):
56        """ Set model """
57       
58    def set_data(self,data,Uid):
59        """ Receive plottable and create a list of data to fit"""
60           
61    def get_model(self,Uid):
62        """ return list of data"""
63   
[cf3b781]64    def set_param(self,model,name, pars):
[7705306]65        """ Recieve a dictionary of parameter and save it """
[93f0a586]66        self._engine.set_param(model, name, pars)
[7705306]67   
[cf3b781]68    def remove_data(self,Uid,data=None):
69        """ remove one or all data"""
70                 
71    def remove_model(self,Uid):
72        """ remove model """
[9cd84ee]73 
Note: See TracBrowser for help on using the repository browser.