pymodaq_data 5.0.3__tar.gz → 5.0.4__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.3 → pymodaq_data-5.0.4}/.gitignore +2 -0
  2. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/PKG-INFO +1 -1
  3. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/_version.py +2 -2
  4. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/data.py +43 -0
  5. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/LICENSE +0 -0
  6. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/README.rst +0 -0
  7. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/pyproject.toml +0 -0
  8. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/__init__.py +0 -0
  9. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/__init__.py +0 -0
  10. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/backends.py +0 -0
  11. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/browsing.py +0 -0
  12. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/data_saving.py +0 -0
  13. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/exporter.py +0 -0
  14. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/exporters/__init__.py +0 -0
  15. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/exporters/base.py +0 -0
  16. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/exporters/flimj.py +0 -0
  17. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/exporters/hyperspy.py +0 -0
  18. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/saving.py +0 -0
  19. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/h5modules/utils.py +0 -0
  20. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/icon.ico +0 -0
  21. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/numpy_func.py +0 -0
  22. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/plotting/__init__.py +0 -0
  23. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/plotting/plotter/plotter.py +0 -0
  24. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/plotting/plotter/plotters/__init__.py +0 -0
  25. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/plotting/plotter/plotters/matplotlib_plotters.py +0 -0
  26. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/post_treatment/__init__.py +0 -0
  27. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/post_treatment/process_to_scalar.py +0 -0
  28. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/slicing.py +0 -0
  29. {pymodaq_data-5.0.3 → pymodaq_data-5.0.4}/src/pymodaq_data/splash.png +0 -0
@@ -1,6 +1,8 @@
1
1
  # Compiled python modules.
2
2
  *.pyc
3
3
 
4
+ _version.py
5
+
4
6
  # Byte-compiled / optimized / DLL files
5
7
  __pycache__/
6
8
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pymodaq_data
3
- Version: 5.0.3
3
+ Version: 5.0.4
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
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '5.0.3'
16
- __version_tuple__ = version_tuple = (5, 0, 3)
15
+ __version__ = version = '5.0.4'
16
+ __version_tuple__ = version_tuple = (5, 0, 4)
@@ -678,6 +678,49 @@ class DataBase(DataLowLevel, NDArrayOperatorsMixin):
678
678
  """ Change immediately the units to whatever else. Use this with care!"""
679
679
  self._units = units
680
680
 
681
+ def value(self, units: str = None) -> float:
682
+ """Returns the underlying float value (of the first elt in the data list) if this data
683
+ holds only a float otherwise returns a mean of the underlying data
684
+
685
+ Parameters
686
+ ----------
687
+
688
+ units: str
689
+ if unit is compatible with self.units, convert the data to these new units before
690
+ getting the value
691
+
692
+
693
+ """
694
+ if self.length == 1 and self.size == 1:
695
+ if units is not None:
696
+ data = Q_(float(self.data[0][0]), self.units)
697
+ return data.m_as(units)
698
+ else:
699
+ return float(self.data[0][0])
700
+ else:
701
+ if units is not None:
702
+ data = Q_(float(np.mean(self.data[0])), self.units)
703
+ return data.m_as(units)
704
+ else:
705
+ return float(np.mean(self.data[0]))
706
+
707
+ def values(self, units: str = None) -> List[float]:
708
+ """Returns the underlying float value (for each data array in the data list) if this data
709
+ holds only a float otherwise returns a mean of the underlying data"""
710
+ if self.length == 1 and self.size == 1:
711
+ if units is not None:
712
+ return [float(Q_(data_array[0], self.units).m_as(units))
713
+ for data_array in self.data]
714
+ else:
715
+ return [float(data_array[0])
716
+ for data_array in self.data]
717
+ else:
718
+ if units is not None:
719
+ return [float(Q_(np.mean(data_array), self.units).m_as(units))
720
+ for data_array in self.data]
721
+ else:
722
+ return [float(np.mean(data_array)) for data_array in self.data]
723
+
681
724
  def as_dte(self, name: str = 'mydte') -> DataToExport:
682
725
  """Convenience method to wrap the DataWithAxes object into a DataToExport"""
683
726
  return DataToExport(name, data=[self])
File without changes
File without changes