Changeset a68efd1 in sasview for sansmodels/src/sans/models


Ignore:
Timestamp:
Mar 31, 2009 11:10:38 AM (16 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:
9853ad0
Parents:
cd3d15b
Message:

implement clone function for 3 models

Location:
sansmodels/src/sans/models
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/MultiplicationModel.py

    r8cfdd5e ra68efd1  
    22from sans.models.BaseComponent import BaseComponent 
    33import numpy, math 
    4  
     4import copy 
    55class MultiplicationModel(BaseComponent): 
    66    """ 
     
    4040        self._set_fixed_params()   
    4141         
    42            
     42    def _clone(self, obj): 
     43        """ 
     44            Internal utility function to copy the internal 
     45            data members to a fresh copy. 
     46        """ 
     47        obj.params     = copy.deepcopy(self.params) 
     48        obj.description     = copy.deepcopy(self.description) 
     49        obj.details    = copy.deepcopy(self.details) 
     50        obj.dispersion = copy.deepcopy(self.dispersion) 
     51        obj.model1  = self.model1.clone() 
     52        obj.model2  = self.model2.clone() 
     53         
     54        return obj 
     55     
     56     
    4357    def _set_dispersion(self): 
    4458        """ 
  • sansmodels/src/sans/models/NoStructure.py

    r8cfdd5e ra68efd1  
    2424    def clone(self): 
    2525        """ Return a identical copy of self """ 
    26         return 1 
     26        return self._clone(NoStructure())    
    2727    
    2828    def run(self, x = 0.0): 
  • sansmodels/src/sans/models/NullModel.py

    r8f90cfd ra68efd1  
    2424    def clone(self): 
    2525        """ Return a identical copy of self """ 
    26         return 0 
     26        return self._clone(NullModel())    
    2727    
    2828    def run(self, x = 0.0): 
Note: See TracChangeset for help on using the changeset viewer.