source: sasview/sansview/perspectives/fitting/fitproblem.py @ 24120ab

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 24120ab was 8e81af0, checked in by Gervaise Alina <gervyh@…>, 16 years ago

working on simultaneous fit

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[d89f09b]1from sans.fit.AbstractFitEngine import Model
2
3class FitProblem:
4    """ 
5        FitProblem class allows to link a model with the new name created in _on_model,
6        a name theory created with that model  and the data fitted with the model.
7        FitProblem is mostly used  as value of the dictionary by fitting module.
8    """
9   
10    def __init__(self):
11       
12        """
13            @ self.data :is the data selected to perform the fit
14            @ self.theory_name: the name of the theory created with self.model
15            @ self.model_list:  is a list containing a model as first element
16            and its name assign example [lineModel, M0]
17        """
18        self.data=None
19        self.theory_name=None
20        self.model_list=[]
[948add7]21        self.schedule=0
[8e81af0]22        self.list_param=[]
[d89f09b]23       
24    def set_model(self,model,name):
25        """
26             associates each model with its new created name
27             @param model: model selected
28             @param name: name created for model
29        """
30        self.model_list=[model,name]
31
32 
33    def add_data(self,data):
34        """
35            save a copy of the data select to fit
36            @param data: data selected
37        """
38        self.data = data
39           
40    def get_model(self):
41        """ @return: saved model """
[948add7]42        #print "fitproblem",self.model_list
[d89f09b]43        return self.model_list
44     
45    def get_data(self):
46        """ @return:  list of data dList"""
47        return self.data
48     
49     
50    def get_theory(self):
51        """ @return the name of theory for plotting purpose"""
52        return self.theory_name
53   
54   
55    def set_theory(self,name):
56        """
57            Set theory name
58            @param name: name of the theory
59        """
60        self.theory_name = name
61
62       
63    def set_model_param(self,name,value):
64        """
65            set the value of a given parameter of this model
66            @param name: name of the given parameter
67            @param value: value of that parameter
68        """
[948add7]69        #print "fitproblem",name,value
[00561739]70        #self.model_list[0].setParam(name,value)
[8e81af0]71        self.list_param.append([name,value])
[00561739]72    def get_model_param(self):
73        """
74            set the value of a given parameter of this model
75            @param name: name of the given parameter
76            @param value: value of that parameter
77        """
[948add7]78        #print self.param_name, self.param_value
[00561739]79        #self.model_list[0].setParam(name,value)
[8e81af0]80        return self.list_param
[d89f09b]81       
82    def reset_model(self,model):
83        """
84            reset a model when parameter has changed
85            @param value: new model
86        """
[948add7]87        #print "fitproblem : reset model"
[d89f09b]88        self.model_list[0]=model
89       
[948add7]90    def schedule_tofit(self, schedule=0):
[3b19ac9]91        """
92             set schedule to true to decide if this fit  must be performed
93        """
94        self.schedule=schedule
95    def get_scheduled(self):
96        """ return true or false if a problem as being schedule for fitting"""
97        return self.schedule
98   
99   
Note: See TracBrowser for help on using the repository browser.