Ignore:
Timestamp:
Dec 14, 2009 8:39:21 AM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
6e9976b
Parents:
7975f2b
Message:

implement set and get state

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/modelTemplate.txt

    rf9bf661 rfe9c19b4  
    2828class [PYTHONCLASS]([CPYTHONCLASS], BaseComponent): 
    2929    """ Class that evaluates a [PYTHONCLASS] model.  
    30         This file was auto-generated from [INCLUDE_FILE]. 
    31         Refer to that file and the structure it contains 
    32         for details of the model. 
    33         [DEFAULT_LIST] 
     30        This file was auto-generated from [INCLUDE_FILE]. 
     31        Refer to that file and the structure it contains 
     32        for details of the model. 
     33        [DEFAULT_LIST] 
    3434    """ 
    3535         
     
    4646        self.description ="""[DESCRIPTION]""" 
    4747        
    48                 [PAR_DETAILS] 
    49                 ## fittable parameters 
     48        [PAR_DETAILS] 
     49        ## fittable parameters 
    5050        self.fixed=[FIXED] 
    5151         
     
    5656        """ Return a identical copy of self """ 
    5757        return self._clone([PYTHONCLASS]())    
     58         
     59    def __getstate__(self): 
     60        """ return object state for pickling and copying """ 
     61        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
     62         
     63        return self.__dict__, model_state 
     64         
     65    def __setstate__(self, state): 
     66        """ create object from pickled state """ 
     67         
     68        self.__dict__, model_state = state 
     69        self.params = model_state['params'] 
     70        self.dispersion = model_state['dispersion'] 
     71        self.log = model_state['log'] 
     72         
    5873    
    5974    def run(self, x = 0.0): 
Note: See TracChangeset for help on using the changeset viewer.