Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use a plugin model created with a plugin model in 5.0.1 #1451

Open
smk78 opened this issue Jan 31, 2020 · 21 comments
Open

Cannot use a plugin model created with a plugin model in 5.0.1 #1451

smk78 opened this issue Jan 31, 2020 · 21 comments
Assignees
Labels
Blocker Prevents a different issue from being resolved Good First Issue Issues that are appropriate for newbies Spring Cleaning 2024
Milestone

Comments

@smk78
Copy link
Contributor

smk78 commented Jan 31, 2020

Testing 5.0.1 Build 321 on W10/x64

If you use Add/Multiply Models to create a plugin, and then use Add/Multiply Models again but trying to use the previous plugin as one of the selected models, a plugin model file is created but is not recognised by SasView.

To reproduce:

  • Run 5.0.1
  • Fitting > Add/Multiply Models
  • Give a plugin name (yyy)
  • Enter a description (gaussian_plus_gaussian)
  • Select model_1 as gaussian_peak
  • Select model_2 as gaussian_peak
  • Select + and Apply

Log Explorer reports

15:14:50 - INFO: Model function (yyy) has been set!
15:15:18 - INFO: Model function (yyy) has been set!
15:15:18 - INFO: "C:\Program Files\SasView-5.0.1-Build321\tinycc-data\tcc.exe" -shared -rdynamic -Wall C:\Users\smk78\AppData\Local\Temp\sas64_gaussian_peak_bho4i_1s.c -o C:\Users\smk78\.sasmodels\compiled_models\sas64_gaussian_peak.so
15:15:19 - INFO: Custom model yyy successfully created.
  • To verify the plugin exists either look for it in Fitting > Manage Custom Models, or load it in a FitPage as a plugin model.
  • Now return to Fitting > Add/Multiply Models
  • Give a plugin name (yyyy)
  • Enter a description (gaussian_plus_power)
  • Select model_1 as yyy
  • Select model_2 as power_law
  • Select + and Apply

Log Exploer reports

15:15:38 - INFO: Model function (yyyy) has been set!
15:15:58 - INFO: Model function (yyyy) has been set!
15:15:58 - ERROR: Error building model: No module named 'sasmodels.models.yyy'
15:15:58 - ERROR:   File "C:\Program Files\SasView-5.0.1-Build321\sasmodels\generate.py", line 1155, in load_kernel_module
    __import__('sasmodels.models.'+model_name)
ModuleNotFoundError: No module named 'sasmodels.models.yyy'

A correctly formatted plugin file yyyy.py is created in .sasview\plugin_models

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

model_info = load_model_info('yyy+power_law')
model_info.name = 'yyyy'
model_info.description = 'yyy_plus_power'
Model = make_model_from_info(model_info)

but yyyy does not appear in the Plugin Manager or in the list of FitPage models.

@smk78 smk78 added the Blocker Prevents a different issue from being resolved label Jan 31, 2020
@smk78 smk78 added this to the SasView 5.0.1 milestone Jan 31, 2020
@smk78
Copy link
Contributor Author

smk78 commented Jan 31, 2020

Also see #1452

@rozyczko
Copy link
Member

Isn't that a know issue with not being able to set a three model sum?
#1360
This problem goes deep into sasmodels and is selected for 5.1

@smk78
Copy link
Contributor Author

smk78 commented Feb 3, 2020

Darn! And it's not like I didn't try searching issues to see if this had been reported before! The extra information here, I guess, is that the problem also extends to plugins.

Can we do something in the interim; try catch this happening and handle it more gracefully?

@butlerpd
Copy link
Member

butlerpd commented Feb 4, 2020

I think sum/product are plugins right? More graceful handling is always better but am at a loss as to what that would look like? any ideas?

@smk78
Copy link
Contributor Author

smk78 commented Feb 4, 2020

The extra information here, I guess, is that the problem also extends to plugins.
All I meant by this was that Richard's issue #1360 only tested built-in models, whereas as I've demonstrated the underlying problem affects all models, built-in and plugin in both 4.x and 5.x.

I accept this is going to be too big to fix for 5.0.1. So what to do...

As things stand, the situation is that the only way you can reliably and correctly combine more than 2 models into a custom/plugin model is to edit the .py directly (the approach shown in the last code snippet in #1452). Trying to combine more than 2 models in 5.x by any other route simply doesn't work; trying to combine more than 2 models in 4.x by any other route actually mislabels and omits parameters and thereby produces faulty fits.

We have to make our users aware of this defect.

We can put some warnings in fitting_help (I volunteer to do that), but that does rely on the user reading it! :-) So can we actually do something in the Sum|Multi / Add/Multiply windows themselves (at least as a temporary measure until this problem is sorted)? Even just an 'Important: read this' link that pops up a brief explanation and then redirects to fitting_help?

@rozyczko
Copy link
Member

rozyczko commented Feb 4, 2020

Made Add/Multiply dialog show only non-plugin (predefined) models.
Added the warning text, as discussed.
All directly in ESS_GUI

@butlerpd
Copy link
Member

butlerpd commented Feb 5, 2020

Agreed at call today to disable ability to create a sum model from plugins and add a warning label to GUI window for 5.0.1. Then move issue to 5.0.2. Also create a version of this against 4.2.3 milestone.

@butlerpd butlerpd modified the milestones: SasView 5.0.1, SasView 5.0.2 Feb 5, 2020
@smk78
Copy link
Contributor Author

smk78 commented Feb 5, 2020

As the ability to select plugins in Add/Multiply has now been disabled, I've changed the new warning text slightly. Now reads 'To add/multiply plugin models, or combine more than two models, please click Help below'.

@smk78
Copy link
Contributor Author

smk78 commented Feb 5, 2020

I have substantively modified fitting_help: in part a tidy-up of the Add/Multiply Models subsection (I spotted a big chunk of duplication, for example), and also to add something about the issues with combining plugin models and how to workaround it we discussed yesterday.

I have committed direct to ESS_GUI.

@smk78
Copy link
Contributor Author

smk78 commented Feb 5, 2020

In the process I noticed that the action on pressing the Help button in /qtgui/Utilities/AddMultEditor.py was pointing to the wrong subsection of fitting_help (between the 4.x docs and the 5.x docs the section label got changed) so I updated this too.

However, when I build locally the #add-multiply-models is being ignored (as was the previous incorrect subsection identifier) and it takes you straight to the top of fitting_help.

Anyone know how to fix this?

@smk78
Copy link
Contributor Author

smk78 commented Feb 5, 2020

Changes to fitting_help (with suitable mods) now also made to 4.x fitting_help

@smk78
Copy link
Contributor Author

smk78 commented Feb 6, 2020

@rozyczko comments:
We are aware of the lack of HTML anchoring in 5.0 - there seems to be an inherent problem with passing anchors to URLs from Qt. We will have to find a solution to that, but currently we decided to wait for Qt to fix this issue.

@butlerpd
Copy link
Member

butlerpd commented Feb 7, 2020

I believe that is also a problem with Wx and 4.x? see issue #1152 carried over from Trac. Is this the same issue?

@smk78
Copy link
Contributor Author

smk78 commented Feb 7, 2020

Yes, it is. Where we specify the target of a Help button as doc_page.html#anchor_in_doc the anchor is being ignored by the browser, even though the anchor appears on the end of the URL. Which tends to suggest this is not a Qt/Wx issue?

smk78 added a commit to SasView/docs that referenced this issue Feb 11, 2020
@wpotrzebowski wpotrzebowski added the Plotting Concerns plotting functionality label Mar 17, 2020
@butlerpd butlerpd added Critical High priority and removed Blocker Prevents a different issue from being resolved labels Mar 31, 2020
@butlerpd butlerpd modified the milestones: SasView 5.0.2, SasView 5.0.3 Mar 31, 2020
@butlerpd
Copy link
Member

as per today's conversation am moving this to a 5.0.3 milestone in preparation for a 5.0.2 release. Also am removing the blocker and changing to critical since

  1. It obviously is not a blocker if we are moving it
  2. There is a work around by editing the .py file
  3. This is a much bigger project and will need some time to sort and should not prevent other improvements from being delivered as they become available.

@butlerpd butlerpd added Major Big change in the code or important change in behaviour and removed Critical High priority labels May 26, 2020
@rozyczko rozyczko modified the milestones: SasView 5.0.3, SasView 5.0.4 Jun 23, 2020
@butlerpd
Copy link
Member

butlerpd commented May 2, 2021

@rozyczko and @smk78 - looking through this thread, it seems naively to me that this could actually be a "good first issue." The fact that you can add many models together by editing the python code directly should mean that all that is needed is to alter the GUI code to be smarter about how it codes the addition? Or am I completely gaga?

@butlerpd butlerpd modified the milestones: SasView 5.0.4, SasView 5.0.5 May 2, 2021
@smk78
Copy link
Contributor Author

smk78 commented May 2, 2021

Maybe. It depends what the origin of the ModuleNotFoundError is. So this could go beyond just a GUI issue.

@butlerpd
Copy link
Member

butlerpd commented May 2, 2021

Ok .. I guess my point was that if this can be made to work properly by editing the python file then a GUI fixe must by definition be possible (though maybe not the best answer depending on the origin). Question I guess is: Is it true that I can create a plugin model that incorporates another plugin by editing the python file?

@smk78
Copy link
Contributor Author

smk78 commented May 2, 2021

Question I guess is: Is it true that I can create a plugin model that incorporates another plugin by editing the python file?

Yes. That is the workaround. We added as much to the docs and Known Issues!

@butlerpd butlerpd added the Good First Issue Issues that are appropriate for newbies label May 2, 2021
@butlerpd
Copy link
Member

butlerpd commented May 2, 2021

In that case I'm going to call it a good first issue to implement that work around in the GUI. Partly on the grounds that it may take a while for significant infrastructure changes to be made.

@butlerpd butlerpd modified the milestones: SasView 5.0.5, SasView 5.1.0 Jan 4, 2022
@butlerpd butlerpd added Blocker Prevents a different issue from being resolved and removed Major Big change in the code or important change in behaviour Plotting Concerns plotting functionality labels Jan 4, 2022
@butlerpd
Copy link
Member

butlerpd commented Jan 4, 2022

As agreed at fortnightly SasView meeting, this needs to be resolved so that changes to models that have been made between 5.0.5 and the next release won't break 5.x projects!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Prevents a different issue from being resolved Good First Issue Issues that are appropriate for newbies Spring Cleaning 2024
Projects
None yet
Development

No branches or pull requests

5 participants