Changeset 0535624 in sasmodels


Ignore:
Timestamp:
Sep 27, 2018 11:53:30 PM (3 months ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
ticket-1157
Children:
6da1d76
Parents:
293fee5
Message:

set background=0 in modelinfo.defaults, and simplify sasview model wrapper

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/modelinfo.py

    r1e420e6 r0535624  
    478478                         if p.polydisperse and p.type not in ('orientation', 'magnetic')) 
    479479        self.pd_2d = set(p.name for p in self.call_parameters if p.polydisperse) 
     480 
     481    def set_zero_background(self): 
     482        """ 
     483        Set the default background to zero for this model.  This is done for 
     484        structure factor models. 
     485        """ 
     486        # type: () -> None 
     487        # Make sure background is the second common parameter. 
     488        assert self.common_parameters[1].id == "background" 
     489        self.common_parameters[1].default = 0.0 
     490        self.defaults = self._get_defaults() 
    480491 
    481492    def check_angles(self): 
     
    787798    structure_factor = getattr(kernel_module, 'structure_factor', False) 
    788799    if structure_factor: 
    789         # Make sure background is the second common parameter. 
    790         assert parameters.common_parameters[1].id == "background" 
    791         parameters.common_parameters[1].default = 0.0 
     800        parameters.set_zero_background() 
    792801 
    793802    # TODO: remove demo parameters 
  • sasmodels/sasview_model.py

    r293fee5 r0535624  
    371371            hidden.add('scale') 
    372372            hidden.add('background') 
    373             self._model_info.parameters.defaults['background'] = 0. 
    374373 
    375374        self._persistency_dict = {} 
Note: See TracChangeset for help on using the changeset viewer.