xarray-graph 0.2.5__tar.gz → 2026.7.1__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.
Files changed (84) hide show
  1. xarray_graph-2026.7.1/PKG-INFO +131 -0
  2. xarray_graph-2026.7.1/README.md +99 -0
  3. xarray_graph-2026.7.1/pyproject.toml +46 -0
  4. xarray_graph-2026.7.1/src/xarray_graph/__main__.py +85 -0
  5. xarray_graph-2026.7.1/src/xarray_graph/apps/XarrayDataTreeViewer.py +447 -0
  6. xarray_graph-2026.7.1/src/xarray_graph/apps/XarrayGraph.py +2178 -0
  7. xarray_graph-2026.7.1/src/xarray_graph/apps/__init__.py +2 -0
  8. xarray_graph-2026.7.1/src/xarray_graph/graph/AxisRegion.py +612 -0
  9. xarray_graph-2026.7.1/src/xarray_graph/graph/CurveFitControlPanel.py +434 -0
  10. xarray_graph-2026.7.1/src/xarray_graph/graph/Figure.py +28 -0
  11. xarray_graph-2026.7.1/src/xarray_graph/graph/FilterControlPanel.py +188 -0
  12. xarray_graph-2026.7.1/src/xarray_graph/graph/InfiniteLine.py +590 -0
  13. xarray_graph-2026.7.1/src/xarray_graph/graph/MeasureControlPanel.py +218 -0
  14. xarray_graph-2026.7.1/src/xarray_graph/graph/Plot.py +31 -0
  15. xarray_graph-2026.7.1/src/xarray_graph/graph/PlotCurve.py +226 -0
  16. xarray_graph-2026.7.1/src/xarray_graph/graph/PlotGrid.py +163 -0
  17. xarray_graph-2026.7.1/src/xarray_graph/graph/View.py +225 -0
  18. xarray_graph-2026.7.1/src/xarray_graph/graph/__init__.py +11 -0
  19. xarray_graph-2026.7.1/src/xarray_graph/io/__init__.py +4 -0
  20. xarray_graph-2026.7.1/src/xarray_graph/io/golab_tev_adicht2mat.m +57 -0
  21. xarray_graph-2026.7.1/src/xarray_graph/io/heka.py +118 -0
  22. xarray_graph-2026.7.1/src/xarray_graph/io/heka_reader.py +681 -0
  23. xarray_graph-2026.7.1/src/xarray_graph/io/io.py +92 -0
  24. xarray_graph-2026.7.1/src/xarray_graph/io/labchart.py +70 -0
  25. xarray_graph-2026.7.1/src/xarray_graph/io/winwcp.py +165 -0
  26. xarray_graph-2026.7.1/src/xarray_graph/tmp/AbstractTreeModel.py +526 -0
  27. xarray_graph-2026.7.1/src/xarray_graph/tmp/AnnotationTreeItem.py +216 -0
  28. xarray_graph-2026.7.1/src/xarray_graph/tmp/AnnotationTreeModel.py +281 -0
  29. xarray_graph-2026.7.1/src/xarray_graph/tmp/AnnotationTreeView.py +376 -0
  30. xarray_graph-2026.7.1/src/xarray_graph/tmp/IPythonConsole.py +117 -0
  31. xarray_graph-2026.7.1/src/xarray_graph/tmp/KeyValueTreeModel.py +706 -0
  32. xarray_graph-2026.7.1/src/xarray_graph/tmp/KeyValueTreeView OLD.py +233 -0
  33. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeDebugView.py +149 -0
  34. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeItem.py +425 -0
  35. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeItem2.py +376 -0
  36. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeModel.py +1568 -0
  37. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeView.py +670 -0
  38. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeViewer.py +702 -0
  39. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayDataTreeWindow.py +370 -0
  40. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayGraph copy.py +813 -0
  41. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayGraph.py +2105 -0
  42. xarray_graph-2026.7.1/src/xarray_graph/tmp/XarrayGraph_OLD.py +3722 -0
  43. xarray_graph-2026.7.1/src/xarray_graph/tmp/_OLD_io.py +206 -0
  44. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/AxisRegion.py +611 -0
  45. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/Figure.py +49 -0
  46. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/Graph.py +225 -0
  47. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/GraphStyle.py +303 -0
  48. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/Plot.py +31 -0
  49. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/PlotGrid.py +163 -0
  50. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/View.py +221 -0
  51. xarray_graph-2026.7.1/src/xarray_graph/tmp/pyqtgraph_ext/__init__.py +9 -0
  52. xarray_graph-2026.7.1/src/xarray_graph/tree/AbstractTreeItem.py +477 -0
  53. xarray_graph-2026.7.1/src/xarray_graph/tree/AbstractTreeModel.py +529 -0
  54. xarray_graph-2026.7.1/src/xarray_graph/tree/AnnotationTreeItem.py +166 -0
  55. xarray_graph-2026.7.1/src/xarray_graph/tree/AnnotationTreeModel.py +178 -0
  56. xarray_graph-2026.7.1/src/xarray_graph/tree/AnnotationTreeView.py +292 -0
  57. xarray_graph-2026.7.1/src/xarray_graph/tree/KeyValueTreeItem.py +206 -0
  58. xarray_graph-2026.7.1/src/xarray_graph/tree/KeyValueTreeModel.py +323 -0
  59. xarray_graph-2026.7.1/src/xarray_graph/tree/KeyValueTreeView.py +264 -0
  60. xarray_graph-2026.7.1/src/xarray_graph/tree/TreeView.py +621 -0
  61. xarray_graph-2026.7.1/src/xarray_graph/tree/XarrayDataTreeItem.py +462 -0
  62. xarray_graph-2026.7.1/src/xarray_graph/tree/XarrayDataTreeModel.py +919 -0
  63. xarray_graph-2026.7.1/src/xarray_graph/tree/XarrayDataTreeView.py +674 -0
  64. xarray_graph-2026.7.1/src/xarray_graph/tree/__init__.py +15 -0
  65. xarray_graph-2026.7.1/src/xarray_graph/utils/Annotation.py +71 -0
  66. xarray_graph-2026.7.1/src/xarray_graph/utils/IPythonConsole.py +120 -0
  67. xarray_graph-2026.7.1/src/xarray_graph/utils/WindowManager.py +257 -0
  68. xarray_graph-2026.7.1/src/xarray_graph/utils/__init__.py +3 -0
  69. xarray_graph-2026.7.1/src/xarray_graph/utils/color.py +55 -0
  70. xarray_graph-2026.7.1/src/xarray_graph/utils/xarray_utils.py +355 -0
  71. xarray_graph-2026.7.1/src/xarray_graph/widgets/CollapsibleSectionsSplitter.py +311 -0
  72. xarray_graph-2026.7.1/src/xarray_graph/widgets/ColorButton.py +80 -0
  73. xarray_graph-2026.7.1/src/xarray_graph/widgets/MultiValueSpinBox.py +357 -0
  74. xarray_graph-2026.7.1/src/xarray_graph/widgets/TableWidgetWithCopyPaste.py +68 -0
  75. xarray_graph-2026.7.1/src/xarray_graph/widgets/__init__.py +4 -0
  76. xarray_graph-0.2.5/LICENSE +0 -21
  77. xarray_graph-0.2.5/PKG-INFO +0 -49
  78. xarray_graph-0.2.5/README.md +0 -18
  79. xarray_graph-0.2.5/pyproject.toml +0 -60
  80. xarray_graph-0.2.5/src/xarray_graph/XarrayGraph.py +0 -2299
  81. xarray_graph-0.2.5/src/xarray_graph/__init__.py +0 -1
  82. xarray_graph-0.2.5/src/xarray_graph/__main__.py +0 -76
  83. xarray_graph-0.2.5/src/xarray_graph/tmp/RegionsManager.py +0 -52
  84. {xarray_graph-0.2.5/tests → xarray_graph-2026.7.1/src/xarray_graph}/__init__.py +0 -0
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.3
2
+ Name: xarray-graph
3
+ Version: 2026.7.1
4
+ Summary: PyQt UIs for Xarray DataTree including tree view and DataArray slice graphing and processing.
5
+ Keywords: xarray,DataTree,tree,PyQt,PySide,pyqtgraph,graph,plot,signal processing,n-dimensional
6
+ Author: Marcel Goldschen-Ohm
7
+ Author-email: Marcel Goldschen-Ohm <goldschen-ohm@utexas.edu>
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Requires-Dist: xarray>=2025.3.1
13
+ Requires-Dist: h5netcdf
14
+ Requires-Dist: zarr
15
+ Requires-Dist: scipy
16
+ Requires-Dist: pint
17
+ Requires-Dist: lmfit
18
+ Requires-Dist: qtpy
19
+ Requires-Dist: qtawesome
20
+ Requires-Dist: pyqtgraph
21
+ Requires-Dist: qtconsole
22
+ Requires-Dist: cmap
23
+ Requires-Dist: requests
24
+ Requires-Dist: pint-xarray>=0.5.1
25
+ Requires-Dist: cf-xarray>=0.10.6
26
+ Requires-Dist: cftime
27
+ Requires-Python: >=3.10
28
+ Project-URL: homepage, https://github.com/marcel-goldschen-ohm/xarray-graph
29
+ Project-URL: repository, https://github.com/marcel-goldschen-ohm/xarray-graph
30
+ Project-URL: issues, https://github.com/marcel-goldschen-ohm/xarray-graph/issues
31
+ Description-Content-Type: text/markdown
32
+
33
+ # xarray-graph
34
+ PyQt UIs for Xarray DataTree including tree view and DataArray slice graphing and processing.
35
+
36
+ ![GitHub Tag](https://img.shields.io/github/v/tag/marcel-goldschen-ohm/xarray-graph?cacheSeconds=1)
37
+ ![build-test](https://github.com/marcel-goldschen-ohm/xarray-graph/actions/workflows/build-test.yml/badge.svg)
38
+ ![GitHub Release](https://img.shields.io/github/v/release/marcel-goldschen-ohm/xarray-graph?include_prereleases&cacheSeconds=1)
39
+ ![publish](https://github.com/marcel-goldschen-ohm/xarray-graph/actions/workflows/publish.yml/badge.svg)
40
+
41
+ :construction: YouTube videos for tree and graph apps
42
+
43
+ ## Contents
44
+ - [Install](#install)
45
+ - Apps
46
+ - [XarrayDataTreeViewer](#xarraydatatreeviewer): Tree UI for an Xarray DataTree.
47
+ - [XarrayGraph](#xarraygraph): Graph/Iterate/Fit/Analyze (x,y) slices of DataArrays in an Xarray DataTree.
48
+ - [Using Xarray DataTree model/view components in your own app](#using-xarray-datatree-modelview-components-in-your-own-app)
49
+ - [Support](#support)
50
+
51
+ ## Install
52
+ Requires a PyQt package. Should work with PySide6 (the official Python Qt binding), PyQt6, or PyQt5 via the [QtPy](https://github.com/spyder-ide/qtpy) abstraction layer. *Note: PySide6>=6.2.2 for Apple silicon support, and PySide6!=6.9.1 due to a [bug](https://github.com/pyqtgraph/pyqtgraph/issues/3328) that is incompatible with pyqtgraph.*
53
+
54
+ ### Install with uv (recommended):
55
+ 1. Install the python package manager [uv](https://github.com/astral-sh/uv).
56
+ 2. Download the [xarray-graph GitHub repository](https://github.com/marcel-goldschen-ohm/xarray-graph). <!-- *I suggest downloading the latest release version.* -->
57
+ 3. In the downloaded repo directory, run the following commands (e.g., in a Terminal or shell):
58
+ ```shell
59
+ uv sync
60
+ uv pip install "PySide6>=6.2.2,!=6.9.1"
61
+ ```
62
+
63
+ :warning: Although the `xarray-graph` package is also available via [PyPI](https://pypi.org/project/xarray-graph/), this package is currently NOT up-to-date and should NOT be used at the moment. For now, please use uv to install from the latest repo as instructed above.
64
+
65
+ <!--
66
+ ### Install with pip (optional):
67
+ ---
68
+ Install latest release version:
69
+ ```shell
70
+ pip install --upgrade xarray-graph
71
+ pip install "PySide6>=6.2.2,!=6.9.1"
72
+ ```
73
+ Or install latest development version:
74
+ ```shell
75
+ pip install --upgrade xarray-graph@git+https://github.com/marcel-goldschen-ohm/xarray-graph
76
+ pip install "PySide6>=6.2.2,!=6.9.1"
77
+ ```
78
+ -->
79
+
80
+ [&uarr; top](#xarray-graph)
81
+
82
+ ## XarrayDataTreeViewer
83
+ Tree UI for an Xarray DataTree.
84
+
85
+ :rocket: To **launch the application**, run the following command (e.g., in a Terminal or shell) in the downloaded repo directory:
86
+ ```shell
87
+ uv run xarray-tree
88
+ ```
89
+ :bangbang: *Note: The first time you run the app it may take 30-60 seconds to start due to loading of graphics libraries, so be patient. Subsequent runs should start in only a few seconds.*
90
+
91
+ :construction: YouTube video
92
+
93
+ [&uarr; top](#xarray-graph)
94
+
95
+ ## XarrayGraph
96
+ Graph/Iterate/Fit/Analyze (x,y) slices of DataArrays in an Xarray DataTree.
97
+
98
+ :rocket: To **launch the application**, run the following command (e.g., in a Terminal or shell) in the downloaded repo directory:
99
+ ```shell
100
+ uv run xarray-graph
101
+ ```
102
+ :bangbang: *Note: The first time you run the app it may take 30-60 seconds to start due to loading of graphics libraries, so be patient. Subsequent runs should start in only a few seconds.*
103
+
104
+ :construction: YouTube video
105
+
106
+ [&uarr; top](#xarray-graph)
107
+
108
+ ## Using Xarray DataTree model/view components in your own app
109
+ ```python
110
+ import xarray as xr
111
+ from xarray_graph.tree import XarrayDataTreeModel, XarrayDataTreeView
112
+
113
+ dt = xr.DataTree(...)
114
+
115
+ model = XarrayDataTreeModel()
116
+ model.setDatatree(dt)
117
+
118
+ view = XarrayDataTreeView()
119
+ view.setModel(model)
120
+
121
+ # place view widget in your app as desired
122
+ ```
123
+
124
+ [&uarr; top](#xarray-graph)
125
+
126
+ ## Support
127
+ This is all done in my free time. If you find it useful, why not buy me a cup of coffee? Cheers!
128
+
129
+ <a href="https://www.buymeacoffee.com/marcel.goldschen.ohm" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
130
+
131
+ [&uarr; top](#xarray-graph)
@@ -0,0 +1,99 @@
1
+ # xarray-graph
2
+ PyQt UIs for Xarray DataTree including tree view and DataArray slice graphing and processing.
3
+
4
+ ![GitHub Tag](https://img.shields.io/github/v/tag/marcel-goldschen-ohm/xarray-graph?cacheSeconds=1)
5
+ ![build-test](https://github.com/marcel-goldschen-ohm/xarray-graph/actions/workflows/build-test.yml/badge.svg)
6
+ ![GitHub Release](https://img.shields.io/github/v/release/marcel-goldschen-ohm/xarray-graph?include_prereleases&cacheSeconds=1)
7
+ ![publish](https://github.com/marcel-goldschen-ohm/xarray-graph/actions/workflows/publish.yml/badge.svg)
8
+
9
+ :construction: YouTube videos for tree and graph apps
10
+
11
+ ## Contents
12
+ - [Install](#install)
13
+ - Apps
14
+ - [XarrayDataTreeViewer](#xarraydatatreeviewer): Tree UI for an Xarray DataTree.
15
+ - [XarrayGraph](#xarraygraph): Graph/Iterate/Fit/Analyze (x,y) slices of DataArrays in an Xarray DataTree.
16
+ - [Using Xarray DataTree model/view components in your own app](#using-xarray-datatree-modelview-components-in-your-own-app)
17
+ - [Support](#support)
18
+
19
+ ## Install
20
+ Requires a PyQt package. Should work with PySide6 (the official Python Qt binding), PyQt6, or PyQt5 via the [QtPy](https://github.com/spyder-ide/qtpy) abstraction layer. *Note: PySide6>=6.2.2 for Apple silicon support, and PySide6!=6.9.1 due to a [bug](https://github.com/pyqtgraph/pyqtgraph/issues/3328) that is incompatible with pyqtgraph.*
21
+
22
+ ### Install with uv (recommended):
23
+ 1. Install the python package manager [uv](https://github.com/astral-sh/uv).
24
+ 2. Download the [xarray-graph GitHub repository](https://github.com/marcel-goldschen-ohm/xarray-graph). <!-- *I suggest downloading the latest release version.* -->
25
+ 3. In the downloaded repo directory, run the following commands (e.g., in a Terminal or shell):
26
+ ```shell
27
+ uv sync
28
+ uv pip install "PySide6>=6.2.2,!=6.9.1"
29
+ ```
30
+
31
+ :warning: Although the `xarray-graph` package is also available via [PyPI](https://pypi.org/project/xarray-graph/), this package is currently NOT up-to-date and should NOT be used at the moment. For now, please use uv to install from the latest repo as instructed above.
32
+
33
+ <!--
34
+ ### Install with pip (optional):
35
+ ---
36
+ Install latest release version:
37
+ ```shell
38
+ pip install --upgrade xarray-graph
39
+ pip install "PySide6>=6.2.2,!=6.9.1"
40
+ ```
41
+ Or install latest development version:
42
+ ```shell
43
+ pip install --upgrade xarray-graph@git+https://github.com/marcel-goldschen-ohm/xarray-graph
44
+ pip install "PySide6>=6.2.2,!=6.9.1"
45
+ ```
46
+ -->
47
+
48
+ [&uarr; top](#xarray-graph)
49
+
50
+ ## XarrayDataTreeViewer
51
+ Tree UI for an Xarray DataTree.
52
+
53
+ :rocket: To **launch the application**, run the following command (e.g., in a Terminal or shell) in the downloaded repo directory:
54
+ ```shell
55
+ uv run xarray-tree
56
+ ```
57
+ :bangbang: *Note: The first time you run the app it may take 30-60 seconds to start due to loading of graphics libraries, so be patient. Subsequent runs should start in only a few seconds.*
58
+
59
+ :construction: YouTube video
60
+
61
+ [&uarr; top](#xarray-graph)
62
+
63
+ ## XarrayGraph
64
+ Graph/Iterate/Fit/Analyze (x,y) slices of DataArrays in an Xarray DataTree.
65
+
66
+ :rocket: To **launch the application**, run the following command (e.g., in a Terminal or shell) in the downloaded repo directory:
67
+ ```shell
68
+ uv run xarray-graph
69
+ ```
70
+ :bangbang: *Note: The first time you run the app it may take 30-60 seconds to start due to loading of graphics libraries, so be patient. Subsequent runs should start in only a few seconds.*
71
+
72
+ :construction: YouTube video
73
+
74
+ [&uarr; top](#xarray-graph)
75
+
76
+ ## Using Xarray DataTree model/view components in your own app
77
+ ```python
78
+ import xarray as xr
79
+ from xarray_graph.tree import XarrayDataTreeModel, XarrayDataTreeView
80
+
81
+ dt = xr.DataTree(...)
82
+
83
+ model = XarrayDataTreeModel()
84
+ model.setDatatree(dt)
85
+
86
+ view = XarrayDataTreeView()
87
+ view.setModel(model)
88
+
89
+ # place view widget in your app as desired
90
+ ```
91
+
92
+ [&uarr; top](#xarray-graph)
93
+
94
+ ## Support
95
+ This is all done in my free time. If you find it useful, why not buy me a cup of coffee? Cheers!
96
+
97
+ <a href="https://www.buymeacoffee.com/marcel.goldschen.ohm" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
98
+
99
+ [&uarr; top](#xarray-graph)
@@ -0,0 +1,46 @@
1
+ [project]
2
+ name = "xarray-graph"
3
+ version = "v2026.7.1"
4
+ description = "PyQt UIs for Xarray DataTree including tree view and DataArray slice graphing and processing."
5
+ authors = [
6
+ {name = "Marcel Goldschen-Ohm", email = "goldschen-ohm@utexas.edu"},
7
+ ]
8
+ readme = "README.md"
9
+ keywords = ["xarray", "DataTree", "tree", "PyQt", "PySide", "pyqtgraph", "graph", "plot", "signal processing", "n-dimensional"]
10
+ classifiers = [
11
+ "Development Status :: 3 - Alpha",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python :: 3 :: Only",
15
+ ]
16
+ requires-python = ">=3.10"
17
+ dependencies = [
18
+ "xarray >=2025.3.1",
19
+ "h5netcdf",
20
+ "zarr",
21
+ "scipy",
22
+ "pint",
23
+ "lmfit",
24
+ "QtPy",
25
+ "QtAwesome",
26
+ "pyqtgraph",
27
+ "qtconsole",
28
+ "cmap",
29
+ "requests",
30
+ "pint-xarray>=0.5.1",
31
+ "cf-xarray>=0.10.6",
32
+ "cftime",
33
+ ]
34
+
35
+ [project.urls]
36
+ homepage = "https://github.com/marcel-goldschen-ohm/xarray-graph"
37
+ repository = "https://github.com/marcel-goldschen-ohm/xarray-graph"
38
+ issues = "https://github.com/marcel-goldschen-ohm/xarray-graph/issues"
39
+
40
+ [project.scripts]
41
+ xarray-graph = "xarray_graph.__main__:xgraph"
42
+ xarray-tree = "xarray_graph.__main__:xtree"
43
+
44
+ [build-system]
45
+ requires = ["uv_build"]
46
+ build-backend = "uv_build"
@@ -0,0 +1,85 @@
1
+ from qtpy.QtCore import QSize, QTimer
2
+ from qtpy.QtGui import QPixmap, Qt
3
+ from qtpy.QtWidgets import QApplication, QSplashScreen
4
+ from qtawesome import icon
5
+
6
+
7
+ def show_ui_and_close_splash(ui, splash: QSplashScreen):
8
+ ui.show()
9
+ splash.finish(ui)
10
+
11
+
12
+ def xtree():
13
+ app = QApplication()
14
+ app.setQuitOnLastWindowClosed(False)
15
+
16
+ splash_pix: QPixmap = icon('ph.cube-thin').pixmap(QSize(256, 256))
17
+ splash = QSplashScreen(splash_pix, Qt.WindowType.WindowStaysOnTopHint)
18
+ splash.show()
19
+ splash.showMessage("xarray-tree: Loading system resources...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
20
+ app.processEvents() # Force Qt to paint the splash screen immediately
21
+
22
+ from xarray_graph.apps import XarrayDataTreeViewer
23
+
24
+ ui = XarrayDataTreeViewer.new()
25
+ ui.setWindowTitle('xarray-tree')
26
+ QTimer.singleShot(2000, lambda: show_ui_and_close_splash(ui, splash))
27
+
28
+ show_warnings()
29
+ load_datatree(ui, 'https://raw.githubusercontent.com/marcel-goldschen-ohm/xarray-graph/main/examples/ERPdata.nc', ask=True)
30
+ return app.exec()
31
+
32
+
33
+ def xgraph():
34
+ app = QApplication()
35
+ app.setQuitOnLastWindowClosed(False)
36
+
37
+ splash_pix: QPixmap = icon('ph.cube-thin').pixmap(QSize(256, 256))
38
+ splash = QSplashScreen(splash_pix, Qt.WindowType.WindowStaysOnTopHint)
39
+ splash.show()
40
+ splash.showMessage("xarray-graph: Loading system resources...", Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignCenter, Qt.GlobalColor.white)
41
+ app.processEvents() # Force Qt to paint the splash screen immediately
42
+
43
+ from xarray_graph.apps import XarrayGraph
44
+
45
+ ui = XarrayGraph.new()
46
+ ui.setWindowTitle('xarray-graph')
47
+ QTimer.singleShot(2000, lambda: show_ui_and_close_splash(ui, splash))
48
+
49
+ show_warnings()
50
+ load_datatree(ui, 'https://raw.githubusercontent.com/marcel-goldschen-ohm/xarray-graph/main/examples/ERPdata.nc', ask=True)
51
+ return app.exec()
52
+
53
+
54
+ def show_warnings() -> None:
55
+ import platform
56
+ if platform.system() == 'Darwin':
57
+ from qtpy.QtWidgets import QMessageBox
58
+ QMessageBox.warning(None, 'Magnet Warning', 'If you are using the window management software Magnet, please disable it for this app to work properly.')
59
+
60
+
61
+ def load_datatree(ui, url: str = 'https://raw.githubusercontent.com/marcel-goldschen-ohm/xarray-graph/main/examples/ERPdata.nc', ask: bool = True) -> None:
62
+ import requests, io
63
+ import xarray as xr
64
+ from qtpy.QtWidgets import QMessageBox
65
+ from xarray_graph.apps import XarrayDataTreeViewer # ui: XarrayDataTreeViewer
66
+
67
+ if ask:
68
+ answer = QMessageBox.question(ui, 'Example?', 'Load example data?')
69
+ if (ask == False) or (answer == QMessageBox.StandardButton.Yes):
70
+ try:
71
+ req = requests.get(url, stream=True)
72
+ if req.status_code != 200:
73
+ raise ValueError(f'Failed to download example data: request status code = {req.status_code}')
74
+ dt: xr.DataTree = xr.open_datatree(io.BytesIO(req.content), engine='h5netcdf')
75
+ ui.setDatatree(dt)
76
+ ui._datatree_view.showAll()
77
+ except Exception as err:
78
+ QMessageBox.critical(ui, 'Failed to load example', str(err))
79
+
80
+
81
+ if __name__ == '__main__':
82
+ import sys
83
+ # status = xtree()
84
+ status = xgraph()
85
+ sys.exit(status)