NeXpy 2.0.0b7__tar.gz → 2.0.0b9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/PKG-INFO +1 -1
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/PKG-INFO +1 -1
- nexpy-2.0.0b9/src/nexpy/_version.py +34 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/consoleapp.py +1 -4
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/dialogs.py +97 -141
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/fitdialogs.py +84 -74
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/mainwindow.py +2 -17
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/plotview.py +3 -1
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/treeview.py +0 -3
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/widgets.py +9 -0
- nexpy-2.0.0b7/src/nexpy/_version.py +0 -21
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/.gitattributes +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/.github/dependabot.yaml +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/.github/workflows/ci.yml +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/.gitignore +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/COPYING +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/README.md +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/README.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/conda-recipe/bld.bat +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/conda-recipe/build.sh +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/conda-recipe/meta.yaml +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/Makefile +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/make.bat +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/_static/__ignore__.txt +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/conf.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/examples.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/favicon.ico +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/axis-limits-bar.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/customize-panel.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/limits-panel.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/nexpy-fits.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/nexpy-gui.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/nexpy-logo.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/options-tab.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/projection-panel.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/projection-tab.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/scan-panel.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/signal-tab.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/simple-plot.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/skewed-axis.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/x-tab.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/y-tab.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/z-tab.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/images/z-toolbar.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/includeme.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/index.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/pythongui.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/pythonshell.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/readers.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/doc/source/treeapi.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/pyproject.toml +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/setup.cfg +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/SOURCES.txt +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/dependency_links.txt +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/entry_points.txt +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/pbr.json +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/requires.txt +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/NeXpy.egg-info/top_level.txt +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/__init__.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/README.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/chopper.nxs +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/example.nxs +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/README.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/pyproject.toml +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/scripts/README.rst +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/scripts/chopper_plot.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/scripts/example.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/__init__.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/datadialogs.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/importdialog.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/pyqt.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/NeXpy.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/NeXpy.svg +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/back.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/backward-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/customize.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/equal.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/export-data.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/export-figure.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/filesave.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/forward-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/forward.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/hand.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/home.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/link-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/lock-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/lock-red-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/modify-style.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/move.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/pause-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/refresh-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/unlock-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/unlock-red-icon.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/resources/zoom_to_rect.png +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/scripteditor.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/gui/utils.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/models/bose.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/models/critexp.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/models/op.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/models/pdfdecay.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/nexpygui.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/readers/readnpy.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/readers/readspec.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/readers/readstack.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/readers/readtiff.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/readers/readtxt.py +0 -0
- {nexpy-2.0.0b7 → nexpy-2.0.0b9}/tests/test_imports.py +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '2.0.0b9'
|
|
32
|
+
__version_tuple__ = version_tuple = (2, 0, 0, 'b9')
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'g71f89ff3a'
|
|
@@ -195,10 +195,7 @@ class NXConsoleApp(JupyterQtConsoleApp):
|
|
|
195
195
|
self.app.setApplicationName('nexpy')
|
|
196
196
|
sys.excepthook = report_exception
|
|
197
197
|
try:
|
|
198
|
-
|
|
199
|
-
self.app.icon = resource_icon('NeXpy.svg')
|
|
200
|
-
else:
|
|
201
|
-
self.app.icon = resource_icon('NeXpy.png')
|
|
198
|
+
self.app.icon = resource_icon('NeXpy.png')
|
|
202
199
|
QtWidgets.QApplication.setWindowIcon(self.app.icon)
|
|
203
200
|
self.icon_pixmap = QtGui.QPixmap(
|
|
204
201
|
self.app.icon.pixmap(QtCore.QSize(64, 64)))
|
|
@@ -3920,7 +3920,6 @@ class ViewTab(NXTab):
|
|
|
3920
3920
|
|
|
3921
3921
|
layout = QtWidgets.QVBoxLayout()
|
|
3922
3922
|
self.properties = GridParameters()
|
|
3923
|
-
|
|
3924
3923
|
self.properties.add('class', node.__class__.__name__, 'Class',
|
|
3925
3924
|
readonly=True)
|
|
3926
3925
|
self.properties.add('name', node.nxname, 'Name', readonly=True)
|
|
@@ -4001,21 +4000,84 @@ class ViewTab(NXTab):
|
|
|
4001
4000
|
title='Attributes',
|
|
4002
4001
|
width=200))
|
|
4003
4002
|
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4003
|
+
self.scroll_area = None
|
|
4004
|
+
|
|
4005
|
+
if isinstance(node, NXgroup):
|
|
4006
|
+
self.group = node
|
|
4007
|
+
field_list = [f for f in self.group.NXfield
|
|
4008
|
+
if f.ndim == 0 or (f.ndim == 1 and f.shape[0] == 1)]
|
|
4009
|
+
if len(field_list) > 0:
|
|
4010
|
+
layout.addWidget(NXLabel('Scalar Fields', bold=True,
|
|
4011
|
+
align='center'))
|
|
4012
|
+
self.grid = QtWidgets.QGridLayout()
|
|
4013
|
+
row = 0
|
|
4014
|
+
grid_height = 0
|
|
4015
|
+
for field in field_list:
|
|
4016
|
+
self.grid.addWidget(NXLabel(field.nxname), row, 0,
|
|
4017
|
+
QtCore.Qt.AlignTop)
|
|
4018
|
+
if field.is_string():
|
|
4019
|
+
field_box = NXTextEdit(field.nxvalue, autosize=True)
|
|
4020
|
+
grid_height += field_box.document().size().height()
|
|
4021
|
+
self.grid.addWidget(field_box, row, 1,
|
|
4022
|
+
QtCore.Qt.AlignTop)
|
|
4023
|
+
else:
|
|
4024
|
+
field_box = NXTextEdit(field.nxvalue, align='right',
|
|
4025
|
+
autosize=True)
|
|
4026
|
+
grid_height += field_box.document().size().height()
|
|
4027
|
+
self.grid.addWidget(field_box, row, 1)
|
|
4028
|
+
self.grid.addWidget(NXLabel(field.nxunits), row, 2)
|
|
4029
|
+
row += 1
|
|
4030
|
+
self.grid.setContentsMargins(10, 0, 40, 10)
|
|
4031
|
+
self.grid.setSpacing(5)
|
|
4032
|
+
self.grid.setColumnStretch(1, 1)
|
|
4033
|
+
group_widget = NXWidget()
|
|
4034
|
+
group_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
|
|
4035
|
+
QtWidgets.QSizePolicy.Expanding)
|
|
4036
|
+
grid_container = NXWidget()
|
|
4037
|
+
grid_container.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
|
|
4038
|
+
QtWidgets.QSizePolicy.Expanding)
|
|
4039
|
+
grid_container.setLayout(self.grid)
|
|
4040
|
+
if grid_height > 400:
|
|
4041
|
+
grid_container = NXWidget()
|
|
4042
|
+
grid_container.setLayout(self.grid)
|
|
4043
|
+
self.scroll_area = NXScrollArea(grid_container, height=600)
|
|
4044
|
+
self.scroll_area.setMinimumHeight(400)
|
|
4045
|
+
grid_layout = QtWidgets.QVBoxLayout()
|
|
4046
|
+
grid_layout.addWidget(self.scroll_area)
|
|
4047
|
+
group_widget.setLayout(grid_layout)
|
|
4048
|
+
else:
|
|
4049
|
+
group_widget.setLayout(self.grid)
|
|
4050
|
+
layout.addWidget(group_widget)
|
|
4051
|
+
self.save_button = NXPushButton('Save', self.save_scalar_fields)
|
|
4052
|
+
layout.addWidget(self.save_button,
|
|
4053
|
+
alignment=QtCore.Qt.AlignCenter)
|
|
4054
|
+
self.setLayout(layout)
|
|
4055
|
+
else:
|
|
4056
|
+
self.group = None
|
|
4057
|
+
hlayout = QtWidgets.QHBoxLayout()
|
|
4058
|
+
hlayout.addStretch()
|
|
4059
|
+
hlayout.addLayout(layout)
|
|
4060
|
+
if (isinstance(node, NXfield) and node.shape is not None and
|
|
4061
|
+
node.shape != () and node.shape != (1,)):
|
|
4062
|
+
try:
|
|
4063
|
+
table = self.table()
|
|
4064
|
+
hlayout.addLayout(table)
|
|
4065
|
+
except OSError:
|
|
4066
|
+
pass
|
|
4067
|
+
hlayout.addStretch()
|
|
4068
|
+
self.setLayout(hlayout)
|
|
4016
4069
|
|
|
4017
4070
|
self.setWindowTitle(node.nxroot.nxname+node.nxpath)
|
|
4018
4071
|
|
|
4072
|
+
def resize(self):
|
|
4073
|
+
"""Update the size of the scroll area and its contents."""
|
|
4074
|
+
super().resize()
|
|
4075
|
+
if self.scroll_area is not None:
|
|
4076
|
+
self.scroll_area.widget().updateGeometry()
|
|
4077
|
+
self.scroll_area.updateGeometry()
|
|
4078
|
+
self.scroll_area.widget().adjustSize()
|
|
4079
|
+
self.scroll_area.adjustSize()
|
|
4080
|
+
|
|
4019
4081
|
def table(self):
|
|
4020
4082
|
"""
|
|
4021
4083
|
Create a table view for displaying the data in a NeXus field.
|
|
@@ -4099,6 +4161,28 @@ class ViewTab(NXTab):
|
|
|
4099
4161
|
hheight = self.table_view.horizontalHeader().height()
|
|
4100
4162
|
self.table_view.setFixedHeight(vheight + hheight)
|
|
4101
4163
|
|
|
4164
|
+
def save_scalar_fields(self):
|
|
4165
|
+
if not self.group.is_modifiable():
|
|
4166
|
+
self.display_message('Group is read-only')
|
|
4167
|
+
return
|
|
4168
|
+
row = 1
|
|
4169
|
+
for row in range(1, self.grid.rowCount()):
|
|
4170
|
+
field_name = self.grid.itemAtPosition(row, 0).widget().text()
|
|
4171
|
+
field = self.group[field_name]
|
|
4172
|
+
if field.is_string():
|
|
4173
|
+
value = self.grid.itemAtPosition(row, 1).widget().toPlainText()
|
|
4174
|
+
if field.nxvalue != value.rstrip():
|
|
4175
|
+
field.nxdata = value.rstrip()
|
|
4176
|
+
else:
|
|
4177
|
+
value = self.grid.itemAtPosition(row, 1).widget().toPlainText()
|
|
4178
|
+
try:
|
|
4179
|
+
value = field.dtype.type(value)
|
|
4180
|
+
except ValueError:
|
|
4181
|
+
self.display_message(f'Invalid value for {field.nxname}')
|
|
4182
|
+
return
|
|
4183
|
+
if not np.isclose(field.nxvalue, value):
|
|
4184
|
+
field.nxdata = value
|
|
4185
|
+
|
|
4102
4186
|
|
|
4103
4187
|
class ViewTableModel(QtCore.QAbstractTableModel):
|
|
4104
4188
|
|
|
@@ -4494,134 +4578,6 @@ class ValidateTab(NXTab):
|
|
|
4494
4578
|
self.activateWindow()
|
|
4495
4579
|
|
|
4496
4580
|
|
|
4497
|
-
class EditDialog(NXPanel):
|
|
4498
|
-
|
|
4499
|
-
def __init__(self, parent=None):
|
|
4500
|
-
"""Initialize the Edit Panel.
|
|
4501
|
-
|
|
4502
|
-
Parameters
|
|
4503
|
-
----------
|
|
4504
|
-
parent : QWidget, optional
|
|
4505
|
-
The parent of the dialog. The default is None.
|
|
4506
|
-
"""
|
|
4507
|
-
super().__init__('Edit', title='Edit Panel', apply=True, reset=False,
|
|
4508
|
-
parent=parent)
|
|
4509
|
-
self.tab_class = EditTab
|
|
4510
|
-
|
|
4511
|
-
def activate(self, node):
|
|
4512
|
-
"""
|
|
4513
|
-
Activate a tab to edit the contents of a NeXus group.
|
|
4514
|
-
|
|
4515
|
-
Parameters
|
|
4516
|
-
----------
|
|
4517
|
-
node : NXobject
|
|
4518
|
-
The node to be edited
|
|
4519
|
-
"""
|
|
4520
|
-
label = node.nxroot.nxname + node.nxpath
|
|
4521
|
-
if label not in self.tabs:
|
|
4522
|
-
tab = EditTab(label, node, parent=self)
|
|
4523
|
-
self.add(label, tab, idx=self.idx(label))
|
|
4524
|
-
else:
|
|
4525
|
-
self.tab = label
|
|
4526
|
-
self.setVisible(True)
|
|
4527
|
-
self.raise_()
|
|
4528
|
-
self.activateWindow()
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
class EditTab(NXTab):
|
|
4532
|
-
|
|
4533
|
-
def __init__(self, label, node, parent=None):
|
|
4534
|
-
|
|
4535
|
-
"""
|
|
4536
|
-
Initialize the tab to edit the contents of a NeXus group. Only
|
|
4537
|
-
scalar fields are editable in this dialog.
|
|
4538
|
-
|
|
4539
|
-
Parameters
|
|
4540
|
-
----------
|
|
4541
|
-
label : str
|
|
4542
|
-
The title of the tab
|
|
4543
|
-
node : NXobject
|
|
4544
|
-
The NeXus node to be edited
|
|
4545
|
-
parent : QWidget, optional
|
|
4546
|
-
The parent of the tab
|
|
4547
|
-
"""
|
|
4548
|
-
super().__init__(label, parent=parent)
|
|
4549
|
-
|
|
4550
|
-
self.group = node
|
|
4551
|
-
if not isinstance(self.group, NXgroup):
|
|
4552
|
-
raise NeXusError('The node must be a NeXus group')
|
|
4553
|
-
|
|
4554
|
-
field_list = [f for f in self.group.NXfield if f.ndim == 0]
|
|
4555
|
-
if len(field_list) == 0:
|
|
4556
|
-
raise NeXusError(f"No scalar fields found in {self.group.nxpath}")
|
|
4557
|
-
|
|
4558
|
-
self.grid = QtWidgets.QGridLayout()
|
|
4559
|
-
self.grid.setSpacing(10)
|
|
4560
|
-
headers = ['Field', 'Value', '']
|
|
4561
|
-
width = [100, 100, 20]
|
|
4562
|
-
column = 0
|
|
4563
|
-
for header in headers:
|
|
4564
|
-
label = NXLabel(header, bold=True, align='center')
|
|
4565
|
-
self.grid.addWidget(label, 0, column)
|
|
4566
|
-
self.grid.setColumnMinimumWidth(column, width[column])
|
|
4567
|
-
column += 1
|
|
4568
|
-
|
|
4569
|
-
row = 1
|
|
4570
|
-
for field in field_list:
|
|
4571
|
-
self.grid.addWidget(NXLabel(field.nxname), row, 0,
|
|
4572
|
-
QtCore.Qt.AlignTop)
|
|
4573
|
-
if field.is_string():
|
|
4574
|
-
self.grid.addWidget(NXTextEdit(field.nxvalue, autosize=True),
|
|
4575
|
-
row, 1, QtCore.Qt.AlignTop)
|
|
4576
|
-
else:
|
|
4577
|
-
self.grid.addWidget(NXTextEdit(field.nxvalue, align='right',
|
|
4578
|
-
autosize=True),
|
|
4579
|
-
row, 1)
|
|
4580
|
-
self.grid.addWidget(NXLabel(field.nxunits), row, 2)
|
|
4581
|
-
row += 1
|
|
4582
|
-
self.grid.setContentsMargins(10, 10, 40, 10)
|
|
4583
|
-
self.grid.setSpacing(5)
|
|
4584
|
-
if len(field_list) > 10:
|
|
4585
|
-
self.scroll_area = NXScrollArea(self.grid, height=800)
|
|
4586
|
-
self.scroll_area.setMinimumHeight(200)
|
|
4587
|
-
self.set_layout(self.scroll_area)
|
|
4588
|
-
else:
|
|
4589
|
-
self.set_layout(self.grid)
|
|
4590
|
-
self.scroll_area = None
|
|
4591
|
-
self.set_title(f'Edit {self.group.nxpath}')
|
|
4592
|
-
|
|
4593
|
-
def resize(self):
|
|
4594
|
-
"""Update the size of the scroll area and its contents."""
|
|
4595
|
-
super().resize()
|
|
4596
|
-
if self.scroll_area is not None:
|
|
4597
|
-
self.scroll_area.widget().updateGeometry()
|
|
4598
|
-
self.scroll_area.updateGeometry()
|
|
4599
|
-
self.scroll_area.widget().adjustSize()
|
|
4600
|
-
self.scroll_area.adjustSize()
|
|
4601
|
-
|
|
4602
|
-
def apply(self):
|
|
4603
|
-
if not self.group.is_modifiable():
|
|
4604
|
-
self.display_message('Group is read-only')
|
|
4605
|
-
return
|
|
4606
|
-
row = 1
|
|
4607
|
-
for row in range(1, self.grid.rowCount()):
|
|
4608
|
-
field_name = self.grid.itemAtPosition(row, 0).widget().text()
|
|
4609
|
-
field = self.group[field_name]
|
|
4610
|
-
if field.is_string():
|
|
4611
|
-
value = self.grid.itemAtPosition(row, 1).widget().toPlainText()
|
|
4612
|
-
if field.nxvalue != value.rstrip():
|
|
4613
|
-
field.nxdata = value.rstrip()
|
|
4614
|
-
else:
|
|
4615
|
-
value = self.grid.itemAtPosition(row, 1).widget().toPlainText()
|
|
4616
|
-
try:
|
|
4617
|
-
value = field.dtype.type(value)
|
|
4618
|
-
except ValueError:
|
|
4619
|
-
self.display_message(f'Invalid value for {field.nxname}')
|
|
4620
|
-
return
|
|
4621
|
-
if not np.isclose(field.nxvalue, value):
|
|
4622
|
-
field.nxdata = value
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
4581
|
class GroupDialog(NXDialog):
|
|
4626
4582
|
|
|
4627
4583
|
def __init__(self, node, parent=None):
|
|
@@ -286,8 +286,10 @@ class FitTab(NXTab):
|
|
|
286
286
|
self.form_combo = NXComboBox()
|
|
287
287
|
self.compose_button = NXPushButton(
|
|
288
288
|
"Compose Models", self.compose_model)
|
|
289
|
+
self.import_button = NXPushButton("Import Model", self.import_fit)
|
|
289
290
|
model_layout = self.make_layout(add_button, self.model_combo,
|
|
290
291
|
self.form_combo, 'stretch',
|
|
292
|
+
self.import_button,
|
|
291
293
|
self.compose_button, align='justified')
|
|
292
294
|
|
|
293
295
|
self.parameter_layout = self.initialize_parameter_grid()
|
|
@@ -296,13 +298,13 @@ class FitTab(NXTab):
|
|
|
296
298
|
self.remove_combo = NXComboBox()
|
|
297
299
|
self.restore_button = NXPushButton("Restore Parameters",
|
|
298
300
|
self.restore_parameters)
|
|
299
|
-
self.
|
|
300
|
-
self.
|
|
301
|
+
self.copy_parameters_button = NXPushButton("Copy Parameters",
|
|
302
|
+
self.copy_parameters)
|
|
301
303
|
self.remove_layout = self.make_layout(self.remove_button,
|
|
302
304
|
self.remove_combo,
|
|
303
305
|
'stretch',
|
|
304
306
|
self.restore_button,
|
|
305
|
-
self.
|
|
307
|
+
self.copy_parameters_button,
|
|
306
308
|
align='justified')
|
|
307
309
|
|
|
308
310
|
if self.plotview is None:
|
|
@@ -330,11 +332,13 @@ class FitTab(NXTab):
|
|
|
330
332
|
else:
|
|
331
333
|
self.fit_checkbox = NXCheckBox('Use Poisson Errors',
|
|
332
334
|
self.define_errors)
|
|
335
|
+
self.copy_fit_button = NXPushButton("Copy Fit", self.copy_fit)
|
|
333
336
|
self.save_fit_button = NXPushButton("Save Fit", self.save_fit)
|
|
334
337
|
self.adjust_layout = self.make_layout(self.fit_button,
|
|
335
338
|
self.fit_combo,
|
|
336
339
|
self.fit_checkbox,
|
|
337
340
|
'stretch',
|
|
341
|
+
self.copy_fit_button,
|
|
338
342
|
self.save_fit_button,
|
|
339
343
|
align='justified')
|
|
340
344
|
|
|
@@ -499,26 +503,29 @@ class FitTab(NXTab):
|
|
|
499
503
|
Set to True if the data have been fitted.
|
|
500
504
|
"""
|
|
501
505
|
if len(self.models) == 0:
|
|
506
|
+
self.import_button.setVisible(True)
|
|
502
507
|
self.compose_button.setVisible(False)
|
|
503
508
|
self.remove_button.setVisible(False)
|
|
504
509
|
self.remove_combo.setVisible(False)
|
|
505
510
|
self.restore_button.setVisible(False)
|
|
506
|
-
self.
|
|
511
|
+
self.copy_parameters_button.setVisible(False)
|
|
507
512
|
self.fit_button.setVisible(False)
|
|
508
513
|
self.fit_combo.setVisible(False)
|
|
509
514
|
self.fit_checkbox.setVisible(False)
|
|
510
515
|
self.fit_status.setVisible(False)
|
|
511
516
|
self.report_button.setVisible(False)
|
|
517
|
+
self.copy_fit_button.setVisible(False)
|
|
512
518
|
self.save_fit_button.setVisible(False)
|
|
513
519
|
self.plot_model_button.setVisible(False)
|
|
514
520
|
self.plot_combo.setVisible(False)
|
|
515
521
|
self.plot_checkbox.setVisible(False)
|
|
516
522
|
else:
|
|
523
|
+
self.import_button.setVisible(False)
|
|
517
524
|
if len(self.models) > 1:
|
|
518
525
|
self.compose_button.setVisible(True)
|
|
519
526
|
self.remove_button.setVisible(True)
|
|
520
527
|
self.remove_combo.setVisible(True)
|
|
521
|
-
self.
|
|
528
|
+
self.copy_parameters_button.setVisible(True)
|
|
522
529
|
self.fit_button.setVisible(True)
|
|
523
530
|
self.fit_combo.setVisible(True)
|
|
524
531
|
self.fit_checkbox.setVisible(True)
|
|
@@ -529,8 +536,10 @@ class FitTab(NXTab):
|
|
|
529
536
|
self.restore_button.setVisible(True)
|
|
530
537
|
self.fit_status.setVisible(True)
|
|
531
538
|
self.report_button.setVisible(True)
|
|
539
|
+
self.copy_fit_button.setVisible(True)
|
|
532
540
|
self.save_fit_button.setVisible(True)
|
|
533
541
|
else:
|
|
542
|
+
self.copy_fit_button.setVisible(False)
|
|
534
543
|
self.save_fit_button.setVisible(False)
|
|
535
544
|
|
|
536
545
|
@property
|
|
@@ -790,9 +799,18 @@ class FitTab(NXTab):
|
|
|
790
799
|
except Exception:
|
|
791
800
|
return None, None
|
|
792
801
|
|
|
802
|
+
def import_fit(self):
|
|
803
|
+
"""Select the NXprocess group containing the fit."""
|
|
804
|
+
group = self.treeview.node
|
|
805
|
+
if not isinstance(group, NXprocess):
|
|
806
|
+
display_message("Import Fit",
|
|
807
|
+
"Select a valid NXprocess group in the tree")
|
|
808
|
+
else:
|
|
809
|
+
self.load_fit(group)
|
|
810
|
+
|
|
793
811
|
def load_fit(self, group):
|
|
794
812
|
"""
|
|
795
|
-
|
|
813
|
+
Load a fit from a NeXus NXprocess group.
|
|
796
814
|
|
|
797
815
|
Parameters
|
|
798
816
|
----------
|
|
@@ -840,9 +858,6 @@ class FitTab(NXTab):
|
|
|
840
858
|
if error:
|
|
841
859
|
parameter.stderr = float(
|
|
842
860
|
saved_parameters[p].attrs['error'])
|
|
843
|
-
parameter.vary = True
|
|
844
|
-
else:
|
|
845
|
-
parameter.vary = False
|
|
846
861
|
self.models.append({'name': model_name,
|
|
847
862
|
'class': model_class,
|
|
848
863
|
'model': model,
|
|
@@ -860,15 +875,19 @@ class FitTab(NXTab):
|
|
|
860
875
|
self.model += model['model']
|
|
861
876
|
self.composite_model += '+' + model['name']
|
|
862
877
|
self.add_model_parameters(model_index)
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
878
|
+
if 'composite_model' in group.attrs:
|
|
879
|
+
composite_model = group.attrs['composite_model']
|
|
880
|
+
elif 'model' in group and isinstance(group['model'], NXfield):
|
|
881
|
+
composite_model = group['model'].nxvalue
|
|
882
|
+
else:
|
|
883
|
+
composite_model = None
|
|
884
|
+
if composite_model is not None:
|
|
885
|
+
self.model = self.eval_model(composite_model)
|
|
886
|
+
self.composite_model = composite_model
|
|
887
|
+
else:
|
|
888
|
+
self.model = self.eval_model(self.composite_model)
|
|
870
889
|
self.write_parameters()
|
|
871
|
-
self.
|
|
890
|
+
self.copy_parameters_button.setVisible(True)
|
|
872
891
|
self.save_fit_button.setVisible(False)
|
|
873
892
|
|
|
874
893
|
def convert_parameter_name(self, parameter, saved_parameters):
|
|
@@ -1338,7 +1357,7 @@ class FitTab(NXTab):
|
|
|
1338
1357
|
p.value = make_float(p.box['value'].text())
|
|
1339
1358
|
p.min = make_float(p.box['min'].text())
|
|
1340
1359
|
p.max = make_float(p.box['max'].text())
|
|
1341
|
-
p.vary = not p.box['fixed'].
|
|
1360
|
+
p.vary = not p.box['fixed'].isChecked()
|
|
1342
1361
|
for m in self.models:
|
|
1343
1362
|
for parameter in m['parameters']:
|
|
1344
1363
|
p = m['parameters'][parameter]
|
|
@@ -1643,18 +1662,7 @@ class FitTab(NXTab):
|
|
|
1643
1662
|
self.fit_status.setText('Fit failed')
|
|
1644
1663
|
|
|
1645
1664
|
def report_fit(self):
|
|
1646
|
-
"""
|
|
1647
|
-
Display the results of a fit in a message box.
|
|
1648
|
-
|
|
1649
|
-
This function is used to display the results of a fit in a message box.
|
|
1650
|
-
The message box contains a text box that displays the fit results.
|
|
1651
|
-
The fit results are formatted as a multi-line string, with each line
|
|
1652
|
-
containing a different piece of information about the fit. The
|
|
1653
|
-
information includes the fit message, the chi^2 and reduced chi^2, the
|
|
1654
|
-
number of function evaluations, the number of variables, the number
|
|
1655
|
-
of data points, and the number of degrees of freedom. The fit report
|
|
1656
|
-
is also included.
|
|
1657
|
-
"""
|
|
1665
|
+
"""Display the results of a fit in a message box."""
|
|
1658
1666
|
if self.fit.result.errorbars:
|
|
1659
1667
|
errors = 'Uncertainties estimated'
|
|
1660
1668
|
else:
|
|
@@ -1677,30 +1685,14 @@ class FitTab(NXTab):
|
|
|
1677
1685
|
layout.addItem(spacer, layout.rowCount(), 0, 1, layout.columnCount())
|
|
1678
1686
|
message_box.exec()
|
|
1679
1687
|
|
|
1680
|
-
def
|
|
1681
|
-
"""
|
|
1682
|
-
Save the fit results in a NXprocess group.
|
|
1683
|
-
|
|
1684
|
-
If the fit results have not been calculated, a message is posted
|
|
1685
|
-
to the status bar and the function returns without doing
|
|
1686
|
-
anything else.
|
|
1687
|
-
|
|
1688
|
-
The NXprocess group is built from the data, model, and
|
|
1689
|
-
parameters. The model and data are stored in the group as
|
|
1690
|
-
datasets, and the parameters are stored as attributes of the
|
|
1691
|
-
datasets. The program name and version are stored as attributes
|
|
1692
|
-
of the group. The fit statistics are stored as attributes of a
|
|
1693
|
-
'statistics' dataset in the group. The fit report is stored as a
|
|
1694
|
-
note in the group.
|
|
1695
|
-
|
|
1696
|
-
The group is then written to disk using the write_group method.
|
|
1697
|
-
"""
|
|
1688
|
+
def store_fit(self):
|
|
1689
|
+
"""Store the results of a fit in a NXprocess group."""
|
|
1698
1690
|
if self.fit is None:
|
|
1699
1691
|
self.fit_status.setText('Fit not available for saving')
|
|
1700
1692
|
return
|
|
1701
1693
|
self.read_parameters()
|
|
1702
1694
|
group = NXprocess()
|
|
1703
|
-
group['
|
|
1695
|
+
group.attrs['composite_model'] = self.composite_model
|
|
1704
1696
|
group['data'] = self.data
|
|
1705
1697
|
for m in self.models:
|
|
1706
1698
|
group[m['name']] = self.get_model(m['model'])
|
|
@@ -1732,41 +1724,34 @@ class FitTab(NXTab):
|
|
|
1732
1724
|
f'No. of Data Points = {self.fit.result.ndata}\n'
|
|
1733
1725
|
f'No. of Degrees of Freedom = {self.fit.result.nfree}\n'
|
|
1734
1726
|
f'{self.fit.fit_report()}')
|
|
1735
|
-
|
|
1727
|
+
return group
|
|
1736
1728
|
|
|
1737
|
-
def
|
|
1729
|
+
def copy_fit(self):
|
|
1738
1730
|
"""
|
|
1739
|
-
|
|
1731
|
+
Copy the results of a fit to the clipboard.
|
|
1740
1732
|
|
|
1741
|
-
The
|
|
1742
|
-
|
|
1743
|
-
group
|
|
1733
|
+
The results of the fit are copied to the clipboard as a
|
|
1734
|
+
NXprocess group containing the model, data, and parameters. The
|
|
1735
|
+
group can then be pasted into another NeXus group in the tree.
|
|
1744
1736
|
"""
|
|
1745
|
-
self.
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
initial_value=p.init_value,
|
|
1756
|
-
min=str(p.min), max=str(p.max),
|
|
1757
|
-
vary=p.vary, expr=p.expr)
|
|
1758
|
-
group[m['name']].insert(parameters)
|
|
1759
|
-
group['title'] = 'Fit Model'
|
|
1760
|
-
group['model'] = self.get_model()
|
|
1737
|
+
group = self.store_fit()
|
|
1738
|
+
self.mainwindow.copied_node = self.mainwindow.copy_node(group)
|
|
1739
|
+
|
|
1740
|
+
def save_fit(self):
|
|
1741
|
+
"""Save the results of a fit to the scratch file.
|
|
1742
|
+
|
|
1743
|
+
The results of the fit are written to the NeXpy scratch file as
|
|
1744
|
+
a NXprocess group containing the model, data, and parameters.
|
|
1745
|
+
"""
|
|
1746
|
+
group = self.store_fit()
|
|
1761
1747
|
self.write_group(group)
|
|
1762
1748
|
|
|
1763
1749
|
def write_group(self, group):
|
|
1764
1750
|
"""
|
|
1765
|
-
Write a group to the scratch file.
|
|
1751
|
+
Write a group to the NeXpy scratch file.
|
|
1766
1752
|
|
|
1767
1753
|
The group is written to the first free number in the scratch file,
|
|
1768
|
-
starting from 'f1'.
|
|
1769
|
-
bar.
|
|
1754
|
+
starting from 'f1'.
|
|
1770
1755
|
"""
|
|
1771
1756
|
if 'w0' not in self.tree:
|
|
1772
1757
|
self.tree['w0'] = nxload(self.mainwindow.scratch_file, 'rw')
|
|
@@ -1783,6 +1768,31 @@ class FitTab(NXTab):
|
|
|
1783
1768
|
self.tree['w0'][name] = group
|
|
1784
1769
|
self.fit_status.setText(f'Parameters saved to w0/{name}')
|
|
1785
1770
|
|
|
1771
|
+
def copy_parameters(self):
|
|
1772
|
+
"""Copy the current parameters to the clipboard.
|
|
1773
|
+
|
|
1774
|
+
The parameters are copied to the clipboard as a NXprocess group
|
|
1775
|
+
containing the model, data, and parameters. The group can then
|
|
1776
|
+
be pasted into another NeXus group in the tree.
|
|
1777
|
+
"""
|
|
1778
|
+
self.read_parameters()
|
|
1779
|
+
group = NXprocess()
|
|
1780
|
+
group.attrs['composite_model'] = self.composite_model
|
|
1781
|
+
group['data'] = self.data
|
|
1782
|
+
for m in self.models:
|
|
1783
|
+
group[m['name']] = self.get_model(m['model'])
|
|
1784
|
+
parameters = NXparameters(attrs={'model': m['class']})
|
|
1785
|
+
for n, p in m['parameters'].items():
|
|
1786
|
+
n = n.replace(m['model'].prefix, '')
|
|
1787
|
+
parameters[n] = NXfield(p.value, error=p.stderr,
|
|
1788
|
+
initial_value=p.init_value,
|
|
1789
|
+
min=str(p.min), max=str(p.max),
|
|
1790
|
+
vary=p.vary, expr=p.expr)
|
|
1791
|
+
group[m['name']].insert(parameters)
|
|
1792
|
+
group['title'] = 'Fit Model'
|
|
1793
|
+
group['model'] = self.get_model()
|
|
1794
|
+
self.mainwindow.copied_node = self.mainwindow.copy_node(group)
|
|
1795
|
+
|
|
1786
1796
|
def restore_parameters(self):
|
|
1787
1797
|
"""
|
|
1788
1798
|
Restore the initial parameters of the fit model.
|
|
@@ -28,8 +28,8 @@ from qtconsole.rich_jupyter_widget import RichJupyterWidget
|
|
|
28
28
|
|
|
29
29
|
from .. import __version__
|
|
30
30
|
from .dialogs import (AttributeDialog, CustomizeDialog, DirectoryDialog,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
ExportDialog, FieldDialog, GroupDialog, LimitDialog,
|
|
32
|
+
LockDialog, LogDialog, ManageBackupsDialog,
|
|
33
33
|
ManagePluginsDialog, NewDialog, PasteDialog, PlotDialog,
|
|
34
34
|
PlotScalarDialog, ProjectionDialog, RenameDialog,
|
|
35
35
|
ScanDialog, SettingsDialog, SignalDialog, UnlockDialog,
|
|
@@ -543,11 +543,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
543
543
|
|
|
544
544
|
self.data_menu.addSeparator()
|
|
545
545
|
|
|
546
|
-
self.edit_action = QtWidgets.QAction(
|
|
547
|
-
"Edit Data", self, shortcut=QtGui.QKeySequence("Ctrl+E"),
|
|
548
|
-
triggered=self.edit_data)
|
|
549
|
-
self.add_menu_action(self.data_menu, self.edit_action)
|
|
550
|
-
|
|
551
546
|
self.rename_action = QtWidgets.QAction("Rename Data", self,
|
|
552
547
|
triggered=self.rename_data)
|
|
553
548
|
self.add_menu_action(self.data_menu, self.rename_action)
|
|
@@ -1686,16 +1681,6 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
1686
1681
|
except NeXusError as error:
|
|
1687
1682
|
report_error("Viewing Data", error)
|
|
1688
1683
|
|
|
1689
|
-
def edit_data(self):
|
|
1690
|
-
"""Open an editor for the selected group."""
|
|
1691
|
-
try:
|
|
1692
|
-
node = self.treeview.get_node()
|
|
1693
|
-
if not self.panel_is_running('Edit'):
|
|
1694
|
-
self.panels['Edit'] = EditDialog()
|
|
1695
|
-
self.panels['Edit'].activate(node)
|
|
1696
|
-
except NeXusError as error:
|
|
1697
|
-
report_error("Editing Data", error)
|
|
1698
|
-
|
|
1699
1684
|
def validate_data(self):
|
|
1700
1685
|
"""
|
|
1701
1686
|
Validate the selected data.
|
|
@@ -1917,8 +1917,10 @@ class NXPlotView(QtWidgets.QDialog):
|
|
|
1917
1917
|
raise NeXusError('Can only rotate 2D data.')
|
|
1918
1918
|
try:
|
|
1919
1919
|
angle = float(angle)
|
|
1920
|
+
if not (angle > -360.0 and angle < 360.0):
|
|
1921
|
+
raise ValueError
|
|
1920
1922
|
except (ValueError, TypeError):
|
|
1921
|
-
raise NeXusError('Rotation angle
|
|
1923
|
+
raise NeXusError('Rotation angle is invalid.')
|
|
1922
1924
|
return rotate_data(self.plotdata, angle, aspect=self.get_aspect())
|
|
1923
1925
|
|
|
1924
1926
|
@property
|
|
@@ -519,7 +519,6 @@ class NXTreeView(QtWidgets.QTreeView):
|
|
|
519
519
|
self.mainwindow.group_action.setEnabled(False)
|
|
520
520
|
self.mainwindow.field_action.setEnabled(False)
|
|
521
521
|
self.mainwindow.attribute_action.setEnabled(False)
|
|
522
|
-
self.mainwindow.edit_action.setEnabled(False)
|
|
523
522
|
self.mainwindow.rename_action.setEnabled(False)
|
|
524
523
|
self.mainwindow.delete_action.setEnabled(False)
|
|
525
524
|
self.mainwindow.copydata_action.setEnabled(False)
|
|
@@ -570,7 +569,6 @@ class NXTreeView(QtWidgets.QTreeView):
|
|
|
570
569
|
self.mainwindow.copydata_action.setEnabled(True)
|
|
571
570
|
if isinstance(node, NXgroup):
|
|
572
571
|
self.mainwindow.validate_action.setEnabled(True)
|
|
573
|
-
self.mainwindow.edit_action.setEnabled(True)
|
|
574
572
|
if isinstance(node, NXlink):
|
|
575
573
|
self.mainwindow.link_action.setEnabled(True)
|
|
576
574
|
if isinstance(node, NXdata):
|
|
@@ -679,7 +677,6 @@ class NXTreeView(QtWidgets.QTreeView):
|
|
|
679
677
|
self.addMenu(self.mainwindow.field_action)
|
|
680
678
|
self.addMenu(self.mainwindow.attribute_action)
|
|
681
679
|
self.menu.addSeparator()
|
|
682
|
-
self.addMenu(self.mainwindow.edit_action)
|
|
683
680
|
self.addMenu(self.mainwindow.rename_action)
|
|
684
681
|
self.addMenu(self.mainwindow.delete_action)
|
|
685
682
|
self.menu.addSeparator()
|
|
@@ -2085,6 +2085,10 @@ class GridParameter:
|
|
|
2085
2085
|
Whether the field contains a color value, default False.
|
|
2086
2086
|
spinbox : bool, optional
|
|
2087
2087
|
Whether the field should be a spin box, default False.
|
|
2088
|
+
readonly : bool, optional
|
|
2089
|
+
Whether the field is read-only, default False.
|
|
2090
|
+
width : int, optional
|
|
2091
|
+
Width of the box, default None
|
|
2088
2092
|
"""
|
|
2089
2093
|
self.name = name
|
|
2090
2094
|
self._value = value
|
|
@@ -3165,6 +3169,11 @@ class NXPushButton(QtWidgets.QPushButton):
|
|
|
3165
3169
|
else:
|
|
3166
3170
|
self.parent().keyPressEvent(event)
|
|
3167
3171
|
|
|
3172
|
+
def mouseReleaseEvent(self, event: QtGui.QMouseEvent):
|
|
3173
|
+
"""Clear focus after a mouse release event."""
|
|
3174
|
+
super().mouseReleaseEvent(event)
|
|
3175
|
+
self.clearFocus()
|
|
3176
|
+
|
|
3168
3177
|
|
|
3169
3178
|
class NXColorButton(QtWidgets.QPushButton):
|
|
3170
3179
|
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools-scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
|
|
4
|
-
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
-
|
|
6
|
-
TYPE_CHECKING = False
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from typing import Tuple
|
|
9
|
-
from typing import Union
|
|
10
|
-
|
|
11
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
-
else:
|
|
13
|
-
VERSION_TUPLE = object
|
|
14
|
-
|
|
15
|
-
version: str
|
|
16
|
-
__version__: str
|
|
17
|
-
__version_tuple__: VERSION_TUPLE
|
|
18
|
-
version_tuple: VERSION_TUPLE
|
|
19
|
-
|
|
20
|
-
__version__ = version = '2.0.0b7'
|
|
21
|
-
__version_tuple__ = version_tuple = (2, 0, 0, 'b7')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.py
RENAMED
|
File without changes
|
{nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/__init__.pyc
RENAMED
|
File without changes
|
{nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.py
RENAMED
|
File without changes
|
{nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/convert_qe.pyc
RENAMED
|
File without changes
|
|
File without changes
|
{nexpy-2.0.0b7 → nexpy-2.0.0b9}/src/nexpy/examples/plugins/chopper_plugin/chopper/get_ei.pyc
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|