pymodaq_data 5.2.5__tar.gz → 5.2.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.
Files changed (33) hide show
  1. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/PKG-INFO +1 -1
  2. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/data.py +51 -2
  3. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/.gitignore +0 -0
  4. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/LICENSE +0 -0
  5. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/README.rst +0 -0
  6. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/pyproject.toml +0 -0
  7. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/__init__.py +0 -0
  8. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/config.py +0 -0
  9. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/__init__.py +0 -0
  10. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/backends.py +0 -0
  11. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/browsing.py +0 -0
  12. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/data_saving.py +0 -0
  13. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/exporter.py +0 -0
  14. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/exporters/__init__.py +0 -0
  15. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/exporters/base.py +0 -0
  16. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/exporters/flimj.py +0 -0
  17. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/exporters/hyperspy.py +0 -0
  18. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/saving.py +0 -0
  19. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/swmr.py +0 -0
  20. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/h5modules/utils.py +0 -0
  21. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/icon.ico +0 -0
  22. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/numpy_func.py +0 -0
  23. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/plotting/__init__.py +0 -0
  24. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/plotting/plotter/plotter.py +0 -0
  25. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/plotting/plotter/plotters/__init__.py +0 -0
  26. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/plotting/plotter/plotters/matplotlib_plotters.py +0 -0
  27. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/plotting/utils.py +0 -0
  28. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/post_treatment/__init__.py +0 -0
  29. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/post_treatment/process_to_scalar.py +0 -0
  30. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/resources/__init__.py +0 -0
  31. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/resources/config_template.toml +0 -0
  32. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/src/pymodaq_data/slicing.py +0 -0
  33. {pymodaq_data-5.2.5 → pymodaq_data-5.2.7}/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.2.5
3
+ Version: 5.2.7
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
@@ -28,7 +28,7 @@ from pint.compat import upcast_type_map
28
28
  from multipledispatch import dispatch
29
29
 
30
30
 
31
- from pymodaq_utils.enums import BaseEnum, enum_checker
31
+ from pymodaq_utils.enums import BaseEnum, enum_checker, StrEnum
32
32
  from pymodaq_utils.warnings import deprecation_msg
33
33
  from pymodaq_utils.utils import find_objects_in_list_from_attr_name_val
34
34
  from pymodaq_utils.logger import set_logger, get_module_name
@@ -149,6 +149,13 @@ class DataUnitError(Exception):
149
149
  pass
150
150
 
151
151
 
152
+ class Averaging(StrEnum):
153
+ """ Keywords to describe averaging in Data objects"""
154
+ AVERAGED = 'averaged'
155
+ N_AVERAGED = 'n_averaged'
156
+
157
+
158
+
152
159
  class DwaType(BaseEnum):
153
160
  """Different types of `DataWithAxes`."""
154
161
  DataWithAxes = 0
@@ -819,6 +826,8 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
819
826
  self._units = check_units(units)
820
827
  self._errors = None
821
828
  self.origin = origin
829
+ self._averaged = False
830
+ self._n_averaged = 0
822
831
 
823
832
  source = enum_checker(DataSource, source)
824
833
  self._source = source
@@ -1104,6 +1113,42 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
1104
1113
  def deepcopy(self):
1105
1114
  return copy.deepcopy(self)
1106
1115
 
1116
+ @property
1117
+ def averaged(self) -> bool:
1118
+ """ Get/Set a boolean depending if self is the result of an average operation
1119
+
1120
+ See Also
1121
+ --------
1122
+ n_averaged
1123
+ average
1124
+ """
1125
+ return self._averaged
1126
+
1127
+ @averaged.setter
1128
+ def averaged(self, status: bool):
1129
+ self._averaged = status
1130
+
1131
+ @property
1132
+ def n_averaged(self) -> int:
1133
+ """ Get/set the number of averaging that resulted in this data
1134
+
1135
+ See Also
1136
+ --------
1137
+ averaged
1138
+ average
1139
+ """
1140
+ return self._n_averaged
1141
+
1142
+ @n_averaged.setter
1143
+ def n_averaged(self, n_data: int):
1144
+ """ Return the number of averaging that resulted in this data
1145
+
1146
+ See Also
1147
+ --------
1148
+ averaged
1149
+ """
1150
+ self._n_averaged = n_data
1151
+
1107
1152
  def average(self, other: 'DataBase', weight: int) -> 'DataBase':
1108
1153
  """ Compute the weighted average between self and other DataBase
1109
1154
 
@@ -1117,7 +1162,11 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
1117
1162
  DataBase: the averaged DataBase object
1118
1163
  """
1119
1164
  if isinstance(other, DataBase) and len(other) == len(self) and isinstance(weight, numbers.Number):
1120
- return (other * weight + self) / (weight + 1)
1165
+ averaged_data = (other * weight + self) / (weight + 1)
1166
+ averaged_data.name = self.name
1167
+ averaged_data.add_extra_attribute(**{Averaging.AVERAGED: True,
1168
+ Averaging.N_AVERAGED: weight + 1})
1169
+ return averaged_data
1121
1170
  else:
1122
1171
  raise TypeError(f'Could not average a {other.__class__.__name__} or a {self.__class__.__name__} '
1123
1172
  f'of a different length')
File without changes
File without changes
File without changes