Commit b2063996 authored by payno's avatar payno
Browse files

[HDF5TomoScan] add "start_time" and "end_time" properties

parent a571caa2
Pipeline #42793 passed with stages
in 10 minutes and 14 seconds
......@@ -109,6 +109,10 @@ class HDF5TomoScan(TomoScanBase):
_ENERGY_PATH = "beam/incident_energy"
_START_TIME_PATH = "start_time"
_END_TIME_START = "end_time"
_SCHEME = "silx"
_EPSILON_ROT_ANGLE = 0.02
......@@ -178,6 +182,8 @@ class HDF5TomoScan(TomoScanBase):
self._fov = None
self._energy = None
self._estimated_cor_frm_motor = None
self._start_time = None
self._end_time = None
@staticmethod
def get_master_file(scan_path):
......@@ -695,6 +701,28 @@ class HDF5TomoScan(TomoScanBase):
self._energy = self._get_value(energy_dataset, default_unit="keV")
return self._energy
@property
def start_time(self):
if self._start_time is None and self.master_file and os.path.exists:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
if self._START_TIME_PATH in h5_file[self._entry]:
self._start_time = h5py_read_dataset(
h5_file[self._entry][self._START_TIME_PATH]
)
return self._start_time
@property
def end_time(self):
if self._end_time is None and self.master_file and os.path.exists:
self._check_hdf5scan_validity()
with HDF5File(self.master_file, "r", swmr=True) as h5_file:
if self._END_TIME_START in h5_file[self._entry]:
self._end_time = h5py_read_dataset(
h5_file[self._entry][self._END_TIME_START]
)
return self._end_time
@property
def frames(self) -> typing.Union[None, tuple]:
"""return tuple of frames. Frames contains """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment