xarray-graph 0.1.2__py3-none-any.whl → 0.2.0__py3-none-any.whl
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/RegionsManager.py +52 -0
- xarray_graph/XarrayGraph.py +1824 -1331
- xarray_graph/__main__.py +14 -0
- {xarray_graph-0.1.2.dist-info → xarray_graph-0.2.0.dist-info}/METADATA +11 -6
- xarray_graph-0.2.0.dist-info/RECORD +9 -0
- {xarray_graph-0.1.2.dist-info → xarray_graph-0.2.0.dist-info}/WHEEL +1 -1
- xarray_graph-0.2.0.dist-info/entry_points.txt +3 -0
- xarray_graph/xarray-graph.code-workspace +0 -20
- xarray_graph-0.1.2.dist-info/RECORD +0 -7
- {xarray_graph-0.1.2.dist-info → xarray_graph-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -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
|