py21cmfast.io ============= .. py:module:: py21cmfast.io .. autoapi-nested-parse:: I/O for the 21cmFAST package. .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/py21cmfast/io/caching/index /autoapi/py21cmfast/io/h5/index Functions --------- .. autoapisummary:: py21cmfast.io.read_inputs py21cmfast.io.read_output_struct py21cmfast.io.write_output_to_hdf5 Package Contents ---------------- .. py:function:: read_inputs(group, safe = True) Read the InputParameters from a cache file. :Parameters: * **group** (*h5py.Group | Path | h5py.File*) -- A file, or HDF5 Group within a file, to read the input parameters from. * **safe** (*bool, optional*) -- If in safe mode, errors will be raised if keys exist in the file that are not valid attributes of the InputParameters. Otherwise, only warnings will be raised. :returns: **inputs** (*InputParameters*) -- The input parameters contained in the file. .. !! processed by numpydoc !! .. py:function:: read_output_struct(path, group = '/', struct = None, safe = True) Read an output struct from an HDF5 file. :Parameters: * **path** (*Path*) -- The path to the HDF5 file. * **group** (*str, optional*) -- A path within the HDF5 heirarchy to the top-level of the OutputStruct. This is usually the root of the file. * **struct** -- A string specifying the kind of OutputStruct to read (e.g. InitialConditions). Generally, this does not need to be provided, as cache files contain just a single output struct. * **safe** -- Whether to read the file in "safe" mode. If True, keys found in the file that are not valid attributes of the struct will raise an exception. If False, only a warning will be raised. :returns: *OutputStruct* -- An OutputStruct that is contained in the cache file. .. !! processed by numpydoc !! .. py:function:: write_output_to_hdf5(output, path, group = None, mode = 'w') Write an output struct in standard HDF5 format. :Parameters: * **output** -- The OutputStruct to write. * **path** (*Path*) -- The path to write the output struct to. * **group** (*str, optional*) -- The HDF5 group into which to write the object. By default, this is the root. * **mode** (*str*) -- The mode in which to open the file. .. !! processed by numpydoc !!