pymodaq_data 5.0.5__tar.gz → 5.0.7__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.
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/PKG-INFO +1 -1
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/_version.py +2 -2
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/data.py +106 -13
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/plotting/plotter/plotter.py +4 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/.gitignore +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/LICENSE +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/README.rst +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/pyproject.toml +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/__init__.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/__init__.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/backends.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/browsing.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/data_saving.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/exporter.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/exporters/__init__.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/exporters/base.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/exporters/flimj.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/exporters/hyperspy.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/saving.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/h5modules/utils.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/icon.ico +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/numpy_func.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/plotting/__init__.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/plotting/plotter/plotters/__init__.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/plotting/plotter/plotters/matplotlib_plotters.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/post_treatment/__init__.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/post_treatment/process_to_scalar.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/slicing.py +0 -0
- {pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/splash.png +0 -0
|
@@ -101,6 +101,7 @@ class DataUnitError(Exception):
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
class DwaType(BaseEnum):
|
|
104
|
+
"""Different types of `DataWithAxes`."""
|
|
104
105
|
DataWithAxes = 0
|
|
105
106
|
DataRaw = 1
|
|
106
107
|
DataActuator = 2
|
|
@@ -774,6 +775,13 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
|
|
|
774
775
|
""" Change immediately the units to whatever else. Use this with care!"""
|
|
775
776
|
self._units = units
|
|
776
777
|
|
|
778
|
+
def to_base_units(self):
|
|
779
|
+
dwa = self.deepcopy()
|
|
780
|
+
data_quantities = [quantity.to_base_units() for quantity in self.quantities]
|
|
781
|
+
dwa.data = [quantity.magnitude for quantity in data_quantities]
|
|
782
|
+
dwa.force_units(str(data_quantities[0].units))
|
|
783
|
+
return dwa
|
|
784
|
+
|
|
777
785
|
def value(self, units: str = None) -> float:
|
|
778
786
|
"""Returns the underlying float value (of the first elt in the data list) if this data
|
|
779
787
|
holds only a float otherwise returns a mean of the underlying data
|
|
@@ -905,7 +913,7 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
|
|
|
905
913
|
|
|
906
914
|
def _comparison_common(self, other, operator='__eq__'):
|
|
907
915
|
if isinstance(other, DataBase):
|
|
908
|
-
if not (# no more checking for name equality
|
|
916
|
+
if not (# no more checking for name equality but take care ot the pop/remove methods
|
|
909
917
|
len(self) == len(other) and
|
|
910
918
|
Unit(self.units).is_compatible_with(other.units)):
|
|
911
919
|
return False
|
|
@@ -1790,7 +1798,13 @@ class DataWithAxes(DataBase):
|
|
|
1790
1798
|
should match the data ndarray
|
|
1791
1799
|
"""
|
|
1792
1800
|
|
|
1793
|
-
def __init__(self,
|
|
1801
|
+
def __init__(self, name: str,
|
|
1802
|
+
source: DataSource = None, dim: DataDim = None,
|
|
1803
|
+
distribution: DataDistribution = DataDistribution.uniform,
|
|
1804
|
+
data: List[np.ndarray] = None,
|
|
1805
|
+
labels: List[str] = None, origin: str = '',
|
|
1806
|
+
units: str = '',
|
|
1807
|
+
axes: List[Axis] = [],
|
|
1794
1808
|
nav_indexes: Tuple[int] = (),
|
|
1795
1809
|
errors: Iterable[np.ndarray] = None,
|
|
1796
1810
|
**kwargs):
|
|
@@ -1805,7 +1819,13 @@ class DataWithAxes(DataBase):
|
|
|
1805
1819
|
nav_x_axis = kwargs.pop('nav_x_axis') if 'nav_x_axis' in kwargs else None
|
|
1806
1820
|
nav_y_axis = kwargs.pop('nav_y_axis') if 'nav_y_axis' in kwargs else None
|
|
1807
1821
|
|
|
1808
|
-
super().__init__(
|
|
1822
|
+
super().__init__(name, source=source, dim=dim,
|
|
1823
|
+
distribution=distribution,
|
|
1824
|
+
data=data,
|
|
1825
|
+
labels=labels,
|
|
1826
|
+
origin=origin,
|
|
1827
|
+
units=units,
|
|
1828
|
+
**kwargs)
|
|
1809
1829
|
|
|
1810
1830
|
self._axes = axes
|
|
1811
1831
|
|
|
@@ -1918,7 +1938,7 @@ class DataWithAxes(DataBase):
|
|
|
1918
1938
|
is_equal = super().__eq__(other)
|
|
1919
1939
|
if not is_equal:
|
|
1920
1940
|
return is_equal
|
|
1921
|
-
if isinstance(other,
|
|
1941
|
+
if isinstance(other, self.__class__):
|
|
1922
1942
|
for ind in list(self.nav_indexes) + list(self.sig_indexes):
|
|
1923
1943
|
axes_self = self.get_axis_from_index(ind)
|
|
1924
1944
|
axes_other = other.get_axis_from_index(ind)
|
|
@@ -2594,24 +2614,87 @@ class DataWithAxes(DataBase):
|
|
|
2594
2614
|
|
|
2595
2615
|
class DataRaw(DataWithAxes):
|
|
2596
2616
|
"""Specialized DataWithAxes set with source as 'raw'. To be used for raw data"""
|
|
2597
|
-
def __init__(self,
|
|
2617
|
+
def __init__(self, name: str,
|
|
2618
|
+
dim: DataDim = None,
|
|
2619
|
+
distribution: DataDistribution = DataDistribution.uniform,
|
|
2620
|
+
data: List[np.ndarray] = None,
|
|
2621
|
+
labels: List[str] = None, origin: str = '',
|
|
2622
|
+
units: str = '',
|
|
2623
|
+
axes: List[Axis] = [],
|
|
2624
|
+
nav_indexes: Tuple[int] = (),
|
|
2625
|
+
errors: Iterable[np.ndarray] = None,
|
|
2626
|
+
**kwargs):
|
|
2598
2627
|
if 'source' in kwargs:
|
|
2599
2628
|
kwargs.pop('source')
|
|
2600
|
-
|
|
2629
|
+
|
|
2630
|
+
super().__init__(name, source=DataSource.raw,
|
|
2631
|
+
dim=dim,
|
|
2632
|
+
distribution=distribution,
|
|
2633
|
+
data=data,
|
|
2634
|
+
labels=labels,
|
|
2635
|
+
origin=origin,
|
|
2636
|
+
units=units,
|
|
2637
|
+
axes=axes,
|
|
2638
|
+
nav_indexes=nav_indexes,
|
|
2639
|
+
errors=errors,
|
|
2640
|
+
**kwargs
|
|
2641
|
+
)
|
|
2601
2642
|
|
|
2602
2643
|
|
|
2603
2644
|
class DataCalculated(DataWithAxes):
|
|
2604
|
-
"""Specialized DataWithAxes set with source as 'calculated'. To be used for
|
|
2605
|
-
|
|
2645
|
+
"""Specialized DataWithAxes set with source as 'calculated'. To be used for
|
|
2646
|
+
processed/calculated data"""
|
|
2647
|
+
def __init__(self, name: str,
|
|
2648
|
+
dim: DataDim = None,
|
|
2649
|
+
distribution: DataDistribution = DataDistribution.uniform,
|
|
2650
|
+
data: List[np.ndarray] = None,
|
|
2651
|
+
labels: List[str] = None, origin: str = '',
|
|
2652
|
+
units: str = '',
|
|
2653
|
+
axes: List[Axis] = [],
|
|
2654
|
+
nav_indexes: Tuple[int] = (),
|
|
2655
|
+
errors: Iterable[np.ndarray] = None,
|
|
2656
|
+
**kwargs):
|
|
2657
|
+
|
|
2606
2658
|
if 'source' in kwargs:
|
|
2607
2659
|
kwargs.pop('source')
|
|
2608
|
-
super().__init__(
|
|
2660
|
+
super().__init__(name, source=DataSource.calculated,
|
|
2661
|
+
dim=dim,
|
|
2662
|
+
distribution=distribution,
|
|
2663
|
+
data=data,
|
|
2664
|
+
labels=labels,
|
|
2665
|
+
origin=origin,
|
|
2666
|
+
units=units,
|
|
2667
|
+
axes=axes,
|
|
2668
|
+
nav_indexes=nav_indexes,
|
|
2669
|
+
errors=errors,
|
|
2670
|
+
**kwargs)
|
|
2609
2671
|
|
|
2610
2672
|
|
|
2611
2673
|
class DataFromRoi(DataCalculated):
|
|
2612
|
-
"""Specialized DataWithAxes set with source as 'calculated'.
|
|
2613
|
-
|
|
2614
|
-
|
|
2674
|
+
"""Specialized DataWithAxes set with source as 'calculated'.
|
|
2675
|
+
To be used for processed data from region of interest"""
|
|
2676
|
+
def __init__(self, name: str,
|
|
2677
|
+
dim: DataDim = None,
|
|
2678
|
+
distribution: DataDistribution = DataDistribution.uniform,
|
|
2679
|
+
data: List[np.ndarray] = None,
|
|
2680
|
+
labels: List[str] = None, origin: str = '',
|
|
2681
|
+
units: str = '',
|
|
2682
|
+
axes: List[Axis] = [],
|
|
2683
|
+
nav_indexes: Tuple[int] = (),
|
|
2684
|
+
errors: Iterable[np.ndarray] = None,
|
|
2685
|
+
**kwargs):
|
|
2686
|
+
|
|
2687
|
+
super().__init__(name, source=DataSource.calculated,
|
|
2688
|
+
dim=dim,
|
|
2689
|
+
distribution=distribution,
|
|
2690
|
+
data=data,
|
|
2691
|
+
labels=labels,
|
|
2692
|
+
origin=origin,
|
|
2693
|
+
units=units,
|
|
2694
|
+
axes=axes,
|
|
2695
|
+
nav_indexes=nav_indexes,
|
|
2696
|
+
errors=errors,
|
|
2697
|
+
**kwargs)
|
|
2615
2698
|
|
|
2616
2699
|
|
|
2617
2700
|
class DataToExport(DataLowLevel):
|
|
@@ -3041,7 +3124,17 @@ class DataToExport(DataLowLevel):
|
|
|
3041
3124
|
return self.data.pop(index)
|
|
3042
3125
|
|
|
3043
3126
|
def remove(self, dwa: DataWithAxes):
|
|
3044
|
-
|
|
3127
|
+
""" Use the DataWithAxes object comparison __eq__ to retrieve the elt to remove
|
|
3128
|
+
|
|
3129
|
+
If strict is True will also check for the real type and name of the object
|
|
3130
|
+
|
|
3131
|
+
Parameters
|
|
3132
|
+
----------
|
|
3133
|
+
"""
|
|
3134
|
+
for dwa_tmp in self:
|
|
3135
|
+
if dwa_tmp == dwa and dwa_tmp.name == dwa.name:
|
|
3136
|
+
return dwa_tmp
|
|
3137
|
+
raise ValueError()
|
|
3045
3138
|
|
|
3046
3139
|
@property
|
|
3047
3140
|
def data(self) -> List[DataWithAxes]:
|
|
@@ -54,6 +54,10 @@ class PlotterBase(metaclass=ABCMeta):
|
|
|
54
54
|
class PlotterFactory(ObjectFactory):
|
|
55
55
|
"""Factory class registering and storing interactive plotter"""
|
|
56
56
|
|
|
57
|
+
def __init__(self):
|
|
58
|
+
if PlotterFactory.__name__ not in PlotterFactory._builders:
|
|
59
|
+
PlotterFactory._builders[PlotterFactory.__name__] = {}
|
|
60
|
+
|
|
57
61
|
@classmethod
|
|
58
62
|
def register(cls) -> Callable:
|
|
59
63
|
""" To be used as a decorator
|
|
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
|
{pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/plotting/plotter/plotters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymodaq_data-5.0.5 → pymodaq_data-5.0.7}/src/pymodaq_data/post_treatment/process_to_scalar.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|