xarray-graph 0.1.2__tar.gz → 0.2.0__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.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xarray-graph
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: PyQt/PySide UI for graphing (x,y) slices of Xarray datasets.
5
- Keywords: PyQt PySide xarray graph
5
+ Keywords: PyQt,PySide,xarray,graph
6
6
  Home-page: https://github.com/marcel-goldschen-ohm/xarray-graph
7
7
  Author-Email: Marcel Goldschen-Ohm <goldschen-ohm@utexas.edu>
8
8
  License: MIT
@@ -30,10 +30,15 @@ Requires-Dist: lmfit>=1.2.2
30
30
  Description-Content-Type: text/markdown
31
31
 
32
32
  # xarray-graph
33
- PyQt/PySide UI for graphing (x,y) slices of xarray datasets.
33
+ PyQt/PySide UI for graphing (x,y) slices of Xarray datasets.
34
+
35
+ # Install
36
+ Should work with PySide6, PyQt6, or PyQt5.
37
+ ```shell
38
+ pip install PySide6 xarray-graph
39
+ ```
34
40
 
35
41
  # TODO
36
- - named regions
37
- - measurements
38
- - curve fits
39
42
  - i/o
43
+ - tests
44
+ - docs
@@ -0,0 +1,13 @@
1
+ # xarray-graph
2
+ PyQt/PySide UI for graphing (x,y) slices of Xarray datasets.
3
+
4
+ # Install
5
+ Should work with PySide6, PyQt6, or PyQt5.
6
+ ```shell
7
+ pip install PySide6 xarray-graph
8
+ ```
9
+
10
+ # TODO
11
+ - i/o
12
+ - tests
13
+ - docs
@@ -35,7 +35,7 @@ classifiers = [
35
35
  "Programming Language :: Python :: 3.12",
36
36
  "Programming Language :: Python :: 3.13",
37
37
  ]
38
- version = "0.1.2"
38
+ version = "0.2.0"
39
39
 
40
40
  [project.license]
41
41
  text = "MIT"
@@ -44,6 +44,9 @@ text = "MIT"
44
44
  homepage = "https://github.com/marcel-goldschen-ohm/xarray-graph"
45
45
  repository = "https://github.com/marcel-goldschen-ohm/xarray-graph"
46
46
 
47
+ [project.scripts]
48
+ xrg = "xarray_graph.__main__:main"
49
+
47
50
  [build-system]
48
51
  requires = [
49
52
  "pdm-backend",
@@ -0,0 +1,52 @@
1
+
2
+
3
+ import numpy as np
4
+ import scipy as sp
5
+ import lmfit
6
+ from qtpy.QtCore import *
7
+ from qtpy.QtGui import *
8
+ from qtpy.QtWidgets import *
9
+ from pyqt_ext import *
10
+ from pyqtgraph_ext import *
11
+
12
+
13
+ class AxisRegionsManager():
14
+
15
+ def __init__(self):
16
+ self.regions: list[dict] = []
17
+ self.plots: list[Plot] = []
18
+
19
+ def update_plots_from_regions(self):
20
+ for plot in self.plots:
21
+ view: View = plot.getViewBox()
22
+ items: list[XAxisRegion] = [item for item in view.allChildren() if isinstance(item, XAxisRegion)]
23
+
24
+ for item in view.allChildren():
25
+ if isinstance(item, XAxisRegion):
26
+ view.removeItem(item)
27
+ for region in self.regions:
28
+ self.add_region(region)
29
+
30
+ def add_region(self, region: dict) -> None:
31
+ if region not in self.regions:
32
+ self.regions.append(region)
33
+ for plot in self.plots:
34
+ view: View = plot.getViewBox()
35
+ item = XAxisRegion(region.get('region', [0, 0]))
36
+ item.setText(region.get('text', ''))
37
+ item.setLabel(region.get('label', ''))
38
+ item.setIsMovable(region.get('moveable', True))
39
+ region['color'] = toColorStr(item.brush.color())
40
+ region['line_color'] = toColorStr(item.pen.color())
41
+ item._data = region
42
+ view.addItem(item)
43
+ item.setFontSize(self._textitem_fontsize_spinbox.value())
44
+ # editing the region text via the popup dialog will also reset the region,
45
+ # so this will cover changes to text and label region properties too
46
+ item.sigRegionChangeFinished.connect(self._on_region_item_changed)
47
+
48
+ def update_item(self, item: XAxisRegion):
49
+ pass
50
+
51
+ def update_region_from_item(self, item: XAxisRegion):
52
+ pass