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

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 c9636f7 was 925a30e, checked in by Gervaise Alina <gervyh@…>, 16 years ago

comments added to class

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