Skip to content

Commit

Permalink
Merge branch 'main' into customFitModels
Browse files Browse the repository at this point in the history
  • Loading branch information
Wojciech Potrzebowski authored Sep 11, 2023
2 parents a111780 + 55b1e9f commit 05f0ba1
Show file tree
Hide file tree
Showing 41 changed files with 995 additions and 776 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

- name: Staple Release Build (OSX)
if: ${{ startsWith(matrix.os, 'macos') }}
uses: devbotsxyz/xcode-staple@v1
uses: BoundfoxStudios/action-xcode-staple@v1
with:
product-path: "installers/dist/SasView-nightly-MacOSX.dmg"

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.TXT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009-2022, SasView Developers
Copyright (c) 2009-2023, SasView Developers


All rights reserved.
Expand Down
11 changes: 6 additions & 5 deletions build_tools/release_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#Should import release notes from git repo, for now will need to cut and paste
sasview_data = {
'metadata': {
'title': 'SasView version 5.0.5',
'description': '5.0.5 release',
'related_identifiers': [{'identifier': 'https://github.com/SasView/sasview/releases/tag/v5.0.5',
'title': 'SasView version 5.0.6',
'description': '5.0.6 release',
'related_identifiers': [{'identifier': 'https://github.com/SasView/sasview/releases/tag/v5.0.6',
'relation': 'isAlternateIdentifier', 'scheme': 'url'}],
'contributors': [
{'name': 'Anuchitanukul, Atijit', 'affiliation': 'STFC - Rutherford Appleton Laboratory', 'type':'Researcher'},
Expand Down Expand Up @@ -49,6 +49,7 @@
{'name': 'Alina, Gervaise','affiliation': 'University of Tennessee Knoxville'},
{'name': 'Attala, Ziggy', 'affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Bakker, Jurrian','affiliation': 'Technical Unviersity Delft'},
{'name': 'Beaucage, Peter','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-2147-0728'},
{'name': 'Bouwman, Wim','affiliation': 'Technical Univeristy Deflt' },
{'name': 'Bourne, Robert', 'affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Butler, Paul','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-5978-4714'},
Expand All @@ -63,7 +64,7 @@
{'name': 'Jackson, Andrew','affiliation': 'European Spallation Source ERIC', 'orcid': '0000-0002-6296-0336'},
{'name': 'King, Stephen','affiliation': 'STFC - Rutherford Appleton Laboratory', 'orcid': '0000-0003-3386-9151'},
{'name': 'Kienzle, Paul','affiliation': 'National Institute of Standards and Technology'},
{'name': 'Krzywon, Jeff','affiliation': 'National Institute of Standards and Technology'},
{'name': 'Krzywon, Jeff','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-2380-4090'},
{'name': 'Maranville, Brian', 'affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-6105-8789'},
{'name': 'Martinez, Nicolas','affiliation': 'Institut Laue-Langevin'},
{'name': 'Murphy, Ryan', 'affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-4080-7525'},
Expand All @@ -76,7 +77,7 @@
{'name': 'Snow, Tim','affiliation': 'Diamond Light Source','orcid': '0000-0001-7146-6885'},
{'name': 'Washington, Adam','affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Wilkins, Lucas','affiliation': 'STFC - Rutherford Appleton Laboratory'},
{'name': 'Wolf, Caitlyn','affiliation': 'National Institute of Standards and Technology'}
{'name': 'Wolf, Caitlyn','affiliation': 'National Institute of Standards and Technology', 'orcid': '0000-0002-2956-7049'}
],
'grants': [{'id': '10.13039/501100000780::654000'}],
'license': 'BSD-3-Clause',
Expand Down
4 changes: 2 additions & 2 deletions build_tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy
scipy==1.7.3
numpy<1.24
scipy==1.10.0
docutils
pytest
pytest_qt
Expand Down
11 changes: 6 additions & 5 deletions docs/sphinx-docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os, collections
import sys, os, datetime

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -69,8 +69,9 @@
master_doc = 'index'

# General information about the project.
project = u'SasView'
copyright = u'2022, The SasView Project'
year = datetime.datetime.now().year
project = 'SasView'
copyright = f'{year}, The SasView Project'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -79,9 +80,9 @@
# The version number must follow StrictVersion rules as outlined
# in http://epydoc.sourceforge.net/stdlib/distutils.version.StrictVersion-class.html
# The short X.Y version.
version = '5.0'
version = '6.0'
# The full version, including e.g. alpha tags (a1).
release = '5.0.5'
release = '6.0.0a1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
12 changes: 10 additions & 2 deletions src/sas/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def parse_cli(argv):
help="Open console to display output (windows only)")
parser.add_argument("-q", "--quiet", action='store_true',
help="Don't print banner when entering interactive mode")
parser.add_argument("-l", "--loglevel", type=str,
help="Logging level (production or development for now)")
parser.add_argument("args", nargs="*",
help="script followed by args")

Expand Down Expand Up @@ -118,12 +120,18 @@ def main(logging="production"):
cli = parse_cli(sys.argv)

# Setup logger and sasmodels
if logging == "production":
if cli.loglevel:
logging = cli.loglevel
logging = logging.upper()
if logging == "PRODUCTION":
log.production()
elif logging == "development":
elif logging == "DEVELOPMENT":
log.development()
elif logging.upper() in {'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'}:
log.setup_logging(logging)
else:
raise ValueError(f"Unknown logging mode \"{logging}\"")

lib.setup_sasmodels()
lib.setup_qt_env() # Note: does not import any gui libraries

Expand Down
3 changes: 1 addition & 2 deletions src/sas/qtgui/Calculators/DensityPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def setupUi(self):
self.ui = Ui_DensityPanel()
self.ui.setupUi(self)

#self.setFixedSize(self.minimumSizeHint())
self.resize(self.minimumSizeHint())
self.setFixedSize(self.minimumSizeHint())

# set validators
#self.ui.editMolecularFormula.setValidator(FormulaValidator(self.ui.editMolecularFormula))
Expand Down
1 change: 1 addition & 0 deletions src/sas/qtgui/Calculators/GenericScatteringCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self, parent=None):
self.setupUi(self)
# disable the context help icon
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
self.setFixedSize(self.minimumSizeHint())

self.manager = parent
self.communicator = self.manager.communicator()
Expand Down
1 change: 1 addition & 0 deletions src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, parent=None):
self.setupUi(self)
# disable the context help icon
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
self.setFixedSize(self.minimumSizeHint())

self.manager = parent

Expand Down
1 change: 1 addition & 0 deletions src/sas/qtgui/Calculators/SldPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def __init__(self, parent=None):
self.setupUi()
# disable the context help icon
self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint)
self.setFixedSize(self.minimumSizeHint())

self.setupModel()
self.setupMapper()
Expand Down
20 changes: 13 additions & 7 deletions src/sas/qtgui/MainWindow/DataExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from sas.qtgui.Plotting.PlotterData import Data1D
from sas.qtgui.Plotting.PlotterData import Data2D
from sas.qtgui.Plotting.PlotterData import DataRole
from sas.qtgui.Plotting.Plotter import Plotter
from sas.qtgui.Plotting.Plotter2D import Plotter2D
from sas.qtgui.Plotting.Plotter import Plotter, PlotterWidget
from sas.qtgui.Plotting.Plotter2D import Plotter2D, Plotter2DWidget
from sas.qtgui.Plotting.MaskEditor import MaskEditor

from sas.qtgui.MainWindow.DataManager import DataManager
Expand Down Expand Up @@ -232,7 +232,7 @@ def loadFolder(self, event=None):
caption = 'Choose a directory'
options = QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog
directory = self.default_load_location
folder = QtWidgets.QFileDialog.getExistingDirectory(parent, caption, directory, "", options)
folder = QtWidgets.QFileDialog.getExistingDirectory(parent, caption, directory, options)

if folder is None:
return
Expand Down Expand Up @@ -1086,11 +1086,17 @@ def displayData(self, data_list, id=None):

plot_name = plot_to_show.name
role = plot_to_show.plot_role
stand_alone_types = [DataRole.ROLE_RESIDUAL, DataRole.ROLE_STAND_ALONE]
stand_alone_types = [DataRole.ROLE_RESIDUAL, DataRole.ROLE_STAND_ALONE, DataRole.ROLE_POLYDISPERSITY]

if (role in stand_alone_types and shown) or role == DataRole.ROLE_DELETABLE:
# Nothing to do if stand-alone plot already shown or plot to be deleted
continue
elif role == DataRole.ROLE_RESIDUAL and config.DISABLE_RESIDUAL_PLOT:
# Nothing to do if residuals are not plotted
continue
elif role == DataRole.ROLE_POLYDISPERSITY and config.DISABLE_POLYDISPERSITY_PLOT:
# Nothing to do if polydispersity plot is not plotted
continue
elif role in stand_alone_types:
# Stand-alone plots should always be separate
self.plotData([(plot_item, plot_to_show)])
Expand Down Expand Up @@ -1132,7 +1138,7 @@ def addDataPlot2D(self, plot_set, item):
"""
Create a new 2D plot and add it to the workspace
"""
plot2D = Plotter2D(self)
plot2D = Plotter2DWidget(parent=self, manager=self)
plot2D.item = item
plot2D.plot(plot_set)
self.addPlot(plot2D)
Expand Down Expand Up @@ -1160,7 +1166,7 @@ def plotData(self, plots, transform=True):
for item, plot_set in plots:
if isinstance(plot_set, Data1D):
if 'new_plot' not in locals():
new_plot = Plotter(self)
new_plot = PlotterWidget(manager=self, parent=self)
new_plot.item = item
new_plot.plot(plot_set, transform=transform)
# active_plots may contain multiple charts
Expand Down Expand Up @@ -1245,7 +1251,7 @@ def appendPlot(self):
@staticmethod
def appendOrUpdatePlot(self, data, plot):
name = data.name
if isinstance(plot, Plotter2D) or name in plot.plot_dict.keys():
if isinstance(plot, Plotter2DWidget) or name in plot.plot_dict.keys():
plot.replacePlot(name, data)
else:
plot.plot(data)
Expand Down
3 changes: 3 additions & 0 deletions src/sas/qtgui/MainWindow/GuiManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def __init__(self, parent=None):
logging.info(f" --- SasView session started, version {SASVIEW_VERSION}, {SASVIEW_RELEASE_DATE} ---")
# Log the python version
logging.info("Python: %s" % sys.version)
#logging.debug("Debug messages are shown.")
#logging.warn("Warnings are shown.")
#logging.error("Errors are shown.")

# Set up the status bar
self.statusBarSetup()
Expand Down
2 changes: 1 addition & 1 deletion src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def plotPolydispersities(model):
data1d.symbol = 'Line'
data1d.name = "{} polydispersity".format(name)
data1d.id = data1d.name # placeholder, has to be completed later
data1d.plot_role = DataRole.ROLE_STAND_ALONE
data1d.plot_role = DataRole.ROLE_POLYDISPERSITY
plots.append(data1d)
return plots

Expand Down
2 changes: 2 additions & 0 deletions src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ def data(self, value):
self.smearing_widget.resetSmearer()
# Enable/disable UI components
self.setEnablementOnDataLoad()
# Reinitialize model list for constrained/simult fitting
self.newModelSignal.emit()

def initializeGlobals(self):
"""
Expand Down
21 changes: 20 additions & 1 deletion src/sas/qtgui/Plotting/Plotter2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
from sas.qtgui.Plotting.BoxSum import BoxSum
from sas.qtgui.Plotting.SlicerParameters import SlicerParameters

# TODO: move to sas.qtgui namespace
from sas.qtgui.Plotting.Slicers.BoxSlicer import BoxInteractorX
from sas.qtgui.Plotting.Slicers.BoxSlicer import BoxInteractorY
from sas.qtgui.Plotting.Slicers.WedgeSlicer import WedgeInteractorQ
from sas.qtgui.Plotting.Slicers.WedgeSlicer import WedgeInteractorPhi
from sas.qtgui.Plotting.Slicers.AnnulusSlicer import AnnulusInteractor
from sas.qtgui.Plotting.Slicers.SectorSlicer import SectorInteractor
from sas.qtgui.Plotting.Slicers.BoxSum import BoxSumCalculator
Expand Down Expand Up @@ -189,6 +190,10 @@ def createContextMenu(self):
self.actionBoxAveragingX.triggered.connect(self.onBoxAveragingX)
self.actionBoxAveragingY = self.contextMenu.addAction("&Box Averaging in Qy")
self.actionBoxAveragingY.triggered.connect(self.onBoxAveragingY)
self.actionWedgeAveragingQ = self.contextMenu.addAction("&Wedge Averaging in Q")
self.actionWedgeAveragingQ.triggered.connect(self.onWedgeAveragingQ)
self.actionWedgeAveragingPhi = self.contextMenu.addAction("&Wedge Averaging in Phi")
self.actionWedgeAveragingPhi.triggered.connect(self.onWedgeAveragingPhi)
# Additional items for slicer interaction
if self.slicer:
self.actionClearSlicer = self.contextMenu.addAction("&Clear Slicer")
Expand Down Expand Up @@ -456,6 +461,20 @@ def onBoxAveragingY(self):
"""
self.setSlicer(slicer=BoxInteractorY)

def onWedgeAveragingQ(self):
"""
Perform 2D data averaging on Q
Create a new slicer .
"""
self.setSlicer(slicer=WedgeInteractorQ)

def onWedgeAveragingPhi(self):
"""
Perform 2D data averaging on Phi
Create a new slicer .
"""
self.setSlicer(slicer=WedgeInteractorPhi)

def onColorMap(self):
"""
Display the color map dialog and modify the plot's map accordingly
Expand Down
2 changes: 2 additions & 0 deletions src/sas/qtgui/Plotting/PlotterData.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class DataRole(Enum):
ROLE_RESIDUAL = 3
# Stand alone is for plots that should be plotted separately
ROLE_STAND_ALONE = 4
# Polydispersity is for stand-alone polydispersity plot
ROLE_POLYDISPERSITY = 5


class Data1D(PlottableData1D, LoadData1D):
Expand Down
8 changes: 6 additions & 2 deletions src/sas/qtgui/Plotting/SlicerParameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
from sas.qtgui.Plotting.PlotterData import Data1D
from sas.qtgui.Plotting.Slicers.BoxSlicer import BoxInteractorX
from sas.qtgui.Plotting.Slicers.BoxSlicer import BoxInteractorY
from sas.qtgui.Plotting.Slicers.WedgeSlicer import WedgeInteractorQ
from sas.qtgui.Plotting.Slicers.WedgeSlicer import WedgeInteractorPhi
from sas.qtgui.Plotting.Slicers.AnnulusSlicer import AnnulusInteractor
from sas.qtgui.Plotting.Slicers.SectorSlicer import SectorInteractor

Expand Down Expand Up @@ -56,7 +58,9 @@ def __init__(self, parent=None,
1: SectorInteractor,
2: AnnulusInteractor,
3: BoxInteractorX,
4: BoxInteractorY}
4: BoxInteractorY,
5: WedgeInteractorQ,
6: WedgeInteractorPhi}

# Define a proxy model so cell enablement can be finegrained.
self.proxy = ProxyModel(self)
Expand Down Expand Up @@ -216,7 +220,7 @@ def onChooseFilesLocation(self):
caption = 'Save files to:'
options = QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog
directory = self.save_location
folder = QtWidgets.QFileDialog.getExistingDirectory(parent, caption, directory, "", options)
folder = QtWidgets.QFileDialog.getExistingDirectory(parent, caption, directory, options)

if folder is None:
return
Expand Down
Loading

0 comments on commit 05f0ba1

Please sign in to comment.