pymodaq_data 5.0.1__tar.gz → 5.0.3__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.1 → pymodaq_data-5.0.3}/PKG-INFO +1 -1
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/_version.py +2 -2
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/data.py +33 -9
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/data_saving.py +1 -1
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/saving.py +4 -1
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/plotting/plotter/plotter.py +1 -1
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/.gitignore +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/LICENSE +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/README.rst +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/pyproject.toml +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/__init__.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/__init__.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/backends.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/browsing.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/exporter.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/exporters/__init__.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/exporters/base.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/exporters/flimj.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/exporters/hyperspy.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/h5modules/utils.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/icon.ico +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/numpy_func.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/plotting/__init__.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/plotting/plotter/plotters/__init__.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/plotting/plotter/plotters/matplotlib_plotters.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/post_treatment/__init__.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/post_treatment/process_to_scalar.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/slicing.py +0 -0
- {pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/splash.png +0 -0
|
@@ -585,7 +585,7 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
|
|
|
585
585
|
>>> import numpy as np
|
|
586
586
|
>>> from pymodaq.utils.data import DataBase, DataSource, DataDim, DataDistribution
|
|
587
587
|
>>> data = DataBase('mydata', source=DataSource['raw'], dim=DataDim['Data1D'], \
|
|
588
|
-
distribution=DataDistribution
|
|
588
|
+
distribution=DataDistribution.uniform, data=[np.array([1.,2.,3.]), np.array([4.,5.,6.])],\
|
|
589
589
|
labels=['channel1', 'channel2'], origin='docutils code')
|
|
590
590
|
>>> data.dim
|
|
591
591
|
<DataDim.Data1D: 1>
|
|
@@ -603,7 +603,7 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
|
|
|
603
603
|
|
|
604
604
|
def __init__(self, name: str,
|
|
605
605
|
source: DataSource = None, dim: DataDim = None,
|
|
606
|
-
distribution: DataDistribution = DataDistribution
|
|
606
|
+
distribution: DataDistribution = DataDistribution.uniform,
|
|
607
607
|
data: List[np.ndarray] = None,
|
|
608
608
|
labels: List[str] = None, origin: str = '',
|
|
609
609
|
units: str = '',
|
|
@@ -765,7 +765,7 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
|
|
|
765
765
|
|
|
766
766
|
def _comparison_common(self, other, operator='__eq__'):
|
|
767
767
|
if isinstance(other, DataBase):
|
|
768
|
-
if not (#
|
|
768
|
+
if not (# no more checking for name equality
|
|
769
769
|
len(self) == len(other) and
|
|
770
770
|
Unit(self.units).is_compatible_with(other.units)):
|
|
771
771
|
return False
|
|
@@ -1668,6 +1668,19 @@ class DataWithAxes(DataBase):
|
|
|
1668
1668
|
#then use get_dim_from axes
|
|
1669
1669
|
self._check_errors(errors)
|
|
1670
1670
|
|
|
1671
|
+
def check_axes_linear(self, axes: List[Axis] = None) -> bool:
|
|
1672
|
+
""" Check if any axis may be non linear
|
|
1673
|
+
|
|
1674
|
+
Should trigger a spread like distribution except id dim is Data1D, in which cas, it doesn't
|
|
1675
|
+
matter
|
|
1676
|
+
"""
|
|
1677
|
+
if axes is None:
|
|
1678
|
+
axes = self._axes
|
|
1679
|
+
are_axes_linear = True
|
|
1680
|
+
for axis in axes:
|
|
1681
|
+
are_axes_linear = are_axes_linear and axis.is_axis_linear()
|
|
1682
|
+
return are_axes_linear
|
|
1683
|
+
|
|
1671
1684
|
def _check_errors(self, errors: Iterable[np.ndarray]):
|
|
1672
1685
|
""" Make sure the errors object is adapted to the len/shape of the dwa object
|
|
1673
1686
|
|
|
@@ -1734,12 +1747,12 @@ class DataWithAxes(DataBase):
|
|
|
1734
1747
|
return plotter_factory.get(plotter_backend).plot(self, *args, viewer=viewer, **kwargs)
|
|
1735
1748
|
|
|
1736
1749
|
def set_axes_manager(self, data_shape, axes, nav_indexes, **kwargs):
|
|
1737
|
-
if self.distribution.name ==
|
|
1738
|
-
self._distribution = DataDistribution
|
|
1750
|
+
if self.distribution.name == DataDistribution.uniform.name or len(nav_indexes) == 0:
|
|
1751
|
+
self._distribution = DataDistribution.uniform
|
|
1739
1752
|
self.axes_manager = AxesManagerUniform(data_shape=data_shape, axes=axes,
|
|
1740
1753
|
nav_indexes=nav_indexes,
|
|
1741
1754
|
**kwargs)
|
|
1742
|
-
elif self.distribution.name ==
|
|
1755
|
+
elif self.distribution.name == DataDistribution.spread.name:
|
|
1743
1756
|
self.axes_manager = AxesManagerSpread(data_shape=data_shape, axes=axes,
|
|
1744
1757
|
nav_indexes=nav_indexes,
|
|
1745
1758
|
**kwargs)
|
|
@@ -2050,6 +2063,7 @@ class DataWithAxes(DataBase):
|
|
|
2050
2063
|
self._dim = DataDim['DataND']
|
|
2051
2064
|
return self._dim
|
|
2052
2065
|
|
|
2066
|
+
|
|
2053
2067
|
@property
|
|
2054
2068
|
def n_axes(self):
|
|
2055
2069
|
"""Get the number of axes (even if not specified)"""
|
|
@@ -2064,6 +2078,7 @@ class DataWithAxes(DataBase):
|
|
|
2064
2078
|
def axes(self, axes: List[Axis]):
|
|
2065
2079
|
"""convenience property to set attribute from axis_manager"""
|
|
2066
2080
|
self.set_axes_manager(self.shape, axes=axes, nav_indexes=self.nav_indexes)
|
|
2081
|
+
self._axes = axes
|
|
2067
2082
|
|
|
2068
2083
|
def axes_limits(self, axes_indexes: List[int] = None) -> List[Tuple[float, float]]:
|
|
2069
2084
|
"""Get the limits of specified axes (all if axes_indexes is None)"""
|
|
@@ -2243,7 +2258,7 @@ class DataWithAxes(DataBase):
|
|
|
2243
2258
|
if len(nav_indexes) != 0:
|
|
2244
2259
|
distribution = self.distribution
|
|
2245
2260
|
else:
|
|
2246
|
-
distribution = DataDistribution
|
|
2261
|
+
distribution = DataDistribution.uniform
|
|
2247
2262
|
|
|
2248
2263
|
data = DataWithAxes(self.name, data=new_arrays_data, nav_indexes=tuple(nav_indexes),
|
|
2249
2264
|
axes=axes,
|
|
@@ -2759,7 +2774,15 @@ class DataToExport(DataLowLevel):
|
|
|
2759
2774
|
return data
|
|
2760
2775
|
|
|
2761
2776
|
def index(self, data: DataWithAxes):
|
|
2762
|
-
|
|
2777
|
+
""" Here use a comparison to assert data is equal to one element in the list
|
|
2778
|
+
|
|
2779
|
+
But the __eq__ method is not checking the name while it is the main issue for elt finding
|
|
2780
|
+
Hence here I'm doing both checks
|
|
2781
|
+
"""
|
|
2782
|
+
for ind, dwa in enumerate(self.data):
|
|
2783
|
+
if dwa.name == data.name and dwa == data:
|
|
2784
|
+
return ind
|
|
2785
|
+
raise ValueError
|
|
2763
2786
|
|
|
2764
2787
|
def index_from_name_origin(self, name: str, origin: str = '') -> List[DataWithAxes]:
|
|
2765
2788
|
"""Get the index of a given DataWithAxes within the list of data"""
|
|
@@ -2823,7 +2846,8 @@ class DataToExport(DataLowLevel):
|
|
|
2823
2846
|
def append(self, dwa: DataWithAxes):
|
|
2824
2847
|
"""Append/replace DataWithAxes object to the data attribute
|
|
2825
2848
|
|
|
2826
|
-
Make sure only one DataWithAxes object with a given name is in the list except if they don't
|
|
2849
|
+
Make sure only one DataWithAxes object with a given name is in the list except if they don't
|
|
2850
|
+
have the same
|
|
2827
2851
|
origin identifier
|
|
2828
2852
|
"""
|
|
2829
2853
|
dwa = dwa.deepcopy()
|
|
@@ -1001,7 +1001,7 @@ class DataLoader:
|
|
|
1001
1001
|
|
|
1002
1002
|
if isinstance(h5saver, Path) or isinstance(h5saver, str):
|
|
1003
1003
|
h5saver_tmp = H5SaverLowLevel()
|
|
1004
|
-
h5saver_tmp.init_file(
|
|
1004
|
+
h5saver_tmp.init_file(file_name=Path(h5saver))
|
|
1005
1005
|
h5saver = h5saver_tmp
|
|
1006
1006
|
|
|
1007
1007
|
self.h5saver = h5saver
|
|
@@ -89,7 +89,8 @@ class H5SaverLowLevel(H5Backend):
|
|
|
89
89
|
def h5_file(self):
|
|
90
90
|
return self._h5file
|
|
91
91
|
|
|
92
|
-
def init_file(self, file_name: Path, raw_group_name='RawData', new_file=False,
|
|
92
|
+
def init_file(self, file_name: Path, raw_group_name='RawData', new_file=False,
|
|
93
|
+
metadata: dict = None):
|
|
93
94
|
"""Initializes a new h5 file.
|
|
94
95
|
|
|
95
96
|
Parameters
|
|
@@ -100,6 +101,8 @@ class H5SaverLowLevel(H5Backend):
|
|
|
100
101
|
Base node name
|
|
101
102
|
new_file: bool
|
|
102
103
|
If True create a new file, otherwise append to a potential existing one
|
|
104
|
+
metadata: dict
|
|
105
|
+
A dictionary to be saved as attributes
|
|
103
106
|
|
|
104
107
|
Returns
|
|
105
108
|
-------
|
|
@@ -18,7 +18,7 @@ from pymodaq_utils.factory import ObjectFactory
|
|
|
18
18
|
logger = set_logger(get_module_name(__file__))
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def register_plotter(parent_module_name: str = '
|
|
21
|
+
def register_plotter(parent_module_name: str = 'pymodaq_data.plotting.plotter'):
|
|
22
22
|
plotters = []
|
|
23
23
|
try:
|
|
24
24
|
plotter_module = import_module(f'{parent_module_name}.plotters')
|
|
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.1 → pymodaq_data-5.0.3}/src/pymodaq_data/plotting/plotter/plotters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pymodaq_data-5.0.1 → pymodaq_data-5.0.3}/src/pymodaq_data/post_treatment/process_to_scalar.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|