source: sasview/sansview/perspectives/fitting/fitproblem.py @ 2bc8d4a

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 2bc8d4a was 888e62c, checked in by Gervaise Alina <gervyh@…>, 16 years ago

sansview print remove

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