xarray-graph 0.2.3__tar.gz → 0.2.5__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.
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/PKG-INFO +4 -4
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/pyproject.toml +4 -4
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/src/xarray_graph/XarrayGraph.py +43 -58
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/LICENSE +0 -0
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/README.md +0 -0
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/src/xarray_graph/__init__.py +0 -0
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/src/xarray_graph/__main__.py +0 -0
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/src/xarray_graph/tmp/RegionsManager.py +0 -0
- {xarray_graph-0.2.3 → xarray_graph-0.2.5}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: xarray-graph
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: PyQt/PySide UI for graphing (x,y) slices of Xarray datasets.
|
|
5
5
|
Keywords: PyQt,PySide,xarray,graph
|
|
6
6
|
Home-page: https://github.com/marcel-goldschen-ohm/xarray-graph
|
|
@@ -22,9 +22,9 @@ Requires-Dist: numpy>=1.26.2
|
|
|
22
22
|
Requires-Dist: xarray>=2023.12.0
|
|
23
23
|
Requires-Dist: qtpy>=2.4.1
|
|
24
24
|
Requires-Dist: qtawesome>=1.3.0
|
|
25
|
-
Requires-Dist: pyqt-ext>=1.2.
|
|
26
|
-
Requires-Dist: pyqtgraph-ext>=1.2.
|
|
27
|
-
Requires-Dist: xarray-treeview>=1.2.
|
|
25
|
+
Requires-Dist: pyqt-ext>=1.2.5
|
|
26
|
+
Requires-Dist: pyqtgraph-ext>=1.2.6
|
|
27
|
+
Requires-Dist: xarray-treeview>=1.2.6
|
|
28
28
|
Requires-Dist: scipy>=1.11.4
|
|
29
29
|
Requires-Dist: lmfit>=1.2.2
|
|
30
30
|
Description-Content-Type: text/markdown
|
|
@@ -11,9 +11,9 @@ dependencies = [
|
|
|
11
11
|
"xarray>=2023.12.0",
|
|
12
12
|
"qtpy>=2.4.1",
|
|
13
13
|
"qtawesome>=1.3.0",
|
|
14
|
-
"pyqt-ext>=1.2.
|
|
15
|
-
"pyqtgraph-ext>=1.2.
|
|
16
|
-
"xarray-treeview>=1.2.
|
|
14
|
+
"pyqt-ext>=1.2.5",
|
|
15
|
+
"pyqtgraph-ext>=1.2.6",
|
|
16
|
+
"xarray-treeview>=1.2.6",
|
|
17
17
|
"scipy>=1.11.4",
|
|
18
18
|
"lmfit>=1.2.2",
|
|
19
19
|
]
|
|
@@ -35,7 +35,7 @@ classifiers = [
|
|
|
35
35
|
"Programming Language :: Python :: 3.12",
|
|
36
36
|
"Programming Language :: Python :: 3.13",
|
|
37
37
|
]
|
|
38
|
-
version = "0.2.
|
|
38
|
+
version = "0.2.5"
|
|
39
39
|
|
|
40
40
|
[project.license]
|
|
41
41
|
text = "MIT"
|
|
@@ -153,7 +153,7 @@ class XarrayGraph(QMainWindow):
|
|
|
153
153
|
self._notes_edit.setPlainText(self.attrs.get('notes', ''))
|
|
154
154
|
|
|
155
155
|
# populate array math selections
|
|
156
|
-
|
|
156
|
+
self._update_array_math_comboboxes()
|
|
157
157
|
|
|
158
158
|
@property
|
|
159
159
|
def dims(self) -> list[str]:
|
|
@@ -1069,6 +1069,7 @@ class XarrayGraph(QMainWindow):
|
|
|
1069
1069
|
self._data_treeview.setModel(model)
|
|
1070
1070
|
self._data_treeview.selectionWasChanged.connect(self._on_tree_selection_changed)
|
|
1071
1071
|
self._data_treeviewer.setSizes([100, 1])
|
|
1072
|
+
self._data_treeviewer.metadata_tabs.setCurrentIndex(1)
|
|
1072
1073
|
|
|
1073
1074
|
self._xdim_combobox = QComboBox()
|
|
1074
1075
|
self._xdim_combobox.currentTextChanged.connect(self.set_xdim)
|
|
@@ -1191,7 +1192,7 @@ class XarrayGraph(QMainWindow):
|
|
|
1191
1192
|
self._math_operator_combobox.setSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Preferred)
|
|
1192
1193
|
|
|
1193
1194
|
self._math_eval_button = QPushButton('Evaluate')
|
|
1194
|
-
|
|
1195
|
+
self._math_eval_button.pressed.connect(self.eval_array_math)
|
|
1195
1196
|
|
|
1196
1197
|
math_group = QGroupBox('Array math')
|
|
1197
1198
|
grid = QGridLayout(math_group)
|
|
@@ -1512,13 +1513,6 @@ class XarrayGraph(QMainWindow):
|
|
|
1512
1513
|
|
|
1513
1514
|
self._control_panel.addWidget(scroll_area)
|
|
1514
1515
|
|
|
1515
|
-
# def _show_region_context_menu(self, pos: QPoint) -> None:
|
|
1516
|
-
# if not hasattr(self, '_region_button_menu'):
|
|
1517
|
-
# self._region_button_menu = QMenu()
|
|
1518
|
-
# menu = QMenu()
|
|
1519
|
-
# menu.addAction('Draw X-axis regions until unchecked', self.clear_regions)
|
|
1520
|
-
# menu.exec(self.sender().mapToGlobal(pos))
|
|
1521
|
-
|
|
1522
1516
|
def _set_region_drawing_mode(self, draw: bool | None = None) -> None:
|
|
1523
1517
|
if draw is None:
|
|
1524
1518
|
draw = self._region_button.isChecked()
|
|
@@ -1667,57 +1661,48 @@ class XarrayGraph(QMainWindow):
|
|
|
1667
1661
|
if isinstance(item, XAxisRegion):
|
|
1668
1662
|
item.setFontSize(self._textitem_fontsize_spinbox.value())
|
|
1669
1663
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
# self._math_lhs_combobox.addItems(var_items)
|
|
1680
|
-
# self._math_rhs_combobox.addItems(var_items)
|
|
1664
|
+
def _update_array_math_comboboxes(self) -> None:
|
|
1665
|
+
var_paths = [item.path for item in self._data_treeview.model().root().depth_first() if item.is_var()]
|
|
1666
|
+
for i in range(len(var_paths)):
|
|
1667
|
+
if len(var_paths[i]) > 100:
|
|
1668
|
+
var_paths[i] = '...' + var_paths[i][-97:]
|
|
1669
|
+
self._math_lhs_combobox.clear()
|
|
1670
|
+
self._math_rhs_combobox.clear()
|
|
1671
|
+
self._math_lhs_combobox.addItems(var_paths)
|
|
1672
|
+
self._math_rhs_combobox.addItems(var_paths)
|
|
1681
1673
|
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
# # append result as child of lhs_item
|
|
1704
|
-
# # TODO: handle result name collisions
|
|
1705
|
-
# result_name = self._math_result_name_edit.text().strip()
|
|
1706
|
-
# ds = xr.Dataset(data_vars={result.name: result})
|
|
1707
|
-
# result_node = XarrayTreeNode(name=result_name, dataset=ds, parent=lhs_item.node)
|
|
1674
|
+
def eval_array_math(self) -> None:
|
|
1675
|
+
var_items = [item for item in self._data_treeview.model().root().depth_first() if item.is_var()]
|
|
1676
|
+
lhs_item = var_items[self._math_lhs_combobox.currentIndex()]
|
|
1677
|
+
rhs_item = var_items[self._math_rhs_combobox.currentIndex()]
|
|
1678
|
+
lhs: xr.DataArray = lhs_item.node[lhs_item.key]
|
|
1679
|
+
rhs: xr.DataArray = rhs_item.node[rhs_item.key]
|
|
1680
|
+
op = self._math_operator_combobox.currentText()
|
|
1681
|
+
if op == '+':
|
|
1682
|
+
result = lhs + rhs
|
|
1683
|
+
elif op == '-':
|
|
1684
|
+
result = lhs - rhs
|
|
1685
|
+
elif op == '*':
|
|
1686
|
+
result = lhs * rhs
|
|
1687
|
+
elif op == '/':
|
|
1688
|
+
result = lhs / rhs
|
|
1689
|
+
# append result as child of lhs_item
|
|
1690
|
+
result_name = self._math_result_name_edit.text().strip()
|
|
1691
|
+
if result_name == '':
|
|
1692
|
+
result_name = self._math_result_name_edit.placeholderText()
|
|
1693
|
+
result_ds = xr.Dataset(data_vars={result.name: result})
|
|
1694
|
+
result_node = DataTree(name=result_name, data=result_ds, parent=lhs_item.node)
|
|
1708
1695
|
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
# self._data_treeview.setExpanded(model.parent(index), True)
|
|
1720
|
-
# item = item.next_depth_first()
|
|
1696
|
+
# update data tree
|
|
1697
|
+
self.data = self.data
|
|
1698
|
+
|
|
1699
|
+
# make sure newly added fit nodes are selected and expanded
|
|
1700
|
+
model: XarrayTreeModel = self._data_treeview.model()
|
|
1701
|
+
for item in model.root().depth_first():
|
|
1702
|
+
if item.node is result_node and item.is_var():
|
|
1703
|
+
index: QModelIndex = model.createIndex(item.sibling_index, 0, item)
|
|
1704
|
+
self._data_treeview.selectionModel().select(index, QItemSelectionModel.SelectionFlag.Select | QItemSelectionModel.SelectionFlag.Rows)
|
|
1705
|
+
self._data_treeview.setExpanded(model.parent(index), True)
|
|
1721
1706
|
|
|
1722
1707
|
# # @Slot()
|
|
1723
1708
|
# # def on_axes_item_changed(self):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|