Changeset 0a82216 in sasmodels


Ignore:
Timestamp:
Feb 18, 2015 11:45:24 AM (9 years ago)
Author:
ajj
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:
6a729a2
Message:

making delivery of class with new name the default. now have to pass parameter to get the old SasView? name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r3271e20 r0a82216  
    3232 
    3333 
    34 def make_class(kernel_module, dtype='single'): 
     34def make_class(kernel_module, dtype='single', namestyle='name'): 
    3535    """ 
    3636    Load the sasview model defined in *kernel_module*. 
    3737 
    3838    Returns a class that can be used directly as a sasview model. 
     39 
     40    Defaults to using the new name for a model. Setting namestyle='name' 
     41    will produce a class with a name compatible with SasView 
    3942    """ 
    4043    model =  load_model(kernel_module, dtype=dtype) 
     
    4245        SasviewModel.__init__(self, model) 
    4346    attrs = dict(__init__=__init__) 
    44     ConstructedModel = type(model.info['oldname'],  (SasviewModel,), attrs) 
     47    ConstructedModel = type(model.info[namestyle],  (SasviewModel,), attrs) 
    4548    return ConstructedModel 
    4649 
Note: See TracChangeset for help on using the changeset viewer.