Changeset 17db833 in sasmodels


Ignore:
Timestamp:
Nov 2, 2017 5:59:45 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c11d09f, 82592da, c15e03c
Parents:
ce99754
Message:

fix structure factor models, so scale=1, background=0 again

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    rce99754 r17db833  
    764764                return self.multiplicity, [self.multiplicity], [1.0] 
    765765            else: 
    766                 # For hidden parameters use NaN 
    767                 return np.NaN, [np.NaN], [1.0] 
     766                # For hidden parameters use default values.  This sets 
     767                # scale=1 and background=0 for structure factors 
     768                default = self._model_info.parameters.defaults.get(par.name, np.NaN) 
     769                return default, [default], [1.0] 
    768770        elif par.polydisperse: 
    769771            value = self.params[par.name] 
     
    796798    Model = _make_standard_model('hardsphere') 
    797799    model = Model() 
    798     value = model.evalDistribution([0.1, 0.1]) 
    799     if np.isnan(value): 
    800         raise ValueError("hardsphere returns null") 
     800    value2d = model.evalDistribution([0.1, 0.1]) 
     801    value1d = model.evalDistribution(np.array([0.1*np.sqrt(2)])) 
     802    #print("hardsphere", value1d, value2d) 
     803    if np.isnan(value1d) or np.isnan(value2d): 
     804        raise ValueError("hardsphere returns nan") 
    801805 
    802806def test_product(): 
     
    865869    print("cylinder(0.1,0.1)=%g"%test_cylinder()) 
    866870    #test_product() 
    867     #test_rpa() 
     871    #test_structure_factor() 
     872    #print("rpa:", test_rpa()) 
    868873    #test_empty_distribution() 
Note: See TracChangeset for help on using the changeset viewer.