SasView / sasview

Code for the SasView application.
BSD 3-Clause "New" or "Revised" License
49 stars 41 forks source link

Sum|Multiply loses or mislabels parameters in plugin models created with plugins in 4.2.2 #1452

Open smk78 opened 4 years ago

smk78 commented 4 years ago

Using 4.2.2 on W10/x64

User Matt Potter noticed that when building a plugin model from other plugin models using Sum|Multiply, sometimes the individual model parameter identifier (eg, A, B, etc) was being applied to parameters from the wrong model.

In trying to replicate this behaviour, I discovered that some model parameters got totally omitted!

However, if you manually edit the plugin file so that you are not using plugin model names, all is well.

To reproduce:

A valid plugin is created:

from sasmodels.core import load_model_info
from sasmodels.sasview_model import make_model_from_info

model_info = load_model_info('gaussian_peak+gaussian_peak')
model_info.name = 'zzz'
model_info.description = 'gauss_plus_gauss'
Model = make_model_from_info(model_info)

Now build on that plugin:

A valid plugin is created:

from sasmodels.core import load_model_info
from sasmodels.sasview_model import make_model_from_info

model_info = load_model_info('zzz+power_law')
model_info.name = 'zzzz'
model_info.description = 'zzz_plus_power'
Model = make_model_from_info(model_info)

Now build on that plugin:

A valid plugin is created:

from sasmodels.core import load_model_info
from sasmodels.sasview_model import make_model_from_info

model_info = load_model_info('zzzz+fractal')
model_info.name = 'zzzzz'
model_info.description = 'zzzz_plus_fractal'
Model = make_model_from_info(model_info)

All three plugins can be loaded into a FitPage

Now go to .sasview\plugin_models and make a copy of one of the plugins.

from sasmodels.core import load_model_info
from sasmodels.sasview_model import make_model_from_info

model_info = load_model_info('gaussian_peak+gaussian_peak+power_law+fractal')
model_info.name = 'zzzzzz'
model_info.description = 'the-lot'
Model = make_model_from_info(model_info)

Create two FitPages and load plugin zzzzz into one of them:

image

and load plugin zzzzzz into the other:

image

Notice that:

Whereas the zzzzzz (2nd) case is the expected - and correct!!! - result.

smk78 commented 4 years ago

Also see https://github.com/SasView/sasview/issues/1451

smk78 commented 4 years ago

4.x fitting_help modified as per changes made to 5.x fitting_help (see https://github.com/SasView/sasview/issues/1451)

butlerpd commented 4 years ago

I note that in another ticket, @pkienzle suggests we don't need the two make_model_from_info lines in the mixture models above. Not sure if that is causing part of the problem? but doubt it. As I understand it however the deeper problem is buried in sasmodels and not a quick fix. I am therefore going to move this to the graveyard pile (there being other relevant issues for 5.x) for now.