Closed Tobychev closed 8 months ago
Checking with ctapipe-fileinfo
, the same file claims to contain images, which is also wong. Seems the merge file didn't adapt the metadata correctly to the options it was given:
PRODUCT:
CREATION:
TIME: '2023-04-18 06:52:01.624'
DATA:
ASSOCIATION: Subarray
CATEGORY: Sim
LEVELS: DL1_IMAGES,DL1_PARAMETERS,DL2
Ok, so get_hdf5_datalevels
actually inspects the groups present in the hdf5 file, not the metadata.
Aha! The error here is a missing type check.
get_hdf5_metadata
expects a tables.File
as argument. In your example, you gave a pathlib.Path
, which also happens to have a .root
attribute, but which is the empty string, so all checks foo in h5file.root
return False:
In [4]: f = tables.open_file("../data/datapipe_workshop/model_training/gamma_20deg_0deg___cta-prod5b-lapalma_desert-2158m-LaPalma-dark_cone10.
...: alpha_train_cl_merged.DL2.h5")
In [5]: get_hdf5_datalevels(f)
Out[5]: (<DataLevel.DL1_PARAMETERS: 6>, <DataLevel.DL2: 7>)
Aha! I think a secondary issue is how things are presented in the docs, where get_hdf5_metadata
comes just after the generic read and write functions that do take just a filename.
Describe the bug The function
get_hdf5_datalevels
reports no data levels for files that clearly contains data level dataTo Reproduce
returns
()
Expected behavior That it returns at least
DataLevel.DL1_PARAMETERS