source: sasview/sansview/perspectives/fitting/fitproblem.py @ ca94880

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 ca94880 was 2140e68, checked in by Gervaise Alina <gervyh@…>, 16 years ago

drawing sim_page

  • Property mode set to 100644
File size: 3.8 KB
Line 
1
2class FitProblem:
3    """ 
4        FitProblem class allows to link a model with the new name created in _on_model,
5        a name theory created with that model  and the data fitted with the model.
6        FitProblem is mostly used  as value of the dictionary by fitting module.
7    """
8   
9    def __init__(self):
10       
11        """
12           contains information about data and model to fit
13        """
14        ## data used for fitting
15        self.fit_data=None
16        ## the current model
17        self.model = None
18        ## if 1 this fit problem will be selected to fit , if 0
19        ## it will not be selected for fit
20        self.schedule=0
21        ##list containing parameter name and value
22        self.list_param=[]
23        ## smear object to smear or not data1D
24        self.smearer= None
25        ## same as fit_data but with more info for plotting
26        ## axis unit info and so on see plottables definition
27        self.plotted_data=None
28        ## fitting range
29        self.qmin = None
30        self.qmax = None
31       
32       
33    def set_smearer(self, smearer):
34        """
35          save reference of  smear object on fitdata
36          @param smear : smear object from DataLoader
37        """
38        self.smearer= smearer
39       
40    def get_smearer(self):
41        """
42            return smear object
43        """
44        return self.smearer
45   
46    def save_model_name(self, name): 
47        self.name_per_page= name
48       
49       
50    def get_name(self):
51        return self.name_per_page
52   
53    def set_model(self,model):
54        """
55             associates each model with its new created name
56             @param model: model selected
57             @param name: name created for model
58        """
59        self.model= model
60       
61       
62    def get_model(self):
63        """ @return: saved model """
64        return self.model
65 
66 
67    def add_plotted_data(self,data):
68        """
69            save a copy of the data select to fit
70            @param data: data selected
71        """
72        self.plotted_data = data
73       
74
75    def get_plotted_data(self):
76        """ @return:  list of data dList"""
77        return self.plotted_data
78   
79   
80    def add_fit_data(self,data):
81        """
82            save a copy of the data select to fit
83            @param data: data selected
84        """
85        self.fit_data = data
86           
87   
88    def get_fit_data(self):
89        return self.fit_data
90   
91       
92    def set_model_param(self,name,value=None):
93        """
94            Store the name and value of a parameter of this fitproblem's model
95            @param name: name of the given parameter
96            @param value: value of that parameter
97        """
98        self.list_param.append([name,value])
99       
100       
101    def get_model_param(self):
102        """
103            @return list of couple of parameter name and value
104        """
105        return self.list_param
106       
107       
108    def schedule_tofit(self, schedule=0):
109        """
110             set schedule to true to decide if this fit  must be performed
111        """
112        self.schedule=schedule
113       
114       
115    def get_scheduled(self):
116        """ return true or false if a problem as being schedule for fitting"""
117        return self.schedule
118   
119
120    def set_range(self, qmin=None, qmax=None):
121        """
122            set fitting range
123        """
124        self.qmin = qmin
125        self.qmax = qmax
126       
127       
128    def get_range(self):
129        """
130            @return fitting range:
131        """
132        return self.qmin, self.qmax
133   
134    def clear_model_param(self):
135        """
136        clear constraint info
137        """
138        self.list_param=[]
139       
140   
141   
142       
Note: See TracBrowser for help on using the repository browser.