nectarchain.utils.utils.ContainerUtils#
- class ContainerUtils[source]#
Bases:
objectMethods
Pads fields of
NectarCAMContainerwith missing pixels (due to e.g. an incomplete camera) with chosen value.Wrapper function for
NectarCAMContainer.from_hdf5.- static add_missing_pixels_to_container(container, pad_value=nan)[source]#
Pads fields of
NectarCAMContainerwith missing pixels (due to e.g. an incomplete camera) with chosen value. For boolean arrays related to pixel status, zero/one-padding is applied appriopriately.
- static get_container_from_hdf5(path, container_classes, group_names='data')[source]#
Wrapper function for
NectarCAMContainer.from_hdf5.- Return type:
- Loads a container for a given
path, allowing to scan for: different NectarCAMContainer subclasses;
different group names.
For example, you may want to load the output of a gain calibration tool, but you don’t know whether it is a
SPEFitContainerorGainContainer.Or you may want to load a
NectarCAMPedestalContainer, which can either have the group name “data” or “data_combined” depending on the slicing applied.- Parameters:
- pathPath
Path to the HDF5 file.
- container_classesType[NectarCAMContainer] or sequence of such types
One or more container subclasses to attempt loading.
- group_namesstr or sequence of str, optional
Group names to try inside the HDF5 structure. Default is “data”.
- Returns:
- NectarCAMContainer
The successfully loaded container.
- Raises:
- TypeError
If
container_classescontains items that are not NectarCAMContainer subclasses.- ValueError
If no container can be loaded from the file using any class/group combination.