orbithunter.core.Orbit.to_h5

Orbit.to_h5(filename='', groupname='', dataname='', h5mode='a', verbose=False, include_cost=False, **kwargs)[source]

Export current state information to HDF5 file

Parameters
filenamestr, default None

filename to write/append to.

groupnamestr

The name for a h5py.Group to save under. This is included to make hierarchical saving easier.

datanamestr, default ‘0’

Name of the h5py.Dataset wherein to store the Orbit in the h5_file at location filename. Should be HDF5 group name, i.e. ‘/A/B/C/…’

h5modestr

Mode with which to open the file. Default is a, read/write if exists, create otherwise, other modes [‘r+’, ‘a’, ‘w-‘, ‘w’]. See h5py.File for details. ‘r’ not allowed, because this is a function to write to the file.

verbosebool

Whether or not to print save location and group

include_costbool

Whether or not to include cost as metadata; requires equation to be well-defined for current instance.

kwargsdict

extra keyword arguments, in signature to allow for generalization

Notes

The mode ‘a’ would typically overwrite datasets but this is handled here by adding suffixes. This allows for storing multiple versions of data within the same file without overwriting the old data/creating a new file.

The function could be much cleaner if the onus of responsibility for naming files, groups, datasets was put entirely upon the user. To avoid having write gratuitous amounts of code to name orbits, there are default options for the filename, groupname and dataname. groupname always acts as a prefix to dataname, it defaults to being an empty string. groupname is useful when there is a category of orbits (i.e. a family).