pymodaq_data 5.2.5__tar.gz → 5.2.8__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.8}/PKG-INFO +2 -2
  2. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/data.py +56 -3
  3. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/.gitignore +0 -0
  4. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/LICENSE +0 -0
  5. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/README.rst +0 -0
  6. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/pyproject.toml +0 -0
  7. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/__init__.py +0 -0
  8. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/config.py +0 -0
  9. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/__init__.py +0 -0
  10. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/backends.py +0 -0
  11. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/browsing.py +0 -0
  12. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/data_saving.py +0 -0
  13. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/exporter.py +0 -0
  14. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/exporters/__init__.py +0 -0
  15. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/exporters/base.py +0 -0
  16. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/exporters/flimj.py +0 -0
  17. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/exporters/hyperspy.py +0 -0
  18. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/saving.py +0 -0
  19. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/swmr.py +0 -0
  20. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/h5modules/utils.py +0 -0
  21. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/icon.ico +0 -0
  22. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/numpy_func.py +0 -0
  23. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/plotting/__init__.py +0 -0
  24. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/plotting/plotter/plotter.py +0 -0
  25. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/plotting/plotter/plotters/__init__.py +0 -0
  26. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/plotting/plotter/plotters/matplotlib_plotters.py +0 -0
  27. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/plotting/utils.py +0 -0
  28. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/post_treatment/__init__.py +0 -0
  29. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/post_treatment/process_to_scalar.py +0 -0
  30. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/resources/__init__.py +0 -0
  31. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/resources/config_template.toml +0 -0
  32. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/slicing.py +0 -0
  33. {pymodaq_data-5.2.5 → pymodaq_data-5.2.8}/src/pymodaq_data/splash.png +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: pymodaq_data
3
- Version: 5.2.5
3
+ Version: 5.2.8
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
@@ -940,8 +949,12 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
940
949
  if isinstance(epsilon, numbers.Number):
941
950
  epsilon = Q_(epsilon, self.units)
942
951
  try:
952
+ # using below epsilon - Q_(0, self.units) to handle units with offset/scaling like
953
+ # °C and °F where the diff produce a derived unit (delta_degree_Celsius) that do
954
+ # not compare well to epsilon itself. While epsilon - Q_(0, self.units) is not changing
955
+ # the value but produce similar delta units!
943
956
  return bool(np.all([np.abs(self.quantities[ind] - other.quantities[ind])
944
- <= epsilon for ind in range(len(self))]))
957
+ <= (epsilon - Q_(0, self.units)) for ind in range(len(self))]))
945
958
  except pint.errors.DimensionalityError as e:
946
959
  return False
947
960
 
@@ -1104,6 +1117,42 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
1104
1117
  def deepcopy(self):
1105
1118
  return copy.deepcopy(self)
1106
1119
 
1120
+ @property
1121
+ def averaged(self) -> bool:
1122
+ """ Get/Set a boolean depending if self is the result of an average operation
1123
+
1124
+ See Also
1125
+ --------
1126
+ n_averaged
1127
+ average
1128
+ """
1129
+ return self._averaged
1130
+
1131
+ @averaged.setter
1132
+ def averaged(self, status: bool):
1133
+ self._averaged = status
1134
+
1135
+ @property
1136
+ def n_averaged(self) -> int:
1137
+ """ Get/set the number of averaging that resulted in this data
1138
+
1139
+ See Also
1140
+ --------
1141
+ averaged
1142
+ average
1143
+ """
1144
+ return self._n_averaged
1145
+
1146
+ @n_averaged.setter
1147
+ def n_averaged(self, n_data: int):
1148
+ """ Return the number of averaging that resulted in this data
1149
+
1150
+ See Also
1151
+ --------
1152
+ averaged
1153
+ """
1154
+ self._n_averaged = n_data
1155
+
1107
1156
  def average(self, other: 'DataBase', weight: int) -> 'DataBase':
1108
1157
  """ Compute the weighted average between self and other DataBase
1109
1158
 
@@ -1117,7 +1166,11 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
1117
1166
  DataBase: the averaged DataBase object
1118
1167
  """
1119
1168
  if isinstance(other, DataBase) and len(other) == len(self) and isinstance(weight, numbers.Number):
1120
- return (other * weight + self) / (weight + 1)
1169
+ averaged_data = (other * weight + self) / (weight + 1)
1170
+ averaged_data.name = self.name
1171
+ averaged_data.add_extra_attribute(**{Averaging.AVERAGED: True,
1172
+ Averaging.N_AVERAGED: weight + 1})
1173
+ return averaged_data
1121
1174
  else:
1122
1175
  raise TypeError(f'Could not average a {other.__class__.__name__} or a {self.__class__.__name__} '
1123
1176
  f'of a different length')
File without changes
File without changes
File without changes