pymodaq_data 5.0.24__tar.gz → 5.0.26__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 (29) hide show
  1. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/PKG-INFO +1 -1
  2. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/_version.py +16 -3
  3. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/data.py +23 -8
  4. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/exporter.py +10 -15
  5. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/saving.py +1 -1
  6. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/.gitignore +0 -0
  7. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/LICENSE +0 -0
  8. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/README.rst +0 -0
  9. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/pyproject.toml +0 -0
  10. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/__init__.py +0 -0
  11. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/__init__.py +0 -0
  12. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/backends.py +0 -0
  13. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/browsing.py +0 -0
  14. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/data_saving.py +0 -0
  15. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/exporters/__init__.py +0 -0
  16. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/exporters/base.py +0 -0
  17. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/exporters/flimj.py +0 -0
  18. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/exporters/hyperspy.py +0 -0
  19. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/h5modules/utils.py +0 -0
  20. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/icon.ico +0 -0
  21. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/numpy_func.py +0 -0
  22. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/plotting/__init__.py +0 -0
  23. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/plotting/plotter/plotter.py +0 -0
  24. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/plotting/plotter/plotters/__init__.py +0 -0
  25. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/plotting/plotter/plotters/matplotlib_plotters.py +0 -0
  26. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/post_treatment/__init__.py +0 -0
  27. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/post_treatment/process_to_scalar.py +0 -0
  28. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/slicing.py +0 -0
  29. {pymodaq_data-5.0.24 → pymodaq_data-5.0.26}/src/pymodaq_data/splash.png +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymodaq_data
3
- Version: 5.0.24
3
+ Version: 5.0.26
4
4
  Summary: Modular Data Acquisition with Python
5
5
  Project-URL: Homepage, http://pymodaq.cnrs.fr
6
6
  Project-URL: Source, https://github.com/PyMoDAQ/pymodaq_data
@@ -1,7 +1,14 @@
1
1
  # file generated by setuptools-scm
2
2
  # don't change, don't track in version control
3
3
 
4
- __all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
4
+ __all__ = [
5
+ "__version__",
6
+ "__version_tuple__",
7
+ "version",
8
+ "version_tuple",
9
+ "__commit_id__",
10
+ "commit_id",
11
+ ]
5
12
 
6
13
  TYPE_CHECKING = False
7
14
  if TYPE_CHECKING:
@@ -9,13 +16,19 @@ if TYPE_CHECKING:
9
16
  from typing import Union
10
17
 
11
18
  VERSION_TUPLE = Tuple[Union[int, str], ...]
19
+ COMMIT_ID = Union[str, None]
12
20
  else:
13
21
  VERSION_TUPLE = object
22
+ COMMIT_ID = object
14
23
 
15
24
  version: str
16
25
  __version__: str
17
26
  __version_tuple__: VERSION_TUPLE
18
27
  version_tuple: VERSION_TUPLE
28
+ commit_id: COMMIT_ID
29
+ __commit_id__: COMMIT_ID
19
30
 
20
- __version__ = version = '5.0.24'
21
- __version_tuple__ = version_tuple = (5, 0, 24)
31
+ __version__ = version = '5.0.26'
32
+ __version_tuple__ = version_tuple = (5, 0, 26)
33
+
34
+ __commit_id__ = commit_id = None
@@ -3210,7 +3210,7 @@ class DataToExport(DataLowLevel, SerializableBase):
3210
3210
 
3211
3211
  return dims
3212
3212
 
3213
- def get_data_from_source(self, source: DataSource, deepcopy=False) -> DataToExport:
3213
+ def get_data_from_source(self, source: DataSource, deepcopy=False, sort_by_name=False) -> DataToExport:
3214
3214
  """Get the data matching the given DataSource
3215
3215
 
3216
3216
  Returns
@@ -3218,7 +3218,7 @@ class DataToExport(DataLowLevel, SerializableBase):
3218
3218
  DataToExport: filtered with data matching the dimensionality
3219
3219
  """
3220
3220
  source = enum_checker(DataSource, source)
3221
- return self.get_data_from_attribute('source', source, deepcopy=deepcopy)
3221
+ return self.get_data_from_attribute('source', source, deepcopy=deepcopy, sort_by_name=sort_by_name)
3222
3222
 
3223
3223
  def get_data_from_missing_attribute(self, attribute: str, deepcopy=False) -> DataToExport:
3224
3224
  """ Get the data matching a given attribute value
@@ -3238,23 +3238,38 @@ class DataToExport(DataLowLevel, SerializableBase):
3238
3238
  else:
3239
3239
  return DataToExport(self.name, data=[dwa for dwa in self if not hasattr(dwa, attribute)])
3240
3240
 
3241
- def get_data_from_attribute(self, attribute: str, attribute_value: Any, deepcopy=False) -> DataToExport:
3241
+ def get_data_from_attribute(self, attribute: str,
3242
+ attribute_value: Any,
3243
+ deepcopy=False,
3244
+ sort_by_name=False) -> DataToExport:
3242
3245
  """Get the data matching a given attribute value
3243
3246
 
3247
+ Parameters
3248
+ ----------
3249
+ attribute: str
3250
+ The name of the attribute to sort data with
3251
+ attribute_value: Any
3252
+ The value of the attribute
3253
+ deepcopy: bool
3254
+ If True, the returned data are deepcopied from the original
3255
+ sort_by_name: bool
3256
+ If True the returned data are sorted alphabetically using their name, default is False
3257
+
3244
3258
  Returns
3245
3259
  -------
3246
3260
  DataToExport: filtered with data matching the attribute presence and value
3247
3261
  """
3248
3262
  selection = find_objects_in_list_from_attr_name_val(self.data, attribute, attribute_value,
3249
3263
  return_first=False)
3250
- selection.sort(key=lambda elt: elt[0].name)
3264
+ if sort_by_name:
3265
+ selection.sort(key=lambda elt: elt[0].name)
3251
3266
  if deepcopy:
3252
3267
  data = [sel[0].deepcopy() for sel in selection]
3253
3268
  else:
3254
3269
  data = [sel[0] for sel in selection]
3255
3270
  return DataToExport(name=self.name, data=data)
3256
3271
 
3257
- def get_data_from_dim(self, dim: DataDim, deepcopy=False) -> DataToExport:
3272
+ def get_data_from_dim(self, dim: DataDim, deepcopy=False, sort_by_name=False) -> DataToExport:
3258
3273
  """Get the data matching the given DataDim
3259
3274
 
3260
3275
  Returns
@@ -3262,9 +3277,9 @@ class DataToExport(DataLowLevel, SerializableBase):
3262
3277
  DataToExport: filtered with data matching the dimensionality
3263
3278
  """
3264
3279
  dim = enum_checker(DataDim, dim)
3265
- return self.get_data_from_attribute('dim', dim, deepcopy=deepcopy)
3280
+ return self.get_data_from_attribute('dim', dim, deepcopy=deepcopy, sort_by_name=sort_by_name)
3266
3281
 
3267
- def get_data_from_dims(self, dims: List[DataDim], deepcopy=False) -> DataToExport:
3282
+ def get_data_from_dims(self, dims: List[DataDim], deepcopy=False, sort_by_name=False) -> DataToExport:
3268
3283
  """Get the data matching the given DataDim
3269
3284
 
3270
3285
  Returns
@@ -3273,7 +3288,7 @@ class DataToExport(DataLowLevel, SerializableBase):
3273
3288
  """
3274
3289
  data = DataToExport(name=self.name)
3275
3290
  for dim in dims:
3276
- data.append(self.get_data_from_dim(dim, deepcopy=deepcopy))
3291
+ data.append(self.get_data_from_dim(dim, deepcopy=deepcopy, sort_by_name=sort_by_name))
3277
3292
  return data
3278
3293
 
3279
3294
  def get_data_from_sig_axes(self, Naxes: int, deepcopy: bool = False) -> DataToExport:
@@ -18,24 +18,14 @@ from pymodaq_utils.logger import set_logger, get_module_name
18
18
  logger = set_logger(get_module_name(__file__))
19
19
 
20
20
 
21
- class H5Exporter(metaclass=ABCMeta):
22
- """Base class for an exporter. """
23
21
 
24
- # This is to define an abstract class attribute
25
- @classmethod
26
- @property
27
- @abstractmethod
28
- def FORMAT_DESCRIPTION(cls):
29
- """str: file format description as a short text. eg: text file"""
30
- raise NotImplementedError
31
22
 
32
- @classmethod
33
- @property
34
- @abstractmethod
35
- def FORMAT_EXTENSION(cls):
36
- """str: File format extension. eg: txt"""
37
- raise NotImplementedError
23
+ class H5Exporter(metaclass=ABCMeta):
24
+ """Base class for an exporter. """
38
25
 
26
+ FORMAT_EXTENSION: str = NotImplemented
27
+ FORMAT_DESCRIPTION: str = NotImplemented
28
+
39
29
  def __init__(self):
40
30
  """Abstract Exporter Constructor"""
41
31
  pass
@@ -63,6 +53,11 @@ class ExporterFactory:
63
53
  """
64
54
 
65
55
  def inner_wrapper(wrapped_class) -> Callable:
56
+ if wrapped_class.FORMAT_EXTENSION is NotImplemented or \
57
+ wrapped_class.FORMAT_DESCRIPTION is NotImplemented:
58
+ raise NotImplementedError(f'{wrapped_class} does not properly provide a valid value for '
59
+ f'`FORMAT_EXTENSION` ({wrapped_class.FORMAT_EXTENSION}) or for '
60
+ f'`FORMAT_DESCRIPTION` ({wrapped_class.FORMAT_DESCRIPTION})')
66
61
  extension = wrapped_class.FORMAT_EXTENSION
67
62
  format_desc = wrapped_class.FORMAT_DESCRIPTION
68
63
 
@@ -227,7 +227,7 @@ class H5SaverLowLevel(H5Backend):
227
227
  """
228
228
  if array_type is None:
229
229
  if array_to_save is None:
230
- array_type = config('data_saving', 'data_type', 'dynamic')
230
+ array_type = config('data_saving', 'data_type', 'dynamics')[0]
231
231
  else:
232
232
  array_type = array_to_save.dtype
233
233
 
File without changes
File without changes
File without changes