Changeset ad79f49 in sasmodels for sasmodels/sasview_model.py


Ignore:
Timestamp:
Sep 12, 2017 11:29:02 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
946c8d27
Parents:
a57a902 (diff), b18e650 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ticket-741

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r44ca3e1 rad79f49  
    120120    else: 
    121121        model_info = modelinfo.make_model_info(kernel_module) 
    122         model = _make_model_from_info(model_info) 
     122        model = make_model_from_info(model_info) 
    123123    model.timestamp = getmtime(path) 
    124124 
     
    142142 
    143143 
     144def make_model_from_info(model_info): 
     145    # type: (ModelInfo) -> SasviewModelType 
     146    """ 
     147    Convert *model_info* into a SasView model wrapper. 
     148    """ 
     149    def __init__(self, multiplicity=None): 
     150        SasviewModel.__init__(self, multiplicity=multiplicity) 
     151    attrs = _generate_model_attributes(model_info) 
     152    attrs['__init__'] = __init__ 
     153    attrs['filename'] = model_info.filename 
     154    ConstructedModel = type(model_info.name, (SasviewModel,), attrs) # type: SasviewModelType 
     155    return ConstructedModel 
     156 
     157 
    144158def _make_standard_model(name): 
    145159    # type: (str) -> SasviewModelType 
     
    153167    kernel_module = generate.load_kernel_module(name) 
    154168    model_info = modelinfo.make_model_info(kernel_module) 
    155     return _make_model_from_info(model_info) 
     169    return make_model_from_info(model_info) 
    156170 
    157171 
     
    187201    model_info = product.make_product_info(form_factor._model_info, 
    188202                                           structure_factor._model_info) 
    189     ConstructedModel = _make_model_from_info(model_info) 
     203    ConstructedModel = make_model_from_info(model_info) 
    190204    return ConstructedModel() 
    191205 
    192 def _make_model_from_info(model_info): 
    193     # type: (ModelInfo) -> SasviewModelType 
    194     """ 
    195     Convert *model_info* into a SasView model wrapper. 
    196     """ 
    197     def __init__(self, multiplicity=None): 
    198         SasviewModel.__init__(self, multiplicity=multiplicity) 
    199     attrs = _generate_model_attributes(model_info) 
    200     attrs['__init__'] = __init__ 
    201     attrs['filename'] = model_info.filename 
    202     ConstructedModel = type(model_info.name, (SasviewModel,), attrs) # type: SasviewModelType 
    203     return ConstructedModel 
    204206 
    205207def _generate_model_attributes(model_info): 
Note: See TracChangeset for help on using the changeset viewer.