source: sasview/sansview/perspectives/fitting/fitproblem.py @ 3b19ac9

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

working on simultaneous fit and scipy/park fit added on menubar

  • Property mode set to 100644
File size: 2.6 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.data=None
19        self.theory_name=None
20        self.model_list=[]
21        self.schedule='False'
22       
23    def set_model(self,model,name):
24        """
25             associates each model with its new created name
26             @param model: model selected
27             @param name: name created for model
28        """
29        self.model_list=[model,name]
30
31 
32    def add_data(self,data):
33        """
34            save a copy of the data select to fit
35            @param data: data selected
36        """
37        self.data = data
38           
39    def get_model(self):
40        """ @return: saved model """
41        return self.model_list
42     
43    def get_data(self):
44        """ @return:  list of data dList"""
45        return self.data
46     
47     
48    def get_theory(self):
49        """ @return the name of theory for plotting purpose"""
50        return self.theory_name
51   
52   
53    def set_theory(self,name):
54        """
55            Set theory name
56            @param name: name of the theory
57        """
58        self.theory_name = name
59
60       
61    def set_model_param(self,name,value):
62        """
63            set the value of a given parameter of this model
64            @param name: name of the given parameter
65            @param value: value of that parameter
66        """
67       
68        self.model_list[0].setParam(name,value)
69       
70       
71    def reset_model(self,model):
72        """
73            reset a model when parameter has changed
74            @param value: new model
75        """
76        print "fitproblem : reset model"
77        self.model_list[0]=model
78       
79    def schedule_tofit(self, schedule='False'):
80        """
81             set schedule to true to decide if this fit  must be performed
82        """
83        self.schedule=schedule
84    def get_scheduled(self):
85        """ return true or false if a problem as being schedule for fitting"""
86        return self.schedule
87   
88   
Note: See TracBrowser for help on using the repository browser.