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

[Release 5.0.6] Master 5.0.6 release PR #2407

Merged
merged 39 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1f88ae6
Add id to the generated plot. #2098
rozyczko Jun 20, 2022
a9d79e3
Add persistent legend visibility toggle
pbeaucage Oct 25, 2022
811a10f
Change visibility, don't block re-creation.
pbeaucage Oct 25, 2022
159e876
Change plotting to use data.name rather than data.title
pbeaucage Oct 27, 2022
01886dd
DIfferentiate which combobox to put the graphs in.
rozyczko Oct 27, 2022
0abdf55
Remove calls to pyplot.cla()
pbeaucage Oct 27, 2022
2544817
Remove commented out calls
pbeaucage Oct 27, 2022
3c07742
Add flag for experimental data and gate plotting on it
pbeaucage Oct 29, 2022
b515fd7
Remove flag and replace with plot data
pbeaucage Oct 29, 2022
9fd8fed
remove unneeded isExpData flag
pbeaucage Oct 29, 2022
f03c338
Fix plot legend not updating on custom change. #2361
rozyczko Oct 31, 2022
265ee38
Merge branch 'release_5.0.6' into release_5.0.6_plotting_fixes
Dec 20, 2022
9e1eed0
Force maximize and be careful about the order of instantiation, so the
rozyczko Oct 25, 2022
5129367
Set min width on squishable elements
rozyczko Oct 27, 2022
28f6051
fix references to 'config'
rozyczko Dec 22, 2022
b050585
Close the bumps convergence (results) panel when data is deleted
krzywon Nov 1, 2022
ac00a94
Pass data object to result panel to limit imports
krzywon Nov 1, 2022
60206ec
Change dataDeleted to onDataDeleted for semantic reasons, and remove …
krzywon Nov 2, 2022
340459b
Fix for plotting not updating
lucas-wilkins Oct 28, 2022
1126ac8
Fix for plotting not updating
lucas-wilkins Oct 28, 2022
2d1ca12
Fixed bug in smearing implementation of sesans data that was passing …
caitwolf Oct 29, 2022
eb213fe
minor text changes in comment for clarity
caitwolf Oct 29, 2022
c42a7df
fixed bug that was swtiching the Use dQ Data slit length and width
caitwolf Oct 30, 2022
e7adcde
fixed sesans residuals plots to show in real space rather than q space
caitwolf Oct 30, 2022
4434dc6
Reverting read-only for Qmin and Qmax in invariant params
Nov 1, 2022
1f5fe74
Merge branch 'release_5.0.6' into release_5.0.6_plotting_fixes
Jan 19, 2023
b8548f7
removes error bars, previously set to one, from normalized residuals
drowssap61 May 21, 2021
dfd0208
up default points on slicer and fix a few related slicer bugs
butlerpd Oct 30, 2022
2e79d6b
Change polydispersity plot to linear linear
butlerpd Oct 31, 2022
557acbf
Enable plot redraw on linear/log scale change
rozyczko Oct 31, 2022
1b1e80c
Change defaults for theory plot.
butlerpd Oct 31, 2022
f75521b
Fix issue with residual y scaling called twice. Keep it in the residu…
butlerpd Oct 31, 2022
e8f6431
Cleaned up incorrect comment lines after review
butlerpd Oct 31, 2022
a86a3ed
Merge branch 'release_5.0.6_plotting_fixes' of https://github.com/Sas…
butlerpd Jan 23, 2023
13f19cb
A few more or less obvious fixes for speed of SasView startup
rozyczko Oct 25, 2022
49a1c36
optimize imports in the inversion calculator
rozyczko Oct 26, 2022
cec6701
Clip fitting values set outside the fit range
krzywon Jan 18, 2023
405f51e
Fix incorrect escape sequences
llimeht Sep 25, 2022
099067d
Merge branch 'release_5.0.6' into release_5.0.6_plotting_fixes
krzywon Jan 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/sas/logger_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def config_production(self):
logging.captureWarnings(True)
logger = logging.getLogger(self.name)
logging.getLogger('matplotlib').setLevel(logging.WARN)
logging.getLogger('numba').setLevel(logging.WARN)
return logger

def config_development(self):
Expand All @@ -42,6 +43,7 @@ def config_development(self):
logging.captureWarnings(True)
self._disable_debug_from_config()
logging.getLogger('matplotlib').setLevel(logging.WARN)
logging.getLogger('numba').setLevel(logging.WARN)
return logger

def _disable_debug_from_config(self):
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def onPrepareOutputData(self):
""" Prepare datasets to be added to DataExplorer and DataManager """
name = self.txtOutputData.text()
self.output.name = name
self.output.id = name + str(time.time())
new_item = GuiUtils.createModelItemWithPlot(
self.output,
name=name)
Expand Down Expand Up @@ -410,7 +411,6 @@ def updatePlot(self, graph, layout, data):
# plot 2D data
plotter2D = Plotter2DWidget(self, quickplot=True)
plotter2D.scale = 'linear'

plotter2D.ax.tick_params(axis='x', labelsize=8)
plotter2D.ax.tick_params(axis='y', labelsize=8)

Expand Down
30 changes: 27 additions & 3 deletions src/sas/qtgui/Calculators/UI/SldPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<height>446</height>
<width>552</width>
<height>495</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -308,10 +308,16 @@
</item>
<item row="4" column="0">
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>466</width>
<height>32</height>
<height>50</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
Expand All @@ -320,6 +326,12 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>Recalculate</string>
</property>
Expand All @@ -340,13 +352,25 @@
</item>
<item row="0" column="2">
<widget class="QPushButton" name="closeButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="helpButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>Help</string>
</property>
Expand Down
42 changes: 32 additions & 10 deletions src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def __init__(self, parent=None, guimanager=None, manager=None):
self.cbgraph.editTextChanged.connect(self.enableGraphCombo)
self.cbgraph.currentIndexChanged.connect(self.enableGraphCombo)

self.cbgraph_2.editTextChanged.connect(self.enableGraphCombo)
self.cbgraph_2.currentIndexChanged.connect(self.enableGraphCombo)

# Proxy model for showing a subset of Data1D/Data2D content
self.data_proxy = QtCore.QSortFilterProxyModel(self)
self.data_proxy.setSourceModel(self.model)
Expand Down Expand Up @@ -696,6 +699,10 @@ def deleteFile(self, event):

# Delete corresponding open plots
self.closePlotsForItem(item)
# Close result panel if results represent the deleted data item
# Results panel only stores Data1D/Data2D object
# => QStandardItems must still exist for direct comparison
self.closeResultPanelOnDelete(GuiUtils.dataFromItem(item))

self.model.removeRow(ind)
# Decrement index since we just deleted it
Expand Down Expand Up @@ -940,9 +947,12 @@ def updatePlotName(self, name_tuple):
Modify the name of the current plot
"""
old_name, current_name = name_tuple
ind = self.cbgraph.findText(old_name)
self.cbgraph.setCurrentIndex(ind)
self.cbgraph.setItemText(ind, current_name)
graph = self.cbgraph
if self.current_view == self.freezeView:
graph = self.cbgraph_2
ind = graph.findText(old_name)
graph.setCurrentIndex(ind)
graph.setItemText(ind, current_name)

def add_data(self, data_list):
"""
Expand Down Expand Up @@ -972,12 +982,15 @@ def updateGraphCombo(self, graph_list):
"""
Modify Graph combo box on graph add/delete
"""
orig_text = self.cbgraph.currentText()
self.cbgraph.clear()
self.cbgraph.insertItems(0, graph_list)
ind = self.cbgraph.findText(orig_text)
graph = self.cbgraph
if self.current_view == self.freezeView:
graph = self.cbgraph_2
orig_text = graph.currentText()
graph.clear()
graph.insertItems(0, graph_list)
ind = graph.findText(orig_text)
if ind > 0:
self.cbgraph.setCurrentIndex(ind)
graph.setCurrentIndex(ind)

def updatePerspectiveCombo(self, index):
"""
Expand Down Expand Up @@ -1207,11 +1220,13 @@ def appendPlot(self):
# new plot data; check which tab is currently active
if self.current_view == self.treeView:
new_plots = GuiUtils.plotsFromCheckedItems(self.model)
graph = self.cbgraph
else:
new_plots = GuiUtils.plotsFromCheckedItems(self.theory_model)
graph = self.cbgraph_2

# old plot data
plot_id = str(self.cbgraph.currentText())
plot_id = str(graph.currentText())
try:
assert plot_id in PlotHelper.currentPlots(), "No such plot: %s" % (plot_id)
except:
Expand Down Expand Up @@ -1883,7 +1898,14 @@ def closePlotsForItem(self, item):

pass # debugger anchor

def onAnalysisUpdate(self, new_perspective=""):
def closeResultPanelOnDelete(self, data):
"""
Given a data1d/2d object, close the fitting results panel if currently populated with the data
"""
# data - Single data1d/2d object to be deleted
self.parent.results_panel.onDataDeleted(data)

def onAnalysisUpdate(self, new_perspective_name: str):
"""
Update the perspective combo index based on passed string
"""
Expand Down
26 changes: 12 additions & 14 deletions src/sas/qtgui/MainWindow/GuiManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,31 @@ def addWidgets(self):
"""
Populate the main window with widgets
"""
# Add the console window as another docked widget
self.logDockWidget = QDockWidget("Log Explorer", self._workspace)
self.logDockWidget.setObjectName("LogDockWidget")
self.logDockWidget.visibilityChanged.connect(self.updateLogContextMenus)


self.listWidget = QTextBrowser()
self.logDockWidget.setWidget(self.listWidget)
self._workspace.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget)

# Preload all perspectives
self.loadAllPerspectives()

# Add FileDialog widget as docked
self.filesWidget = DataExplorerWindow(self._parent, self, manager=self._data_manager)
ObjectLibrary.addObject('DataExplorer', self.filesWidget)

self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace)
self.dockedFilesWidget.setFloating(False)
self.dockedFilesWidget.setWidget(self.filesWidget)

# Modify menu items on widget visibility change
self.dockedFilesWidget.visibilityChanged.connect(self.updateContextMenus)

self._workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget)
self._workspace.resizeDocks([self.dockedFilesWidget], [305], Qt.Horizontal)

# Add the console window as another docked widget
self.logDockWidget = QDockWidget("Log Explorer", self._workspace)
self.logDockWidget.setObjectName("LogDockWidget")
self.logDockWidget.visibilityChanged.connect(self.updateLogContextMenus)


self.listWidget = QTextBrowser()
self.logDockWidget.setWidget(self.listWidget)
self._workspace.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget)

# Add other, minor widgets
self.ackWidget = Acknowledgements()
self.aboutWidget = AboutBox()
Expand All @@ -168,8 +166,8 @@ def addWidgets(self):
self.results_frame.setVisible(False)
self.results_panel.windowClosedSignal.connect(lambda: self.results_frame.setVisible(False))

self._workspace.toolBar.setVisible(LocalConfig.TOOLBAR_SHOW)
self._workspace.actionHide_Toolbar.setText("Show Toolbar")
custom_config = get_custom_config()
self._workspace.toolBar.setVisible(custom_config.TOOLBAR_SHOW)

# Add calculators - floating for usability
self.SLDCalculator = SldPanel(self)
Expand Down
5 changes: 2 additions & 3 deletions src/sas/qtgui/MainWindow/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from PyQt5.QtWidgets import QSplashScreen
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPixmap
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, QTimer

# Local UI
from sas.qtgui.UI import main_resources_rc
Expand All @@ -35,7 +35,7 @@ def __init__(self, screen_resolution, parent=None):
self.screen_width = screen_resolution.width()
self.screen_height = screen_resolution.height()
self.setCentralWidget(self.workspace)

QTimer.singleShot(100, self.showMaximized)
# Temporary solution for problem with menubar on Mac
if sys.platform == "darwin": # Mac
self.menubar.setNativeMenuBar(False)
Expand Down Expand Up @@ -110,7 +110,6 @@ def run_sasview():

# Show the main SV window
mainwindow = MainSasViewWindow(screen_resolution)
mainwindow.showMaximized()

# no more splash screen
splash.finish(mainwindow)
Expand Down
13 changes: 9 additions & 4 deletions src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,13 +542,17 @@ def residualsData1D(reference_data, current_data, weights):
pass

residuals.x = current_data.x[index][0]
residuals.dy = numpy.ones(len(residuals.y))
residuals.dy = None
residuals.dx = None
residuals.dxl = None
residuals.dxw = None
residuals.ytransform = 'y'
if reference_data.isSesans:
residuals.xtransform = 'x'
residuals.xaxis('\\rm{z} ', 'A')
# For latter scale changes
residuals.xaxis('\\rm{Q} ', 'A^{-1}')
else:
residuals.xaxis('\\rm{Q} ', 'A^{-1}')
residuals.yaxis('\\rm{Residuals} ', 'normalized')

return residuals
Expand All @@ -572,7 +576,7 @@ def residualsData2D(reference_data, current_data, weight):
residuals.qx_data = current_data.qx_data
residuals.qy_data = current_data.qy_data
residuals.q_data = current_data.q_data
residuals.err_data = numpy.ones(len(residuals.data))
residuals.err_data = None
residuals.xmin = min(residuals.qx_data)
residuals.xmax = max(residuals.qx_data)
residuals.ymin = min(residuals.qy_data)
Expand Down Expand Up @@ -604,7 +608,6 @@ def plotResiduals(reference_data, current_data, weights):
res_name = reference_data.name if reference_data.name else reference_data.filename
residuals.name = "Residuals for " + str(theory_name) + "[" + res_name + "]"
residuals.title = residuals.name
residuals.ytransform = 'y'

# when 2 data have the same id override the 1 st plotted
# include the last part if keeping charts for separate models is required
Expand Down Expand Up @@ -632,6 +635,8 @@ def plotPolydispersities(model):
# similar to FittingLogic._create1DPlot() but different data/axes
data1d = Data1D(x=xarr, y=yarr)
xunit = model.details[name][0]
data1d.xtransform = 'x'
data1d.ytransform = 'y'
data1d.xaxis(r'\rm{{{}}}'.format(name.replace('_', '\_')), xunit)
data1d.yaxis(r'\rm{probability}', 'normalized')
data1d.scale = 'linear'
Expand Down
16 changes: 11 additions & 5 deletions src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,10 @@ def initializeGlobals(self):
self.q_range_min = OptionsWidget.QMIN_DEFAULT
self.q_range_max = OptionsWidget.QMAX_DEFAULT
self.npts = OptionsWidget.NPTS_DEFAULT
self.log_points = False
self.log_points = True
self.weighting = 0
self.chi2 = None

# Does the control support UNDO/REDO
# temporarily off
self.undo_supported = False
Expand Down Expand Up @@ -330,6 +331,7 @@ def initializeWidgets(self):
self.options_widget = OptionsWidget(self, self.logic)
layout.addWidget(self.options_widget)
self.tabOptions.setLayout(layout)
self.options_widget.setLogScale(self.log_points)

# Smearing widget
layout = QtWidgets.QGridLayout()
Expand Down Expand Up @@ -1805,6 +1807,9 @@ def paramDictFromResults(self, results):
logger.error(msg)
return

if results.mesg:
logger.warning(results.mesg)

param_list = results.param_list # ['radius', 'radius.width']
param_values = results.pvec # array([ 0.36221662, 0.0146783 ])
param_stderr = results.stderr # array([ 1.71293015, 1.71294233])
Expand Down Expand Up @@ -1879,7 +1884,7 @@ def prepareFitters(self, fitter=None, fit_id=0):

# Data going in
data = self.logic.data
model = copy.deepcopy(self.kernel_module)
model = self.kernel_module
qmin = self.q_range_min
qmax = self.q_range_max

Expand Down Expand Up @@ -2237,7 +2242,7 @@ def _requestPlots(self, item_name, item_model):
data_shown = False
item = None
for item, plot in plots.items():
if fitpage_name in plot.name:
if plot.plot_role != Data1D.ROLE_DATA and fitpage_name in plot.name:
data_shown = True
self.communicate.plotRequestedSignal.emit([item, plot], self.tab_id)
# return the last data item seen, if nothing was plotted; supposed to be just data)
Expand All @@ -2252,6 +2257,7 @@ def onOptionsUpdate(self):
# set Q range labels on the main tab
self.lblMinRangeDef.setText(GuiUtils.formatNumber(self.q_range_min, high=True))
self.lblMaxRangeDef.setText(GuiUtils.formatNumber(self.q_range_max, high=True))
self.recalculatePlotData()

def setDefaultStructureCombo(self):
"""
Expand Down Expand Up @@ -4207,12 +4213,12 @@ def updatePageWithParameters(self, line_dict, warn_user=True):
pass
if 'smearing_min' in line_dict.keys():
try:
self.smearing_widget.dq_l = float(line_dict['smearing_min'][0])
self.smearing_widget.dq_r = float(line_dict['smearing_min'][0])
except ValueError:
pass
if 'smearing_max' in line_dict.keys():
try:
self.smearing_widget.dq_r = float(line_dict['smearing_max'][0])
self.smearing_widget.dq_l = float(line_dict['smearing_max'][0])
except ValueError:
pass

Expand Down
Loading