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

Provide option to not plot residuals by default (Trac #40) #268

Closed
butlerpd opened this issue Mar 30, 2019 · 14 comments
Closed

Provide option to not plot residuals by default (Trac #40) #268

butlerpd opened this issue Mar 30, 2019 · 14 comments
Assignees
Labels
Enhancement Feature requests and/or general improvements
Milestone

Comments

@butlerpd
Copy link
Member

butlerpd commented Mar 30, 2019

When working with a number of data sets the number of plots can get large. It would be good for the user to have the option of switching to a default that residuals do not get plotted. There are two implications:

  1. How to give access to the residual plot later (could be always generated as a hidden graph for example or be dealt with in a similar way to batch where the residuals are only shown on demand)

  2. This should be part of a larger effort for setting persistent preferences -- see ticket Allow user changing of default model parameters (Trac #30) #258

Migrated from http://trac.sasview.org/ticket/40

{
    "status": "new",
    "changetime": "2017-10-23T13:04:46",
    "_ts": "2017-10-23 13:04:46.851275+00:00",
    "description": "When working with a number of data sets the number of plots can get large.  It would be good for the user to have the option of switching to a default that residuals do not get plotted.  There are two implications:[[BR]]\n\n1) How to give access to the residual plot later (could be always generated as a hidden graph for example or be dealt with in a similar way to batch where the residuals are only shown on demand)[[BR]]\n\n2) This should be part of a larger effort for setting persistent preferences -- see ticket #30",
    "reporter": "butlerpd",
    "cc": "",
    "resolution": "",
    "workpackage": "SasView Fitting Redesign",
    "time": "2012-03-30T00:11:17",
    "component": "SasView",
    "summary": "Provide option to not plot residuals by default",
    "priority": "major",
    "keywords": "",
    "milestone": "SasView 5.0.0",
    "owner": "",
    "type": "enhancement"
}
@butlerpd butlerpd added this to the SasView 5.0.0 milestone Mar 30, 2019
@butlerpd butlerpd added Enhancement Feature requests and/or general improvements Incomplete Migration Major Big change in the code or important change in behaviour and removed Incomplete Migration labels Mar 30, 2019
@butlerpd
Copy link
Member Author

Trac update at 2012/05/03 00:07:11: butlerpd commented:

As of build 6192 the residual plots can be individually hidden. If hidden then they will stay hidden as the parameters are changed. However, if a new fit page opens or the residual plot was deleted then it will pop a new residual plot as soon as the fit plot is updated. This is a help but does not completely solve the problem so will leave this ticket open for now.

@butlerpd
Copy link
Member Author

Trac update at 2012/05/06 16:15:25:

  • butlerpd changed milestone from "" to "WishList"
  • butlerpd changed type from "defect" to "enhancement"

@butlerpd
Copy link
Member Author

Trac update at 2015/01/30 01:06:02: butler changed workpackage from "" to "SasView Fitting Redesign"

@butlerpd
Copy link
Member Author

Trac update at 2015/08/14 20:20:48: butler changed milestone from "WishList" to "SasView Next Release +1"

@ajj
Copy link
Member

ajj commented Mar 30, 2019

Trac update at 2017/01/17 13:05:47: ajj changed component from "SansView" to "SasView"

@butlerpd
Copy link
Member Author

Trac update at 2017/10/23 13:00:36: butler changed milestone from "SasView Next Release +1" to "SasView 5.0.0"

@smk78
Copy link
Contributor

smk78 commented Mar 30, 2019

Trac update at 2017/10/23 13:04:46: smk78 commented:

Could add a residuals on/off toggle to the plotting context menu?

@lucas-wilkins
Copy link
Contributor

See also #2164

@lucas-wilkins lucas-wilkins removed Migrated from Trac Major Big change in the code or important change in behaviour labels Sep 14, 2022
@krzywon
Copy link
Contributor

krzywon commented Jun 8, 2023

Currently, the branch I have been working on (268-auto-plot-residuals) throws an error when plotting and will need to be debugged to finish the work.

sas.qtgui.Perspectives.Fitting.FittingWidget - ERROR - Traceback (most recent call last):
File "sasview\src\sas\qtgui\MainWindow\GuiManager.py", line 1303, in showPlot
self.filesWidget.displayData(plot, id)
File "sasview\src\sas\qtgui\MainWindow\DataExplorer.py", line 1106, in displayData
self.appendOrUpdatePlot(self, plot_to_show, plot_to_append)
File "sasview\src\sas\qtgui\MainWindow\DataExplorer.py", line 1261, in appendOrUpdatePlot
plot.plot(data)
File "sasview\src\sas\qtgui\Plotting\Plotter.py", line 114, in plot
new_sub_plot = Plotter()
File "sasview\src\sas\qtgui\Plotting\Plotter.py", line 1025, in init
PlotterWidget.init(self, parent=None, manager=parent, quickplot=quickplot)
File "sasview\src\sas\qtgui\Plotting\Plotter.py", line 35, in init
super().init(parent, manager=manager, quickplot=quickplot)
File "sasview\src\sas\qtgui\Plotting\PlotterBase.py", line 129, in init
self.upatePlotHelper()
File "sasview\src\sas\qtgui\Plotting\PlotterBase.py", line 233, in upatePlotHelper
self.manager.communicator.activeGraphsSignal.emit([self, False])
AttributeError: 'NoneType' object has no attribute 'communicator'

@lucas-wilkins
Copy link
Contributor

Sounds like one of the Qt6 changes (Signals got refactored).

If you're going to just leave it, add the blocked label.

@lucas-wilkins
Copy link
Contributor

If I recall correctly, you need to make the signal a class variable for it to work.

@krzywon
Copy link
Contributor

krzywon commented Jun 8, 2023

@lucas-wilkins - I added that comment for @gonzalezma and his students on the status of the branch, but now that you mention that, this could be a PyQt -> Pyside difference. The error only started after I merged main into the branch.

@krzywon
Copy link
Contributor

krzywon commented Aug 8, 2023

From @nouhaag on Slack:

Hi everyone. I am writing this post to provide additional details about the issue we are encountering with the plots.
In the plot-residuals branch, we attempted to fix a bug in Jeff's code (268-auto-plot-residuals), which caused an infinite loop. The idea was to introduce a new attribute called "subplot" in the plot method of the PlotterWidget class. However, we are not sure about how we handled this attribute, so we added comments of the type "# FIXME: ILL" to indicate uncertainties.
After making this modification, two different behaviors were observed depending on whether we added the "return" statement in this piece of code or not:

        # TODO: ILL INTERNS : FIX THIS
        if config.GATHER_PLOTS_AND_RESIDUALS and data.plot_role in [DataRole.ROLE_RESIDUAL, DataRole.ROLE_STAND_ALONE, DataRole.ROLE_POLYDISPERSITY] and subplot:
            new_sub_plot = Plotter(self, self.manager.parent)
            # No replot signals should come from the smaller plot
            new_sub_plot.blockSignals(True)
            new_sub_plot.contextMenu.setDisabled(False)
            new_sub_plot.setBaseSize(self.width(), self.height())
            new_sub_plot.plot(data,transform=transform, subplot=False) # FIXME : ILL subplot=False ?
            self.verticalLayout.addWidget(new_sub_plot)
            # FIXME : ILL, return ?
  1. When the "return" statement is added: With each Compute/Plot or Fit action, another subplot of the residuals appears. But to update the residuals, it requires two clicks on Compute/Plot or Fit buttons.
  2. When the "return" statement is not added: The model, data, and residuals are displayed on the same plot, with another subplot of the residuals that remains unchanged. The residuals on the top plot get updated, but it still requires two clicks to achieve that.

So, both cases present some issues with the subplot handling, and we need help to resolve these uncertainties to achieve the desired behavior.

@krzywon
Copy link
Contributor

krzywon commented Mar 12, 2024

This is now available in 6.0.0a1. Closing

@krzywon krzywon closed this as completed Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Feature requests and/or general improvements
Projects
None yet
Development

No branches or pull requests

6 participants