source: sasview/sansview/perspectives/fitting/fitproblem.py @ 1fc7411

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 1fc7411 was 2a8fac1, checked in by Gervaise Alina <gervyh@…>, 16 years ago

refactor add et and remove error

  • Property mode set to 100644
File size: 3.9 KB
Line 
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.fit_data=None
19        self.theory_name=None
20        self.model_list=[]
21        self.schedule=0
22        self.list_param=[]
23        self.name_per_page=None
24        self.smearer= None
25        self.plotted_data=None
26       
27    def set_smearer(self, smearer):
28        self.smearer= smearer
29        #print "smeaerer in fitproblem",self.smearer
30    def get_smearer(self):
31        return self.smearer
32   
33    def save_model_name(self, name): 
34        self.name_per_page= name
35       
36       
37    def get_name(self):
38        return self.name_per_page
39   
40    def set_model(self,model,name):
41        """
42             associates each model with its new created name
43             @param model: model selected
44             @param name: name created for model
45        """
46        self.model_list=[model,name]
47
48 
49    def add_plotted_data(self,data):
50        """
51            save a copy of the data select to fit
52            @param data: data selected
53        """
54        self.plotted_data = data
55    def add_fit_data(self,data):
56        """
57            save a copy of the data select to fit
58            @param data: data selected
59        """
60        self.fit_data = data
61           
62    def get_model(self):
63        """ @return: saved model """
64        #print "fitproblem",self.model_list
65        return self.model_list
66     
67    def get_plotted_data(self):
68        """ @return:  list of data dList"""
69        return self.plotted_data
70   
71   
72    def get_fit_data(self):
73        return self.fit_data
74   
75   
76    def get_theory(self):
77        """ @return the name of theory for plotting purpose"""
78        return self.theory_name
79   
80   
81    def set_theory(self,name):
82        """
83            Set theory name
84            @param name: name of the theory
85        """
86        self.theory_name = name
87
88       
89    def set_model_param(self,name,value):
90        """
91            set the value of a given parameter of this model
92            @param name: name of the given parameter
93            @param value: value of that parameter
94        """
95        #print "fitproblem",name,value
96        #self.model_list[0].setParam(name,value)
97        self.list_param.append([name,value])
98    def get_model_param(self):
99        """
100            set the value of a given parameter of this model
101            @param name: name of the given parameter
102            @param value: value of that parameter
103        """
104        #print self.param_name, self.param_value
105        #self.model_list[0].setParam(name,value)
106        return self.list_param
107       
108    def reset_model(self,model):
109        """
110            reset a model when parameter has changed
111            @param value: new model
112        """
113        #print "fitproblem : reset model"
114        self.model_list[0]=model
115       
116    def schedule_tofit(self, schedule=0):
117        """
118             set schedule to true to decide if this fit  must be performed
119        """
120        self.schedule=schedule
121       
122    def get_scheduled(self):
123        """ return true or false if a problem as being schedule for fitting"""
124        return self.schedule
125    def clear_model_param(self):
126        """
127        clear constraint info
128        """
129        self.list_param=[]
Note: See TracBrowser for help on using the repository browser.