from_file#

classmethod caput.memdata.MemDiskGroup.from_file(file_, ondisk=False, distributed=False, comm=None, detect_subclass=True, convert_attribute_strings=None, convert_dataset_strings=None, file_format=None, **kwargs)[source]#

Create data object from analysis hdf5 file, store in memory or on disk.

If ondisk is True, do not load into memory but store data in h5py objects that remain associated with the file on disk. This is almost identical to the default constructor, when providing a file as the data_group object, however provides more flexibility when opening the file through the additional keyword arguments.

This does not call __init__ on the subclass when restoring.

Parameters:
file_FileOrGroupLike

File with the hdf5 data. File must be compatible with memh5 objects.

ondiskbool, optional

Whether the data should be stored in-place in file_ or should be copied into memory. Default is False.

distributedbool, optional

Allow the container to hold distributed datasets. Default is False.

commMPI.Comm | None, optional

MPI Communicator to distributed over. If not set, use MPI.COMM_WORLD.

detect_subclassbool, optional

If data_group is specified, whether to inspect for a ‘__memh5_subclass’ attribute which specifies a subclass to return. Default is True.

convert_attribute_strings: bool, optional

Try and convert attribute string types to unicode. If not specified, look up the name as a class attribute to find a default, and otherwise use True.

convert_dataset_strings: bool, optional

Try and convert dataset string types to unicode. If not specified, look up the name as a class attribute to find a default, and otherwise use False.

file_formatFileFormat

File format to use. Default is None, i.e. guess from file name.

**kwargsAny

Any additional keyword arguments are passed to h5py.File’s constructor if file_ is a filename and silently ignored otherwise.

Returns:
groupMemDiskGroup

MemDiskGroup instance wrapping data from file_.

Notes

Axis selections can be given to only read a subset of the containers using the <axis_name>_sel keyword arguments. A slice can be given, or a list of specific array indices for that axis.