source: sasview/sansview/perspectives/fitting/fitproblem.py @ 5ef55d2

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 5ef55d2 was 6bbeacd4, checked in by Gervaise Alina <gervyh@…>, 14 years ago

remove other type of data

  • Property mode set to 100644
File size: 5.0 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    def __init__(self):
9        """
10        contains information about data and model to fit
11        """
12        ## data used for fitting
13        self.fit_data = None
14        self.theory_data = None
15        ## the current model
16        self.model = None
17        self.model_index = 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        self.fit_tab_caption = ''
26        ## fitting range
27        self.qmin = None
28        self.qmax = None
29       
30    def clone(self):
31        """
32        copy fitproblem
33        """
34        import copy 
35        obj          = FitProblem()
36        model= None
37        if self.model!=None:
38            model = self.model.clone()
39        obj.model = model
40        obj.fit_data = copy.deepcopy(self.fit_data)
41        obj.theory_data = copy.deepcopy(self.theory_data)
42        obj.model = copy.deepcopy(self.model)
43        obj.schedule = copy.deepcopy(self.schedule)
44        obj.list_param = copy.deepcopy(self.list_param)
45        obj.smearer = copy.deepcopy(self.smearer)
46        obj.plotted_data = copy.deepcopy(self.plotted_data)
47        obj.qmin = copy.deepcopy(self.qmin)
48        obj.qmax = copy.deepcopy(self.qmax)
49        return obj
50       
51    def set_smearer(self, smearer):
52        """
53        save reference of  smear object on fitdata
54       
55        :param smear: smear object from DataLoader
56       
57        """
58        self.smearer= smearer
59       
60    def get_smearer(self):
61        """
62        return smear object
63        """
64        return self.smearer
65   
66    def save_model_name(self, name):
67        """
68        """ 
69        self.name_per_page= name
70       
71    def get_name(self):
72        """
73        """
74        return self.name_per_page
75   
76    def set_model(self,model):
77        """
78        associates each model with its new created name
79       
80        :param model: model selected
81        :param name: name created for model
82       
83        """
84        self.model= model
85       
86    def get_model(self):
87        """
88        :return: saved model
89       
90        """
91        return self.model
92 
93    def set_index(self, index):
94        """
95        set index of the model name
96        """
97        self.model_index = index
98       
99    def get_index(self):
100        """
101        get index of the model name
102        """
103        return self.model_index
104   
105    def set_theory_data(self, data):
106        """
107        save a copy of the data select to fit
108       
109        :param data: data selected
110       
111        """
112        self.theory_data = data
113       
114
115    def get_theory_data(self):
116        """
117        :return: list of data dList
118       
119        """
120        return self.theory_data
121
122    def set_fit_data(self,data):
123        """
124        save a copy of the data select to fit
125       
126        :param data: data selected
127       
128        """
129        self.fit_data = data
130           
131    def get_fit_data(self):
132        """
133        """
134        return self.fit_data
135   
136    def set_model_param(self,name,value=None):
137        """
138        Store the name and value of a parameter of this fitproblem's model
139       
140        :param name: name of the given parameter
141        :param value: value of that parameter
142       
143        """
144        self.list_param.append([name,value])
145       
146    def get_model_param(self):
147        """
148        return list of couple of parameter name and value
149        """
150        return self.list_param
151       
152    def schedule_tofit(self, schedule=0):
153        """
154        set schedule to true to decide if this fit  must be performed
155        """
156        self.schedule=schedule
157       
158    def get_scheduled(self):
159        """
160        return true or false if a problem as being schedule for fitting
161        """
162        return self.schedule
163   
164    def set_range(self, qmin=None, qmax=None):
165        """
166        set fitting range
167        """
168        self.qmin = qmin
169        self.qmax = qmax
170       
171    def get_range(self):
172        """
173        :return: fitting range
174       
175        """
176        return self.qmin, self.qmax
177   
178    def clear_model_param(self):
179        """
180        clear constraint info
181        """
182        self.list_param=[]
183       
184    def set_fit_tab_caption(self, caption):
185        """
186        """
187        self.fit_tab_caption = str(caption)
188       
189    def get_fit_tab_caption(self):
190        """
191        """
192        return self.fit_tab_caption
193   
194   
Note: See TracBrowser for help on using the repository browser.