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

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

close page bug fixed

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