From a8b153daf1c99e294177cf73e6fb74cb2fb448a5 Mon Sep 17 00:00:00 2001
From: Jibril Mammeri <jibril.mammeri@esrf.fr>
Date: Thu, 13 Mar 2025 15:14:54 +0100
Subject: [PATCH 1/2] Replace electric_current by machine_current

---
 tomoscan/esrf/scan/edfscan.py                 | 16 +++----
 .../scan/framereducer/hdf5framereducer.py     |  4 +-
 .../tests/test_edfframereducer.py             | 14 +++---
 .../tests/test_hdf5framereducer.py            | 46 +++++++++----------
 tomoscan/esrf/scan/nxtomoscan.py              |  4 +-
 tomoscan/framereducer/reducedframesinfos.py   | 18 ++++----
 tomoscan/scanbase.py                          | 10 ++--
 7 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/tomoscan/esrf/scan/edfscan.py b/tomoscan/esrf/scan/edfscan.py
index 711dbd9f..34daf042 100644
--- a/tomoscan/esrf/scan/edfscan.py
+++ b/tomoscan/esrf/scan/edfscan.py
@@ -823,10 +823,10 @@ class EDFTomoScan(TomoScanBase):
         return self._count_time
 
     @property
-    @docstring(TomoScanBase.electric_current)
-    def electric_current(self) -> tuple:
-        if self._electric_current is None:
-            electric_current = EDFTomoScan.retrieve_information(
+    @docstring(TomoScanBase.machine_current)
+    def machine_current(self) -> tuple:
+        if self._machine_current is None:
+            machine_current = EDFTomoScan.retrieve_information(
                 self.path,
                 dataset_basename=self.dataset_basename,
                 ref_file=None,
@@ -835,13 +835,13 @@ class EDFTomoScan(TomoScanBase):
                 key_aliases=("SRCUR", "machineCurrentStart"),
                 scan_info=self.scan_info,
             )
-            if electric_current is not None:
+            if machine_current is not None:
                 if self.tomo_n is not None:
-                    self._electric_current = [electric_current] * self.tomo_n
+                    self._machine_current = [machine_current] * self.tomo_n
                 else:
-                    self._electric_current = electric_current
+                    self._machine_current = machine_current
 
-        return self._electric_current
+        return self._machine_current
 
     @staticmethod
     def _get_pixel_size(
diff --git a/tomoscan/esrf/scan/framereducer/hdf5framereducer.py b/tomoscan/esrf/scan/framereducer/hdf5framereducer.py
index fc567e38..ac5f70c4 100644
--- a/tomoscan/esrf/scan/framereducer/hdf5framereducer.py
+++ b/tomoscan/esrf/scan/framereducer/hdf5framereducer.py
@@ -66,10 +66,10 @@ class HDF5FrameReducer(FrameReducerBase):
             return self.scan.count_time[indexes]
 
     def get_machine_electric_current(self, indexes):
-        if self.scan.electric_current is None:
+        if self.scan.machine_current is None:
             return []
         else:
-            return self.scan.electric_current[indexes]
+            return self.scan.machine_current[indexes]
 
     def load_data_serie(self, urls) -> dict:
         """load all urls. Trying to reduce load time by calling get_compacted_dataslices"""
diff --git a/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py b/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py
index 1bd1e479..6b84960a 100644
--- a/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py
+++ b/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py
@@ -25,7 +25,7 @@ class MockEDFWithRawRef(_MockEDF):
         recons_vol=False,
         dim=200,
         scene="noise",
-        electrical_current: numpy.array | None = None,
+        machine_current: numpy.array | None = None,
         count_time: numpy.array | None = None,
     ):
         self.flat_n = len(flats[list(flats.keys())[0]]) if len(flats) > 0 else 0
@@ -33,7 +33,7 @@ class MockEDFWithRawRef(_MockEDF):
         self.flats = flats
         self.darks = darks
         self.dim = dim
-        self._electrical_current = electrical_current
+        self._machine_current = machine_current
         self._count_time = count_time
         super().__init__(
             scan_path,
@@ -131,8 +131,8 @@ class MockEDFWithRawRef(_MockEDF):
         )
         info_file = self.get_info_file()
         with open(info_file, "a") as info_file:
-            if self._electrical_current is not None:
-                info_file.write("SrCurrent=    " + str(self._electrical_current) + "\n")
+            if self._machine_current is not None:
+                info_file.write("SrCurrent=    " + str(self._machine_current) + "\n")
             if self._count_time is not None:
                 info_file.write("Count_time=    " + str(self._count_time) + "\n")
 
@@ -145,7 +145,7 @@ def test_reduce_edf(tmp_path):
     n_darks = 1
 
     count_time = 1.2  # for edf now we only consider a scalar (store in the .info file)
-    electric_current = (
+    machine_current = (
         10.2  # for edf now we only consider a scalar (store in the .info file)
     )
 
@@ -176,7 +176,7 @@ def test_reduce_edf(tmp_path):
         n_radio=n_proj,
         flats={0: raw_flats_s1, 12: raw_flats_s2},
         darks={0: raw_darks},
-        electrical_current=electric_current,
+        machine_current=machine_current,
         count_time=count_time,
     )
     scan = Factory.create_scan_object(str(folder_1))
@@ -236,7 +236,7 @@ def test_reduce_edf(tmp_path):
     # with the current method (only one Srcurrent and Count_time value per acquistion) flats and darks will have the same value
     # and also the same no matter the method to compute it
     assert darks_metadata.count_time[0] == count_time
-    assert darks_metadata.machine_electric_current[0] == electric_current
+    assert darks_metadata.machine_electric_current[0] == machine_current
     _, flats_metadata = scan.compute_reduced_flats(
         reduced_method="mean", return_info=True
     )
diff --git a/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py b/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py
index df52694c..8f0455df 100644
--- a/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py
+++ b/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py
@@ -20,7 +20,7 @@ class MockNXtomo(_MockNXtomo):
         dim: int,
         n_proj: int,
         count_time: numpy.array | None = None,
-        electrical_current: numpy.array | None = None,
+        machine_current: numpy.array | None = None,
     ):
         assert ini_dark is None or ini_dark.ndim == 3, "ini_dark should be a 3d array"
         assert ini_flats is None or ini_flats.ndim == 3, "ini_dark should be a 3d array"
@@ -41,12 +41,12 @@ class MockNXtomo(_MockNXtomo):
             n_proj=n_proj,
         )
 
-        # append count_time and electrical_current to the HDF5 file
+        # append count_time and machine_current to the HDF5 file
         with h5py.File(self.scan_master_file, "a") as h5_file:
             entry_one = h5_file.require_group(self.scan_entry)
-            if electrical_current is not None:
+            if machine_current is not None:
                 monitor_grp = entry_one.require_group("control")
-                monitor_grp["data"] = electrical_current
+                monitor_grp["data"] = machine_current
             # rewrite count_time
             if count_time is not None:
                 instrument_grp = entry_one.require_group("instrument")
@@ -98,7 +98,7 @@ def test_reduce_hdf5(tmp_path):
     darks_count_time = numpy.linspace(
         1.0, 2.0, n_darks, endpoint=True, dtype=numpy.float32
     )
-    darks_electrical_current = numpy.linspace(
+    darks_machine_current = numpy.linspace(
         12.2, 13.3, n_darks, endpoint=True, dtype=numpy.float32
     )
 
@@ -110,7 +110,7 @@ def test_reduce_hdf5(tmp_path):
         ]
     )
     flats_s1_count_time = numpy.ones(3, dtype=numpy.float32)
-    flats_s1_electrical_current = numpy.array([14, 13.5, 13.2], dtype=numpy.float32)
+    flats_s1_machine_current = numpy.array([14, 13.5, 13.2], dtype=numpy.float32)
 
     flats_s2 = numpy.asarray(
         [
@@ -120,12 +120,12 @@ def test_reduce_hdf5(tmp_path):
         ]
     )
     flats_s2_count_time = numpy.array([10.0, 2.0, 3.0], dtype=numpy.float32)
-    flats_s2_electrical_current = numpy.array([13.6, 13.8, 14.1], dtype=numpy.float32)
+    flats_s2_machine_current = numpy.array([13.6, 13.8, 14.1], dtype=numpy.float32)
 
     projections_count_time = numpy.linspace(
         100, 200.0, endpoint=True, num=12, dtype=numpy.float32
     )
-    projections_electrical_current = numpy.linspace(
+    projections_machine_current = numpy.linspace(
         13.2, 13.5, endpoint=True, num=12, dtype=numpy.float32
     )
 
@@ -138,12 +138,12 @@ def test_reduce_hdf5(tmp_path):
         ]
     )
 
-    electrical_current = numpy.concatenate(
+    machine_current = numpy.concatenate(
         [
-            darks_electrical_current,
-            flats_s1_electrical_current,
-            projections_electrical_current,
-            flats_s2_electrical_current,
+            darks_machine_current,
+            flats_s1_machine_current,
+            projections_machine_current,
+            flats_s2_machine_current,
         ]
     )
 
@@ -155,10 +155,10 @@ def test_reduce_hdf5(tmp_path):
         dim=dim,
         n_proj=n_proj,
         count_time=count_time,
-        electrical_current=electrical_current,
+        machine_current=machine_current,
     ).scan
 
-    assert scan.electric_current is not None
+    assert scan.machine_current is not None
     assert scan.exposure_time is not None
 
     # test reduced frames
@@ -214,7 +214,7 @@ def test_reduce_hdf5(tmp_path):
     assert isinstance(darks_infos, ReducedFramesInfos)
     assert len(darks_infos.machine_electric_current) == len(darks_infos.count_time) == 1
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], numpy.median(darks_electrical_current)
+        darks_infos.machine_electric_current[0], numpy.median(darks_machine_current)
     )
     numpy.testing.assert_almost_equal(
         darks_infos.count_time[0], numpy.median(darks_count_time)
@@ -222,7 +222,7 @@ def test_reduce_hdf5(tmp_path):
 
     _, darks_infos = scan.compute_reduced_darks(reduced_method="mean", return_info=True)
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], numpy.mean(darks_electrical_current)
+        darks_infos.machine_electric_current[0], numpy.mean(darks_machine_current)
     )
     numpy.testing.assert_almost_equal(
         darks_infos.count_time[0], numpy.mean(darks_count_time)
@@ -232,13 +232,13 @@ def test_reduce_hdf5(tmp_path):
         reduced_method="first", return_info=True
     )
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], darks_electrical_current[0]
+        darks_infos.machine_electric_current[0], darks_machine_current[0]
     )
     numpy.testing.assert_almost_equal(darks_infos.count_time[0], darks_count_time[0])
 
     _, darks_infos = scan.compute_reduced_darks(reduced_method="last", return_info=True)
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], darks_electrical_current[-1]
+        darks_infos.machine_electric_current[0], darks_machine_current[-1]
     )
     numpy.testing.assert_almost_equal(darks_infos.count_time[0], darks_count_time[-1])
 
@@ -250,11 +250,11 @@ def test_reduce_hdf5(tmp_path):
     assert len(flats_infos.machine_electric_current) == len(flats_infos.count_time) == 2
     numpy.testing.assert_almost_equal(
         flats_infos.machine_electric_current[0],
-        numpy.median(flats_s1_electrical_current),
+        numpy.median(flats_s1_machine_current),
     )
     numpy.testing.assert_almost_equal(
         flats_infos.machine_electric_current[1],
-        numpy.median(flats_s2_electrical_current),
+        numpy.median(flats_s2_machine_current),
     )
     numpy.testing.assert_almost_equal(
         flats_infos.count_time[0], numpy.median(flats_s1_count_time)
@@ -265,10 +265,10 @@ def test_reduce_hdf5(tmp_path):
 
     _, flats_infos = scan.compute_reduced_flats(reduced_method="mean", return_info=True)
     numpy.testing.assert_almost_equal(
-        flats_infos.machine_electric_current[0], numpy.mean(flats_s1_electrical_current)
+        flats_infos.machine_electric_current[0], numpy.mean(flats_s1_machine_current)
     )
     numpy.testing.assert_almost_equal(
-        flats_infos.machine_electric_current[1], numpy.mean(flats_s2_electrical_current)
+        flats_infos.machine_electric_current[1], numpy.mean(flats_s2_machine_current)
     )
     numpy.testing.assert_almost_equal(
         flats_infos.count_time[0], numpy.mean(flats_s1_count_time)
diff --git a/tomoscan/esrf/scan/nxtomoscan.py b/tomoscan/esrf/scan/nxtomoscan.py
index 8b51ffe9..cf0fb9d8 100644
--- a/tomoscan/esrf/scan/nxtomoscan.py
+++ b/tomoscan/esrf/scan/nxtomoscan.py
@@ -653,9 +653,9 @@ class NXtomoScan(TomoScanBase):
         return self.count_time
 
     @property
-    def electric_current(self) -> list | None:
+    def machine_current(self) -> list | None:
         return self._get_generic_key(
-            "_electric_current",
+            "_machine_current",
             self.nexus_path.ELECTRIC_CURRENT_PATH,
             unit=electriccurrentsystem.ElectricCurrentSystem.AMPERE,
         )
diff --git a/tomoscan/framereducer/reducedframesinfos.py b/tomoscan/framereducer/reducedframesinfos.py
index 253e6668..e0a23c43 100644
--- a/tomoscan/framereducer/reducedframesinfos.py
+++ b/tomoscan/framereducer/reducedframesinfos.py
@@ -6,15 +6,15 @@ from typing import Iterable
 
 
 class ReducedFramesInfos:
-    """contains reduced frames metadata as count_time and machine_electric_current"""
+    """contains reduced frames metadata as count_time and machine_current"""
 
-    MACHINE_ELECT_CURRENT_KEY = "machine_electric_current"
+    MACHINE_ELECT_CURRENT_KEY = "machine_current"
 
     COUNT_TIME_KEY = "count_time"
 
     def __init__(self) -> None:
         self._count_time = []
-        self._machine_electric_current = []
+        self._machine_current = []
 
     def __eq__(self, __o: object) -> bool:
         if isinstance(__o, dict):
@@ -30,7 +30,7 @@ class ReducedFramesInfos:
 
     def clear(self):
         self._count_time.clear()
-        self._machine_electric_current.clear()
+        self._machine_current.clear()
 
     @property
     def count_time(self) -> list:
@@ -51,14 +51,14 @@ class ReducedFramesInfos:
         """
         machine electric current in Ampere
         """
-        return self._machine_electric_current
+        return self._machine_current
 
     @machine_electric_current.setter
-    def machine_electric_current(self, machine_electric_current: Iterable | None):
-        if machine_electric_current is None:
-            self._machine_electric_current.clear()
+    def machine_electric_current(self, machine_current: Iterable | None):
+        if machine_current is None:
+            self._machine_current.clear()
         else:
-            self._machine_electric_current = list(machine_electric_current)
+            self._machine_current = list(machine_current)
 
     def to_dict(self) -> dict:
         res = {}
diff --git a/tomoscan/scanbase.py b/tomoscan/scanbase.py
index 4973ba39..b22ad795 100644
--- a/tomoscan/scanbase.py
+++ b/tomoscan/scanbase.py
@@ -97,7 +97,7 @@ class TomoScanBase(TomoObject):
         self._source = None
         self._intensity_normalization = IntensityNormalization()
         """Extra information for normalization"""
-        self._electric_current = None
+        self._machine_current = None
         self._count_time = None
         self._sample_detector_distance = None
         self._source_sample_distance = None
@@ -516,17 +516,17 @@ class TomoScanBase(TomoObject):
         raise NotImplementedError("Base class")
 
     @property
-    def electric_current(self) -> tuple:
+    def machine_current(self) -> tuple:
         """Return the sample name"""
         raise NotImplementedError("Base class")
 
-    @electric_current.setter
-    def electric_current(self, current: tuple | None) -> None:
+    @machine_current.setter
+    def machine_current(self, current: tuple | None) -> None:
         if not isinstance(current, (type(None), tuple)):
             raise TypeError(
                 f"current is expected to be None or a tuple. Not {type(current)}"
             )
-        self._electric_current = current
+        self._machine_current = current
 
     @property
     def title(self):
-- 
GitLab


From ab6627265c4108c1de43d478bff55f29ed5d5b6f Mon Sep 17 00:00:00 2001
From: Jibril Mammeri <jibril.mammeri@esrf.fr>
Date: Thu, 13 Mar 2025 16:29:30 +0100
Subject: [PATCH 2/2] Replace machine_electric_current and add deprecation
 warning

---
 tomoscan/esrf/scan/edfscan.py                 | 10 ++++
 .../esrf/scan/framereducer/edfframereducer.py |  6 +--
 .../scan/framereducer/hdf5framereducer.py     | 16 +++---
 .../tests/test_edfframereducer.py             | 20 +++-----
 .../tests/test_hdf5framereducer.py            | 20 ++++----
 tomoscan/esrf/scan/tests/test_edfscan.py      |  4 +-
 tomoscan/esrf/scan/tests/test_nxtomoscan.py   |  6 +--
 tomoscan/esrf/scan/tests/test_utils.py        |  4 +-
 tomoscan/framereducer/reducedframesinfos.py   | 37 ++++++++++----
 tomoscan/scanbase.py                          | 51 ++++++++++++-------
 tomoscan/tests/test_scanbase.py               |  6 +--
 11 files changed, 105 insertions(+), 75 deletions(-)

diff --git a/tomoscan/esrf/scan/edfscan.py b/tomoscan/esrf/scan/edfscan.py
index 34daf042..dadbf8a1 100644
--- a/tomoscan/esrf/scan/edfscan.py
+++ b/tomoscan/esrf/scan/edfscan.py
@@ -9,6 +9,7 @@ import logging
 import os
 import re
 from typing import Iterable
+import warnings
 
 import fabio
 import numpy
@@ -822,6 +823,15 @@ class EDFTomoScan(TomoScanBase):
 
         return self._count_time
 
+    @property
+    def electric_current(self) -> tuple:
+        warnings.warn(
+            "electric_current is deprecated and will be removed in a future version. Use machine_current instead.",
+            DeprecationWarning,
+            stacklevel=2,
+        )
+        return self.machine_current
+
     @property
     @docstring(TomoScanBase.machine_current)
     def machine_current(self) -> tuple:
diff --git a/tomoscan/esrf/scan/framereducer/edfframereducer.py b/tomoscan/esrf/scan/framereducer/edfframereducer.py
index 4ef7afa6..11c9ad5d 100644
--- a/tomoscan/esrf/scan/framereducer/edfframereducer.py
+++ b/tomoscan/esrf/scan/framereducer/edfframereducer.py
@@ -291,9 +291,9 @@ class EDFFrameReducer(FrameReducerBase):
 
                 # update electrical machine current
                 if header["SRCUR"] is not None:
-                    if infos.machine_electric_current is None:
-                        infos.machine_electric_current = []
-                    infos.machine_electric_current.append(header["SRCUR"])
+                    if infos.machine_current is None:
+                        infos.machine_current = []
+                    infos.machine_current.append(header["SRCUR"])
                 if header["Count_time"] is not None:
                     if infos.count_time is None:
                         infos.count_time = []
diff --git a/tomoscan/esrf/scan/framereducer/hdf5framereducer.py b/tomoscan/esrf/scan/framereducer/hdf5framereducer.py
index ac5f70c4..3661ffe1 100644
--- a/tomoscan/esrf/scan/framereducer/hdf5framereducer.py
+++ b/tomoscan/esrf/scan/framereducer/hdf5framereducer.py
@@ -65,7 +65,7 @@ class HDF5FrameReducer(FrameReducerBase):
         else:
             return self.scan.count_time[indexes]
 
-    def get_machine_electric_current(self, indexes):
+    def get_machine_current(self, indexes):
         if self.scan.machine_current is None:
             return []
         else:
@@ -162,7 +162,7 @@ class HDF5FrameReducer(FrameReducerBase):
 
             series_frame_data = self.load_data_serie(series_)
             series_count_time = self.get_count_time_serie(indexes=list(series_.keys()))
-            series_machine_electric_current = self.get_machine_electric_current(
+            series_machine_current = self.get_machine_current(
                 indexes=list(series_.keys())
             )
 
@@ -179,18 +179,14 @@ class HDF5FrameReducer(FrameReducerBase):
                     raise ValueError(
                         f"reduced method not handle for method 'raw' ({self.reduced_method}). Expects 'first' or 'last'"
                     )
-                if len(series_machine_electric_current) > 0:
-                    infos.machine_electric_current.append(
-                        series_machine_electric_current[index_infos]
-                    )
+                if len(series_machine_current) > 0:
+                    infos.machine_current.append(series_machine_current[index_infos])
                 if len(series_count_time) > 0:
                     infos.count_time.append(series_count_time[index_infos])
             else:
                 data = method_(series_frame_data, axis=0)
-                if len(series_machine_electric_current) > 0:
-                    infos.machine_electric_current.append(
-                        method_(series_machine_electric_current)
-                    )
+                if len(series_machine_current) > 0:
+                    infos.machine_current.append(method_(series_machine_current))
                 if len(series_count_time) > 0:
                     infos.count_time.append(method_(series_count_time))
 
diff --git a/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py b/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py
index 6b84960a..b74edf00 100644
--- a/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py
+++ b/tomoscan/esrf/scan/framereducer/tests/test_edfframereducer.py
@@ -228,32 +228,24 @@ def test_reduce_edf(tmp_path):
         reduced_method="median", return_info=True
     )
     assert isinstance(darks_metadata, ReducedFramesInfos)
-    assert (
-        len(darks_metadata.count_time)
-        == len(darks_metadata.machine_electric_current)
-        == 1
-    )
+    assert len(darks_metadata.count_time) == len(darks_metadata.machine_current) == 1
     # with the current method (only one Srcurrent and Count_time value per acquistion) flats and darks will have the same value
     # and also the same no matter the method to compute it
     assert darks_metadata.count_time[0] == count_time
-    assert darks_metadata.machine_electric_current[0] == machine_current
+    assert darks_metadata.machine_current[0] == machine_current
     _, flats_metadata = scan.compute_reduced_flats(
         reduced_method="mean", return_info=True
     )
-    assert (
-        len(flats_metadata.count_time)
-        == len(flats_metadata.machine_electric_current)
-        == 2
-    )
+    assert len(flats_metadata.count_time) == len(flats_metadata.machine_current) == 2
     assert (
         darks_metadata.count_time[0]
         == flats_metadata.count_time[0]
         == flats_metadata.count_time[1]
     )
     assert (
-        darks_metadata.machine_electric_current[0]
-        == flats_metadata.machine_electric_current[0]
-        == flats_metadata.machine_electric_current[1]
+        darks_metadata.machine_current[0]
+        == flats_metadata.machine_current[0]
+        == flats_metadata.machine_current[1]
     )
 
 
diff --git a/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py b/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py
index 8f0455df..44491463 100644
--- a/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py
+++ b/tomoscan/esrf/scan/framereducer/tests/test_hdf5framereducer.py
@@ -212,9 +212,9 @@ def test_reduce_hdf5(tmp_path):
         reduced_method="median", return_info=True
     )
     assert isinstance(darks_infos, ReducedFramesInfos)
-    assert len(darks_infos.machine_electric_current) == len(darks_infos.count_time) == 1
+    assert len(darks_infos.machine_current) == len(darks_infos.count_time) == 1
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], numpy.median(darks_machine_current)
+        darks_infos.machine_current[0], numpy.median(darks_machine_current)
     )
     numpy.testing.assert_almost_equal(
         darks_infos.count_time[0], numpy.median(darks_count_time)
@@ -222,7 +222,7 @@ def test_reduce_hdf5(tmp_path):
 
     _, darks_infos = scan.compute_reduced_darks(reduced_method="mean", return_info=True)
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], numpy.mean(darks_machine_current)
+        darks_infos.machine_current[0], numpy.mean(darks_machine_current)
     )
     numpy.testing.assert_almost_equal(
         darks_infos.count_time[0], numpy.mean(darks_count_time)
@@ -232,13 +232,13 @@ def test_reduce_hdf5(tmp_path):
         reduced_method="first", return_info=True
     )
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], darks_machine_current[0]
+        darks_infos.machine_current[0], darks_machine_current[0]
     )
     numpy.testing.assert_almost_equal(darks_infos.count_time[0], darks_count_time[0])
 
     _, darks_infos = scan.compute_reduced_darks(reduced_method="last", return_info=True)
     numpy.testing.assert_almost_equal(
-        darks_infos.machine_electric_current[0], darks_machine_current[-1]
+        darks_infos.machine_current[0], darks_machine_current[-1]
     )
     numpy.testing.assert_almost_equal(darks_infos.count_time[0], darks_count_time[-1])
 
@@ -247,13 +247,13 @@ def test_reduce_hdf5(tmp_path):
         reduced_method="median", return_info=True
     )
     assert isinstance(flats_infos, ReducedFramesInfos)
-    assert len(flats_infos.machine_electric_current) == len(flats_infos.count_time) == 2
+    assert len(flats_infos.machine_current) == len(flats_infos.count_time) == 2
     numpy.testing.assert_almost_equal(
-        flats_infos.machine_electric_current[0],
+        flats_infos.machine_current[0],
         numpy.median(flats_s1_machine_current),
     )
     numpy.testing.assert_almost_equal(
-        flats_infos.machine_electric_current[1],
+        flats_infos.machine_current[1],
         numpy.median(flats_s2_machine_current),
     )
     numpy.testing.assert_almost_equal(
@@ -265,10 +265,10 @@ def test_reduce_hdf5(tmp_path):
 
     _, flats_infos = scan.compute_reduced_flats(reduced_method="mean", return_info=True)
     numpy.testing.assert_almost_equal(
-        flats_infos.machine_electric_current[0], numpy.mean(flats_s1_machine_current)
+        flats_infos.machine_current[0], numpy.mean(flats_s1_machine_current)
     )
     numpy.testing.assert_almost_equal(
-        flats_infos.machine_electric_current[1], numpy.mean(flats_s2_machine_current)
+        flats_infos.machine_current[1], numpy.mean(flats_s2_machine_current)
     )
     numpy.testing.assert_almost_equal(
         flats_infos.count_time[0], numpy.mean(flats_s1_count_time)
diff --git a/tomoscan/esrf/scan/tests/test_edfscan.py b/tomoscan/esrf/scan/tests/test_edfscan.py
index 7e03f1a9..33cddfcf 100644
--- a/tomoscan/esrf/scan/tests/test_edfscan.py
+++ b/tomoscan/esrf/scan/tests/test_edfscan.py
@@ -849,7 +849,7 @@ def test_save_dark_flat_reduced_several_urls(tmp_path):
     # test metadata
     flats_infos = ReducedFramesInfos()
     flats_infos.count_time = [1.0, 1.0]
-    flats_infos.machine_electric_current = [13.0, 13.0]
+    flats_infos.machine_current = [13.0, 13.0]
 
     scan.save_reduced_flats(
         flats={
@@ -863,7 +863,7 @@ def test_save_dark_flat_reduced_several_urls(tmp_path):
     darks_infos.count_time = [
         2.0,
     ]
-    darks_infos.machine_electric_current = [13.1]
+    darks_infos.machine_current = [13.1]
     scan.save_reduced_darks(
         darks={
             0: dark_frame,
diff --git a/tomoscan/esrf/scan/tests/test_nxtomoscan.py b/tomoscan/esrf/scan/tests/test_nxtomoscan.py
index 33853111..40e50414 100644
--- a/tomoscan/esrf/scan/tests/test_nxtomoscan.py
+++ b/tomoscan/esrf/scan/tests/test_nxtomoscan.py
@@ -769,7 +769,7 @@ def test_save_dark_flat_reduced_several_urls(tmp_path):
         flats_infos.count_time = [
             1,
         ]
-        flats_infos.machine_electric_current = [
+        flats_infos.machine_current = [
             12.3,
         ]
 
@@ -783,7 +783,7 @@ def test_save_dark_flat_reduced_several_urls(tmp_path):
             )
 
         flats_infos.count_time = [1.0, 1.0]
-        flats_infos.machine_electric_current = [12.3, 13.2]
+        flats_infos.machine_current = [12.3, 13.2]
         scan.save_reduced_flats(
             flats={
                 1: flat_frame_1,
@@ -846,7 +846,7 @@ def test_save_dark_flat_reduced_several_urls(tmp_path):
         )
         darks_infos = ReducedFramesInfos()
         darks_infos.count_time = [2.5]
-        darks_infos.machine_electric_current = [13.1]
+        darks_infos.machine_current = [13.1]
         scan.save_reduced_darks(
             darks={
                 0: dark_frame,
diff --git a/tomoscan/esrf/scan/tests/test_utils.py b/tomoscan/esrf/scan/tests/test_utils.py
index d020a7fa..4ee66f60 100644
--- a/tomoscan/esrf/scan/tests/test_utils.py
+++ b/tomoscan/esrf/scan/tests/test_utils.py
@@ -198,14 +198,14 @@ def test_dark_and_flat_copy(tmp_path):
         numpy.array(scan.reduced_darks_infos.count_time), numpy.array([1.0])
     )
     assert numpy.array_equal(
-        numpy.array(scan.reduced_darks_infos.machine_electric_current),
+        numpy.array(scan.reduced_darks_infos.machine_current),
         numpy.array([12.3]),
     )
     assert numpy.array_equal(
         numpy.array(scan.reduced_flats_infos.count_time), numpy.array([2.0, 2.1])
     )
     assert numpy.array_equal(
-        numpy.array(scan.reduced_flats_infos.machine_electric_current),
+        numpy.array(scan.reduced_flats_infos.machine_current),
         numpy.array([14.3, 14.2]),
     )
 
diff --git a/tomoscan/framereducer/reducedframesinfos.py b/tomoscan/framereducer/reducedframesinfos.py
index e0a23c43..1c6042e7 100644
--- a/tomoscan/framereducer/reducedframesinfos.py
+++ b/tomoscan/framereducer/reducedframesinfos.py
@@ -2,6 +2,7 @@ from __future__ import annotations
 
 
 import numpy
+import warnings
 from typing import Iterable
 
 
@@ -24,8 +25,8 @@ class ReducedFramesInfos:
         return numpy.array_equal(
             numpy.array(self.count_time), numpy.array(__o.count_time)
         ) and numpy.array_equal(
-            numpy.array(self.machine_electric_current),
-            numpy.array(__o.machine_electric_current),
+            numpy.array(self.machine_current),
+            numpy.array(__o.machine_current),
         )
 
     def clear(self):
@@ -48,13 +49,31 @@ class ReducedFramesInfos:
 
     @property
     def machine_electric_current(self) -> list:
+        warnings.warn(
+            "machine_electric_current is deprecated and will be removed in a future version. Use machine_current instead.",
+            DeprecationWarning,
+            stacklevel=2,
+        )
+        return self.machine_current
+
+    @machine_electric_current.setter
+    def machine_electric_current(self, machine_current: Iterable | None):
+        warnings.warn(
+            "machine_electric_current is deprecated and will be removed in a future version. Use machine_current instead.",
+            DeprecationWarning,
+            stacklevel=2,
+        )
+        self.machine_current = machine_current
+
+    @property
+    def machine_current(self) -> list:
         """
         machine electric current in Ampere
         """
         return self._machine_current
 
-    @machine_electric_current.setter
-    def machine_electric_current(self, machine_current: Iterable | None):
+    @machine_current.setter
+    def machine_current(self, machine_current: Iterable | None):
         if machine_current is None:
             self._machine_current.clear()
         else:
@@ -62,16 +81,14 @@ class ReducedFramesInfos:
 
     def to_dict(self) -> dict:
         res = {}
-        if len(self.machine_electric_current) > 0:
-            res[self.MACHINE_ELECT_CURRENT_KEY] = self.machine_electric_current
+        if len(self.machine_current) > 0:
+            res[self.MACHINE_ELECT_CURRENT_KEY] = self.machine_current
         if len(self.count_time) > 0:
             res[self.COUNT_TIME_KEY] = self.count_time
         return res
 
     def load_from_dict(self, my_dict: dict):
-        self.machine_electric_current = my_dict.get(
-            self.MACHINE_ELECT_CURRENT_KEY, None
-        )
+        self.machine_current = my_dict.get(self.MACHINE_ELECT_CURRENT_KEY, None)
         self.count_time = my_dict.get(self.COUNT_TIME_KEY, None)
         return self
 
@@ -92,7 +109,7 @@ class ReducedFramesInfos:
     def __str__(self):
         return "\n".join(
             [
-                f"machine_electric_current {self.machine_electric_current}",
+                f"machine_current {self.machine_current}",
                 f"count_time {self.count_time}",
             ]
         )
diff --git a/tomoscan/scanbase.py b/tomoscan/scanbase.py
index b22ad795..b13b7234 100644
--- a/tomoscan/scanbase.py
+++ b/tomoscan/scanbase.py
@@ -10,6 +10,7 @@ from bisect import bisect_left
 from collections import OrderedDict
 from math import ceil
 from typing import Iterable
+import warnings
 
 import fabio
 import h5py
@@ -515,6 +516,24 @@ class TomoScanBase(TomoObject):
     def count_time(self) -> list | None:
         raise NotImplementedError("Base class")
 
+    @property
+    def electric_current(self) -> tuple:
+        warnings.warn(
+            "electric_current is deprecated and will be removed in a future version. Use machine_current instead.",
+            DeprecationWarning,
+            stacklevel=2,
+        )
+        return self.machine_current
+
+    @electric_current.setter
+    def electric_current(self, current: tuple | None) -> None:
+        warnings.warn(
+            "electric_current is deprecated and will be removed in a future version. Use machine_current instead.",
+            DeprecationWarning,
+            stacklevel=2,
+        )
+        self.machine_current = current
+
     @property
     def machine_current(self) -> tuple:
         """Return the sample name"""
@@ -1246,11 +1265,9 @@ class TomoScanBase(TomoObject):
                         header = {}
                         if (
                             frames_metadata is not None
-                            and len(frames_metadata.machine_electric_current) > 0
+                            and len(frames_metadata.machine_current) > 0
                         ):
-                            header["SRCUR"] = frames_metadata.machine_electric_current[
-                                i_frame
-                            ]
+                            header["SRCUR"] = frames_metadata.machine_current[i_frame]
                         if (
                             frames_metadata is not None
                             and len(frames_metadata.count_time) > 0
@@ -1287,7 +1304,7 @@ class TomoScanBase(TomoObject):
                 )
                 scheme = url.scheme()
                 for metadata_name, metadata_values in frames_metadata.to_dict().items():
-                    # warning: for now we only handle list (of count_time and machine_electric_current)
+                    # warning: for now we only handle list (of count_time and machine_current)
                     if len(metadata_values) == 0:
                         continue
                     else:
@@ -1422,7 +1439,7 @@ class TomoScanBase(TomoObject):
                             else:
                                 res_data[frame_index] = handler.data
                             if "SRCUR" in handler.header:
-                                res_metadata.machine_electric_current.append(
+                                res_metadata.machine_current.append(
                                     float(handler.header["SRCUR"])
                                 )
                             if "CountTime" in handler.header:
@@ -1527,7 +1544,7 @@ class TomoScanBase(TomoObject):
                             res_metadata.count_time = count_time * unit_factor
 
                         if ReducedFramesInfos.MACHINE_ELECT_CURRENT_KEY in parent_group:
-                            machine_electric_current = silx.io.utils.h5py_read_dataset(
+                            machine_current = silx.io.utils.h5py_read_dataset(
                                 parent_group[
                                     ReducedFramesInfos.MACHINE_ELECT_CURRENT_KEY
                                 ]
@@ -1539,9 +1556,7 @@ class TomoScanBase(TomoObject):
                                 ].attrs,
                                 metric_system=ElectricCurrentSystem,
                             )
-                            res_metadata.machine_electric_current = (
-                                machine_electric_current * unit_factor
-                            )
+                            res_metadata.machine_current = machine_current * unit_factor
 
         return res_data, res_metadata
 
@@ -1552,9 +1567,9 @@ class TomoScanBase(TomoObject):
         if len(infos.count_time) not in (0, len(reduced_frames)):
             incoherent_metadata = True
             incoherent_metadata_mess += f"\n - count_time gets {len(infos.count_time)} when 0 or {len(reduced_frames)} expected"
-        if len(infos.machine_electric_current) not in (0, len(reduced_frames)):
+        if len(infos.machine_current) not in (0, len(reduced_frames)):
             incoherent_metadata = True
-            incoherent_metadata_mess += f"\n - machine_electric_current gets {len(infos.machine_electric_current)} when 0 or {len(reduced_frames)} expected"
+            incoherent_metadata_mess += f"\n - machine_current gets {len(infos.machine_current)} when 0 or {len(reduced_frames)} expected"
         if incoherent_metadata:
             raise ValueError(incoherent_metadata_mess)
 
@@ -1572,7 +1587,7 @@ class TomoScanBase(TomoObject):
         :param darks: dictionary with frame indices as key (int) and a 2D numpy array as value.
         :param output_urls: tuple of silx DataUrl, where to save the darks. Default value is usually provided by children class directly.
                             You better know what you are doing if you modify the default value.
-        :param darks_infos: information regarding darks (metadata) like the machine electric current, exposure time...
+        :param darks_infos: information regarding darks (metadata) like the machine current, exposure time...
         :param metadata_output_urls: tuple of silx DataUrl, where to save the metadata / darks information.  Default value is usually provided by children class directly
                             You better know what you are doing if you modify the default value.
         :param overwrtie: if the output files exist then will overwrite them.
@@ -1586,7 +1601,7 @@ class TomoScanBase(TomoObject):
 
             scan = ... # scan must be an instance of TomoScanBase like NXtomoScan()
             darks_infos.count_time = [2.5]
-            darks_infos.machine_electric_current = [13.1]
+            darks_infos.machine_current = [13.1]
             scan.save_reduced_darks(
                 darks={
                     0: dark_frame,  # dark_frame is a 2d numpy array
@@ -1655,7 +1670,7 @@ class TomoScanBase(TomoObject):
         :param flats: dictionary with frame indices as key (int) and a 2D numpy array as value.
         :param output_urls: tuple of silx DataUrl, where to save the flats. Default value is usually provided by children class directly.
                             You better know what you are doing if you modify the default value.
-        :param flats_infos: information regarding flats (metadata) like the machine electric current, exposure time...
+        :param flats_infos: information regarding flats (metadata) like the machine current, exposure time...
         :param metadata_output_urls: tuple of silx DataUrl, where to save the metadata / flats information.  Default value is usually provided by children class directly
                             You better know what you are doing if you modify the default value.
         :param overwrite: if the output files exist then will overwrite them.
@@ -1670,9 +1685,9 @@ class TomoScanBase(TomoObject):
             scan = ... # scan must be an instance of TomoScanBase like NXtomoScan()
             flats_infos = ReducedFramesInfos()
             flats_infos.count_time = [2.5, 1.2]
-            flats_infos.machine_electric_current = [12.5, 13.1]
-            # for normalization the first reduced flat (at index 1) will have 2.5 as count time and 12.5 as machine electric current
-            # the second reduced flat frame (at index 1002) will have 1.2 as count time and 13.1 as machine electric current
+            flats_infos.machine_current = [12.5, 13.1]
+            # for normalization the first reduced flat (at index 1) will have 2.5 as count time and 12.5 as machine current
+            # the second reduced flat frame (at index 1002) will have 1.2 as count time and 13.1 as machine current
             scan.save_reduced_darks(
                 darks={
                     1: flat_frame_1,     # flat_frame_1 is a 2d numpy array
diff --git a/tomoscan/tests/test_scanbase.py b/tomoscan/tests/test_scanbase.py
index bb6c24e3..d2f93610 100644
--- a/tomoscan/tests/test_scanbase.py
+++ b/tomoscan/tests/test_scanbase.py
@@ -205,8 +205,8 @@ def test_ReducedFramesInfo():
     assert infos.to_dict() == {}
     infos.count_time = numpy.array([12.3, 13.0])
     assert infos.count_time == [12.3, 13.0]
-    infos.machine_electric_current = [23.5, 56.9]
-    assert infos.machine_electric_current == [23.5, 56.9]
+    infos.machine_current = [23.5, 56.9]
+    assert infos.machine_current == [23.5, 56.9]
     my_dict = deepcopy(infos.to_dict())
     assert my_dict == {
         ReducedFramesInfos.COUNT_TIME_KEY: [12.3, 13.0],
@@ -222,6 +222,6 @@ def test_ReducedFramesInfo():
     with pytest.raises(TypeError):
         new_infos.count_time = 12
     with pytest.raises(TypeError):
-        new_infos.machine_electric_current = 12
+        new_infos.machine_current = 12
 
     str(new_infos)
-- 
GitLab