Changeset 5650ebf in sasview for sansmodels/src
- Timestamp:
- Nov 26, 2010 5:23:44 PM (14 years ago)
- 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:
- 02879ea
- Parents:
- 07c4599
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/modelTemplate.txt
r35aface r5650ebf 28 28 from sans_extension.c_models import [CPYTHONCLASS] 29 29 import copy 30 30 31 def create_[PYTHONCLASS](): 32 obj = [PYTHONCLASS]() 33 #[CPYTHONCLASS].__init__(obj) is called by [PYTHONCLASS] constructor 34 return obj 35 31 36 class [PYTHONCLASS]([CPYTHONCLASS], BaseComponent): 32 37 """ … … 43 48 # Initialize BaseComponent first, then sphere 44 49 BaseComponent.__init__(self) 50 #apply([CPYTHONCLASS].__init__, (self,)) 45 51 [CPYTHONCLASS].__init__(self) 46 52 … … 54 60 self.fixed=[FIXED] 55 61 56 ## non-fittable parameters57 self.non_fittable=[NON_FITTABLE_PARAMS]58 59 62 ## parameters with orientation 60 63 self.orientation_params =[ORIENTATION_PARAMS] 61 64 65 def __reduce_ex__(self, proto): 66 """ 67 Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of 68 c model. 69 """ 70 return (create_[PYTHONCLASS],tuple()) 71 62 72 def clone(self): 63 73 """ Return a identical copy of self """ 64 74 return self._clone([PYTHONCLASS]()) 65 66 def __getstate__(self):67 """68 return object state for pickling and copying69 """70 model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}71 72 return self.__dict__, model_state73 74 def __setstate__(self, state):75 """76 create object from pickled state77 78 :param state: the state of the current model79 80 """81 82 self.__dict__, model_state = state83 self.params = model_state['params']84 self.dispersion = model_state['dispersion']85 self.log = model_state['log']86 75 87 76
Note: See TracChangeset
for help on using the changeset viewer.