load_from_id
- specatalog.data_management.hdf5_reader.load_from_id(ms_id, mode='r')[source]
Load a hdf5-measurement-file from the archive as a H5Object.
- Parameters:
ms_id (int) – Number of the measurement.
mode (Literal["r", "a", "w"], optional) – File access mode: - “r”: Read-only (default) - “a”: Append to existing file - “w”: Overwrite existing file
- Raises:
ValueError – If no measurement with the given ID exists in the archive.
- Yields:
tuple[H5Object, h5py.File] – The H5Object wrapper and the raw h5py.File object.
- Return type:
tuple[H5Object, File]
Example
>>> with load_from_id(222, mode="a") as (obj, f): >>> obj.corrected_data.set_attr("test2", 1234) >>> obj.sync() >>> int = obj.raw_data.intensity_0 >>> print(int)