ftag.hdf5.h5writer#

Classes#

H5Writer

Writes jets to an HDF5 file.

Module Contents#

class ftag.hdf5.h5writer.H5Writer#

Writes jets to an HDF5 file.

Parameters:
  • dst (Path | str) – Path to the output file.

  • dtypes (dict[str, np.dtype]) – Dictionary of group names and their corresponding dtypes.

  • num_jets (int) – Number of jets to write.

  • shapes (dict[str, int], optional) – Dictionary of group names and their corresponding shapes.

  • jets_name (str, optional) – Name of the jets group. Default is “jets”.

  • add_flavour_label (bool, optional) – Whether to add a flavour label to the jets group. Default is False.

  • compression (str, optional) – Compression algorithm to use. Default is “lzf”.

  • precision (str | None, optional) – Precision to use. Default is None.

  • full_precision_vars (list[str] | None, optional) – List of variables to store in full precision. Default is None.

  • shuffle (bool, optional) – Whether to shuffle the jets before writing. Default is True.

dst: pathlib.Path | str#
dtypes: dict[str, numpy.dtype]#
shapes: dict[str, tuple[int, Ellipsis]]#
jets_name: str = 'jets'#
add_flavour_label: bool = False#
compression: str = 'lzf'#
precision: str = 'full'#
full_precision_vars: list[str] | None = None#
shuffle: bool = True#
num_jets: int | None = None#
__post_init__()#
classmethod from_file(source: pathlib.Path, num_jets: int | None = 0, variables=None, **kwargs) H5Writer#
create_ds(name: str, dtype: numpy.dtype) None#
close() None#
get_attr(name, group=None)#
add_attr(name, data, group=None) None#
copy_attrs(fname: pathlib.Path) None#
write(data: dict[str, numpy.ndarray]) None#