check_file_format#

caput.memdata.fileformats.check_file_format(filename, file_format, data)[source]#

Attempt to detect the format of a file.

Parameters:
filenamestr

File name.

file_formatFileFormat | None

Expected file format. If not None, an exception is raised if the detected file type is not this value. If None, no check is done against the detected format.

dataAny

If this is an h5py.Group or zarr.Group, it will be used to guess or confirm the file format.

Returns:
file_formatFileFormat

The detected FileFormat.