Changeset 72a081d in sasmodels for sasmodels/sasview_model.py
- Timestamp:
- Mar 19, 2016 6:52:46 AM (8 years ago)
- 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:
- f3d7abd
- Parents:
- ce43de0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/sasview_model.py
r08376e7 r72a081d 16 16 import math 17 17 from copy import deepcopy 18 import warnings19 18 import collections 20 19 … … 22 21 23 22 from . import core 23 from . import generate 24 from . import custom 24 25 25 26 def standard_models(): 26 27 return [make_class(model_name) for model_name in core.list_models()] 27 28 28 def make_class(model_name, namestyle='name'): 29 # TODO: rename to make_class_from_name and update sasview 30 def make_class(model_name): 29 31 """ 30 32 Load the sasview model defined in *kernel_module*. … … 37 39 """ 38 40 model_info = core.load_model_info(model_name) 41 return make_class_from_info(model_info) 42 43 def make_class_from_file(path): 44 model_info = core.load_model_info_from_path(path) 45 return make_class_from_info(model_info) 46 47 def make_class_from_info(model_info): 39 48 def __init__(self, multfactor=1): 40 49 SasviewModel.__init__(self) 41 50 attrs = dict(__init__=__init__, _model_info=model_info) 42 ConstructedModel = type(model_info[ namestyle], (SasviewModel,), attrs)51 ConstructedModel = type(model_info['name'], (SasviewModel,), attrs) 43 52 return ConstructedModel 44 53
Note: See TracChangeset
for help on using the changeset viewer.