py21cmfast.cache_tools.readbox¶
- py21cmfast.cache_tools.readbox(*, direc=None, fname=None, hsh=None, kind=None, seed=None, redshift=None, load_data=True)[source]¶
Read in a data set and return an appropriate object for it.
- Parameters:
direc (str, optional) – The directory in which to search for the boxes. By default, this is the centrally-managed directory, given by the
config.yml
in~/.21cmfast/
.fname (str, optional) – The filename (without directory) of the data set. If given, this will be preferentially used, and must exist.
hsh (str, optional) – The md5 hsh of the object desired to be read. Required if fname not given.
kind (str, optional) – The kind of dataset, eg. “InitialConditions”. Will be the name of a class defined in
wrapper
. Required if fname not given.seed (str or int, optional) – The random seed of the data set to be read. If not given, and filename not given, then a box will be read if it matches the kind and hsh, with an arbitrary seed.
load_data (bool, optional) – Whether to read in the data in the data set. Otherwise, only its defining parameters are read.
- Returns:
dataset – An output object, whose type depends on the kind of data set being read.
- Raises:
IOError : – If no files exist of the given kind and hsh.
ValueError : – If either
fname
is not supplied, or bothkind
andhsh
are not supplied.