Opened 8 years ago
Last modified 8 years ago
#583 closed defect
Sum|Multi(p1,p2) does not work — at Initial Version
Reported by: | gonzalezm | Owned by: | |
---|---|---|---|
Priority: | blocker | Milestone: | SasView 4.0.0 |
Component: | SasView | Keywords: | |
Cc: | Work Package: | SasView Bug Fixing |
Description
Sum (multiplication) of two models does not work (known bug, reported also by thomas.cleveland@…)
When trying to create a model as the sum of two standard models, the following error message appears:
“Running model 'MySumFunction?.py'…
Error occurred:
Traceback (most recent call last):
File "sas\sasgui\perspectives\calculator\pyconsole.pyc", line 55, in show_model_output
File "sas\sasgui\perspectives\calculator\pyconsole.pyc", line 30, in check_model
ImportError?: cannot import name make_class”
This happens because the function make_class (in sasmodels/sasview_model.py) does not exist anymore, as it was replaced by _make_standard_model in 4d76711 on Apr 5 (Paul Kienzle adjust interface to sasview). Note: The comment at the beginning of sasview_model.py should be changed accordingly, as it still mentions make_class.
The obvious change that I tried is to replace make_class by _make_standard_model in the python file generated by “Sum|Multi(p1,p2)”, but then a different problem happens and the fitting perspective is broken, so it is even worse than the original bug.
This is what I could follow about the program execution:
- I start SasView? 4.0 having the file MG_sum1.py in the .sasview\plugin_models folder. This is just the file created by the template of “Sum|Multi(p1,p2)” for a model consisting of an sphere + a cylinder, but replacing make_class by _make_standard_model.
- In sasview\src\sas\sasgui\perspectives\fitting\models.py it is added to the plugins by the command plugins[name] = module.Model, returning a class MG_sum1.model. As a reference, a simple python model present in the plugin_models is loaded using plugins[name] = load_custom_model(filename) and we generate a class sasmodels.sasview_model.MG_simple1
- In the call to _get_multifunc_models, an error is generated because the class Model has no attribute ‘is_multiplicitiy_model’