Ignore:
Timestamp:
Dec 14, 2009 10: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/Schulz.py

    rc5607fa rfe9c19b4  
    1717 
    1818        WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 
    19                  DO NOT MODIFY THIS FILE, MODIFY ../c_extensions/schulz.h 
     19                 DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\schulz.h 
    2020                 AND RE-RUN THE GENERATOR SCRIPT 
    2121 
     
    2828class Schulz(CSchulz, BaseComponent): 
    2929    """ Class that evaluates a Schulz model.  
    30         This file was auto-generated from ../c_extensions/schulz.h. 
    31         Refer to that file and the structure it contains 
    32         for details of the model. 
    33         List of default parameters: 
     30        This file was auto-generated from ..\c_extensions\schulz.h. 
     31        Refer to that file and the structure it contains 
     32        for details of the model. 
     33        List of default parameters: 
    3434         scale           = 1.0  
    3535         sigma           = 1.0  
     
    5252                z= math.pow[(1/(sigma/center),2]-1""" 
    5353        
    54                 ## Parameter details [units, min, max] 
     54        ## Parameter details [units, min, max] 
    5555        self.details = {} 
    5656        self.details['scale'] = ['', None, None] 
     
    5858        self.details['center'] = ['', None, None] 
    5959 
    60                 ## fittable parameters 
     60        ## fittable parameters 
    6161        self.fixed=[] 
    6262         
     
    6767        """ Return a identical copy of self """ 
    6868        return self._clone(Schulz())    
     69         
     70    def __getstate__(self): 
     71        """ return object state for pickling and copying """ 
     72        print "__dict__",self.__dict__ 
     73        #self.__dict__['params'] = self.params 
     74        #self.__dict__['dispersion'] = self.dispersion 
     75        #self.__dict__['log'] = self.log 
     76        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log} 
     77         
     78        return self.__dict__, model_state 
     79         
     80    def __setstate__(self, state): 
     81        """ create object from pickled state """ 
     82         
     83        self.__dict__, model_state = state 
     84        self.params = model_state['params'] 
     85        self.dispersion = model_state['dispersion'] 
     86        self.log = model_state['log'] 
     87         
    6988    
    7089    def run(self, x = 0.0): 
Note: See TracChangeset for help on using the changeset viewer.