Changeset 2f2c70c in sasmodels
- Timestamp:
- Oct 10, 2016 12:56:09 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3a45c2c
- Parents:
- 8f93522
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/sasview_model.py
r8f93522 r2f2c70c 127 127 model = _make_model_from_info(model_info) 128 128 129 # If we are trying to load a model that already exists, 130 # append a version number to its name. 131 # Note that models appear to be periodically reloaded 132 # by SasView and keeping track of whether we are reloading 133 # a model or loading it for the first time is tricky. 134 # For now, just allow one custom model of a given name. 135 if model.name in MODELS: 136 model.name = "%s_v2" % model.name 129 # If a model name already exists and we are loading a different model, 130 # use the model file name as the model name. 131 if model.name in MODELS and not model.filename == MODELS[model.name].filename: 132 _previous_name = model.name 133 model.name = model.id 134 135 # If the new model name is still in the model list (for instance, 136 # if we put a cylinder.py in our plug-in directory), then append 137 # an identifier. 138 if model.name in MODELS and not model.filename == MODELS[model.name].filename: 139 model.name = model.id + '_user' 140 logging.info("Model %s already exists: using %s [%s]", _previous_name, model.name, model.filename) 137 141 138 142 MODELS[model.name] = model … … 163 167 attrs = _generate_model_attributes(model_info) 164 168 attrs['__init__'] = __init__ 169 attrs['filename'] = model_info.filename 165 170 ConstructedModel = type(model_info.name, (SasviewModel,), attrs) # type: SasviewModelType 166 171 return ConstructedModel
Note: See TracChangeset
for help on using the changeset viewer.