Changeset 9457498 in sasmodels


Ignore:
Timestamp:
Aug 8, 2016 8:32:13 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3a45c2c
Parents:
2472141
Message:

support old style custom formula models (but not sum or product)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r99f446a r9457498  
    1515import traceback 
    1616import logging 
     17from os.path import basename, splitext 
    1718 
    1819import numpy as np  # type: ignore 
     20 
     21# Monkey patch sas.sascalc.fit as sas.models so that sas.models.pluginmodel 
     22# is available to the plugin modules. 
     23import sys 
     24import sas 
     25import sas.sascalc.fit 
     26sys.modules['sas.models'] = sas.sascalc.fit 
     27sas.models = sas.sascalc.fit 
    1928 
    2029from . import core 
     
    3746    pass 
    3847 
     48 
    3949# TODO: separate x_axis_label from multiplicity info 
    4050MultiplicityInfo = collections.namedtuple( 
     
    8494    Load a custom model given the model path. 
    8595    """ 
    86     #print("load custom model", path) 
    8796    kernel_module = custom.load_custom_kernel_module(path) 
    8897    try: 
    8998        model = kernel_module.Model 
     99        # Old style models do not set the name in the class attributes, so 
     100        # set it here; this name will be overridden when the object is created 
     101        # with an instance variable that has the same value. 
     102        if model.name == "": 
     103            model.name = splitext(basename(path))[0] 
    90104    except AttributeError: 
    91105        model_info = modelinfo.make_model_info(kernel_module) 
Note: See TracChangeset for help on using the changeset viewer.