Changeset 293fee5 in sasmodels


Ignore:
Timestamp:
Sep 27, 2018 11:21:19 PM (4 weeks ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
ticket-1157
Children:
0535624
Parents:
b6d1d52
Message:

test that sasview model defaults to zero background

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    rd533590 r293fee5  
    870870    CylinderModel().evalDistribution([0.1, 0.1]) 
    871871 
     872def test_structure_factor_background(): 
     873    # type: () -> None 
     874    """ 
     875    Check that sasview model and direct model match, with background=0. 
     876    """ 
     877    from .data import empty_data1D 
     878    from .core import load_model_info, build_model 
     879    from .direct_model import DirectModel 
     880 
     881    model_name = "hardsphere" 
     882    q = [0.0] 
     883 
     884    sasview_model = _make_standard_model(model_name)() 
     885    sasview_value = sasview_model.evalDistribution(np.array(q))[0] 
     886 
     887    data = empty_data1D(q) 
     888    model_info = load_model_info(model_name) 
     889    model = build_model(model_info) 
     890    direct_model = DirectModel(data, model) 
     891    direct_value_zero_background = direct_model(background=0.0) 
     892 
     893    assert sasview_value == direct_value_zero_background 
     894 
     895    # Additionally check that direct value background defaults to zero 
     896    direct_value_default = direct_model() 
     897    assert sasview_value == direct_value_default 
     898 
     899 
    872900def magnetic_demo(): 
    873901    Model = _make_standard_model('sphere') 
     
    890918    #print("rpa:", test_rpa()) 
    891919    #test_empty_distribution() 
     920    #test_structure_factor_background() 
Note: See TracChangeset for help on using the changeset viewer.