-
Notifications
You must be signed in to change notification settings - Fork 49
Sending data to fitting automatically plots the data (#2299) #2315
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
Draft
pbeaucage
wants to merge
12
commits into
main
Choose a base branch
from
2299-sending-single-data-to-fitting-should-automatically-open-the-data-chart
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3ea397c
WIP Add on-send-to-fitting plot
pbeaucage 6881844
Add auto-plot option and a flag to disable it
pbeaucage ba7e164
Merge branch 'main' into 2299-sending-single-data-to-fitting-should-a…
pbeaucage 0d747ab
Add basic preferences widget for auto-plot
pbeaucage 56d703b
Small essentially typo fixes in fitting preferences widget
pbeaucage f31f226
Add flag for experimental data and gate plotting on it
pbeaucage e368382
Merge branch '2327-certain-data-files-open-an-extra-plot-when-loaded-…
pbeaucage 0b9189d
Remove flag and replace with plot data
pbeaucage 466bdb7
Merge branch '2327-certain-data-files-open-an-extra-plot-when-loaded-…
pbeaucage 3b2b4ed
Auto-plot on submit option
pbeaucage 2c9e18c
Switch to backend which quickly sets up a model.
pbeaucage 7499b79
re-add timing things
pbeaucage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,12 @@ | |
|
|
||
| from sas.qtgui.Utilities.Reports.reportdata import ReportData | ||
|
|
||
| from sas import config | ||
| import time | ||
|
|
||
| import logging | ||
| logger = logging.getLogger(__name__) | ||
|
|
||
| class FittingWindow(QtWidgets.QTabWidget, Perspective): | ||
| """ | ||
| """ | ||
|
|
@@ -263,9 +269,27 @@ def addFit(self, data, is_batch=False, tab_index=None): | |
| self.addTab(tab, icon, tab_name) | ||
| # Show the new tab | ||
| self.setCurrentWidget(tab) | ||
| # If configured, plot the current data | ||
| self.maybePlotOnLoad(tab) | ||
|
|
||
| # Notify listeners | ||
| self.tabsModifiedSignal.emit() | ||
|
|
||
| def maybePlotOnLoad(self,tab): | ||
| if tab.data_is_loaded and config.FITTING_PLOT_ON_SEND_DATA: | ||
| #First, create model and residuals inside this data. | ||
| def tidyup(self): | ||
| logger.info(msg='calculation complete, running tidy-up function') | ||
| #time.sleep(2) | ||
| #tab.onPlot() | ||
| #QtWidgets.QApplication.processEvents() | ||
| tab.showPlot() | ||
| #QtWidgets.QApplication.processEvents() | ||
| #time.sleep(2) | ||
| tab._model_model.clear() | ||
| tab.cmdPlot.setEnabled(False) | ||
| tab.SASModelToQModel('porod') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you choose "porod" here, and not the currently active model? |
||
| tab.calculateQGridForModelExt(completefn= tidyup) | ||
| def addConstraintTab(self): | ||
| """ | ||
| Add a new C&S fitting tab | ||
|
|
@@ -431,6 +455,7 @@ def setData(self, data_item=None, is_batch=False, tab_index=None): | |
| self.tabs[first_good_tab].data = data | ||
| tab_name = str(self.tabText(first_good_tab)) | ||
| self.updateFitDict(data, tab_name) | ||
| self.maybePlotOnLoad(self.tabs[first_good_tab]) | ||
| else: | ||
| self.addFit(data, is_batch=is_batch) | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/sas/qtgui/Utilities/Preferences/FittingPreferencesWidget.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from sas.system import config | ||
|
|
||
| from .PreferencesWidget import PreferencesWidget, config_value_setter_generator | ||
|
|
||
|
|
||
| class FittingPreferencesWidget(PreferencesWidget): | ||
| def __init__(self): | ||
| super(FittingPreferencesWidget, self).__init__("Fitting Settings") | ||
| self.addCheckBox(title="Auto-plot data when sent to fitting perspective", | ||
| callback=config_value_setter_generator('FITTING_PLOT_ON_SEND_DATA', dtype=bool), | ||
| checked=config.FITTING_PLOT_ON_SEND_DATA) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this needs porting to the new way of describing preferences |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playing with
processEventsmeans there were issues with plot lifetimes? What did you observe?