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

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

drawing sim_page

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