Reading and Writing Orbit Data

orbithunter.io.read_h5(filename, *datanames, validate=False, **orbitkwargs)[source]
Parameters
filenamestr or Path

Absolute or relative path to .h5 file

datanamesstr or tuple, optional

Names of either h5py.Datasets or h5py.Groups within .h5 file. Recursively returns all orbits (h5py.Datasets) associated with all names provided. If nothing provided, return all datasets in file.

validatebool

Whether or not to access Orbit().preprocess a method which checks the ‘integrity’ of the imported data; in terms of its status as a solution to its equations, NOT the actual file integrity.

orbitkwargsdict

Any additional keyword arguments relevant for construction of specified Orbit instances. .

Returns
Orbit or list of Orbits or list of list of Orbits

The imported data; If a single h5py.Dataset’s name is specified, an Orbit is returned. If multiple Datasets are specified, a list of Orbits are returned. If a h5py.Group name is specified, then a list of Orbits is returned. If a combination of h5py.Dataset and h5py.Group names are provided, then the result is a list interspersed with either Orbits or lists of Orbits, arranged in the order based on the provided names.

Notes

The ‘state’ data should be saved as a dataset. The other attributes which define an Orbit, which are required for expected output are ‘basis’, ‘class’, ‘parameters’; all attributes included by default are ‘discretization’ (state shape in physical basis, not necessarily the shape of the saved state).

This searches through provided h5py.Groups recursively to extract all datasets. If you need to distinguish between two groups which are in the same parent group, both names must be provided separately.

As it takes a deliberate effort, keyword arguments passed to read_h5 are favored over saved attributes This allows for control in case of incorrect attributes; the dictionary update avoids sending more than one value to the same keyword argument. This passes all saved attributes, tuple or None for parameters, and any additional keyword arguments to the class

orbithunter.io.read_tileset(filename, keys, orbit_names, validate=False, **orbitkwargs)[source]

Importation of data as tiling dictionary

Parameters
filenamestr

The relative/absolute location of the file.

keystuple

Strings representing the labels to give to the orbits corresponding to orbit_names, respectively.

orbit_namestuple

Strings representing the dataset names within the .h5 file.

validatebool

Whether or not to call preprocess method on each imported orbit.

orbitkwargsdict

Keyword arguments that user wants to provide for construction of orbit instances.

Returns
dict :

Keys are those provided, values are orbit instances loaded from h5 file.