Commit 79caeb74 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

HDF5TomoScan: add energy property

parent ed88c5f1
......@@ -90,6 +90,8 @@ class HDF5TomoScan(TomoScanBase):
_DISTANCE_PATH = 'instrument/detector/distance'
_ENERGY_PATH = 'beam/incident_energy'
_SCHEME = 'silx'
_EPSILON_ROT_ANGLE = 0.02
......@@ -148,6 +150,7 @@ class HDF5TomoScan(TomoScanBase):
self._image_keys = None
self._rotation_angles = None
self._distance = None
self._energy = None
@staticmethod
def get_master_file(scan_path):
......@@ -477,6 +480,15 @@ class HDF5TomoScan(TomoScanBase):
self._distance = self._get_value(distance_dataset, default_unit='m')
return self._distance
@property
def energy(self) -> typing.Union[None, float]:
if (self._energy is None and self.master_file and
os.path.exists(self.master_file)):
with h5py.File(self.master_file, 'r') as h5_file:
energy_dataset = h5_file[self._entry][self._ENERGY_PATH]
self._energy = self._get_value(energy_dataset, default_unit='keV')
return self._energy
@property
def frames(self) -> typing.Union[None, tuple]:
"""return tuple of frames. Frames contains """
......
Supports Markdown
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