py21cmfast.io.caching.OutputCache ================================= .. py:class:: py21cmfast.io.caching.OutputCache An object that manages cache files from 21cmFAST simulations. This object has a single attribute -- the top-level directory of the cache. This directory can be anywhere on disk. A number of methods exist on the object to interact with the cache, including finding existing cache files for a particular OutputStruct, writing/reading an OutputStruct to/from the cache, and listing existing datasets. The cache is meant for single-field OutputStruct objects, not "collections" of outputs in an evolved universe (like Coeval or Lightcone objects). .. !! processed by numpydoc !! .. py:method:: find_existing(obj: py21cmfast.wrapper.outputs.OutputStruct) -> pathlib.Path | None Try to find existing boxes which match the parameters of this instance. :Parameters: **obj** (*OutputStruct*) -- The OutputStruct instance to search for. :returns: *Path* -- The path to an existing cached OutputStruct matching this instance, or None if no match is found. .. !! processed by numpydoc !! .. py:method:: get_filename(obj: py21cmfast.wrapper.outputs.OutputStruct) -> str Generate a filename for a given OutputStruct object based on its properties. This method constructs a unique filename using the object's class name, redshift (if available), and hashes of its input parameters. The filename structure is determined by the _path_structures dictionary. :Parameters: **obj** (*OutputStruct*) -- The OutputStruct object for which to generate a filename. :returns: *str* -- The generated filename for the given OutputStruct object. .. !! processed by numpydoc !! .. py:method:: get_path(obj: py21cmfast.wrapper.outputs.OutputStruct) -> pathlib.Path Get the full path for a given OutputStruct object. This method combines the cache directory with the filename generated for the given OutputStruct object to create a complete file path. :Parameters: **obj** (*OutputStruct*) -- The OutputStruct object for which to generate the full path. :returns: *Path* -- The complete file path for the given OutputStruct object. .. !! processed by numpydoc !! .. py:method:: list_datasets(*, kind: str | None = None, inputs: py21cmfast.wrapper.inputs.InputParameters | None = None, all_seeds: bool = True, redshift: float | None = None) -> list[pathlib.Path] Return all datasets in the cache which match a given set of filters. :Parameters: * **kind** (*str, optional*) -- Filter by this kind (a class name of an OutputStruct). * **inputs** (*InputParameters*) -- Filter by these input parameters * **all_seeds** -- Set to False to only include the seed within `inputs`. * **redshift** -- The redshift to search for. :returns: *files* -- list of paths pointing to files matching the filters. .. !! processed by numpydoc !! .. py:method:: load(obj: py21cmfast.wrapper.outputs.OutputStruct) -> py21cmfast.wrapper.outputs.OutputStruct Load a cache-backed object from disk corresponding to a given object. .. !! processed by numpydoc !! .. py:method:: write(obj: py21cmfast.wrapper.outputs.OutputStruct) -> None Write an OutputStruct object to the cache. This method writes the given OutputStruct object to an HDF5 file in the cache, using the path determined by the object's properties. :Parameters: **obj** (*OutputStruct*) -- The OutputStruct object to be written to the cache. .. !! processed by numpydoc !! .. py:attribute:: direc :type: pathlib.Path