py21cmfast.drivers.lightcone¶
Module containing a driver function for creating lightcones.
Attributes¶
Classes¶
An angular lightcone. |
|
A full Lightcone with all associated evolved data. |
Functions¶
|
Create a generator function for a lightcone run. |
|
Run a lightcone simulation and return the final lightcone object. |
|
Return a LightCone instance given a lightconer as input. |
Module Contents¶
- py21cmfast.drivers.lightcone.generate_lightcone(*, lightconer: py21cmfast.lightconers.Lightconer, inputs: py21cmfast.wrapper.inputs.InputParameters, initial_conditions: py21cmfast.wrapper.outputs.InitialConditions | None = None, include_dvdr_in_tau21: bool = True, apply_rsds: bool = False, n_rsd_subcells: int = 4, write: py21cmfast.io.caching.CacheConfig = _cache, cache: py21cmfast.io.caching.OutputCache | None = _ocache, regenerate: bool = True, progressbar: bool = False, lightcone_filename: str | pathlib.Path | None = None, global_quantities: collections.abc.Sequence[str] | None = None)[source]¶
Create a generator function for a lightcone run.
This is generally the easiest and most efficient way to generate a lightcone, though it can be done manually by using the lower-level functions which are called by this function.
- Parameters:
lightconer (
Lightconer) – This object specifies the dimensions, redshifts, and quantities required by the lightcone runinputs (
InputParameters) – This object specifies the input parameters for the run, including the random seedinitial_conditions (
InitialConditions, optional) – If given, the user and cosmo params will be set from this object, and it will not be re-calculated.include_dvdr_in_tau21 (bool, optional) – If True, velocity gradient corrections to the 21cm optical depth will be applied. See Mao+ 2012. Default is True.
apply_rsds (bool, optional) – If True, all output lightcones will be transformed from real space to redshift space, according to the peculiar velocity fields. See Mao+ 2012. Default is False.
n_rsd_subcells (int, optional) – The number of subcells into which each cell is divided when redshift space distortions are applied. Becomes relevant only if apply_rsds is True. Default is False.
progressbar (bool, optional) – If True, a progress bar will be displayed throughout the simulation. Defaults to False.
lightcone_filename – The filename to which to save the lightcone. The lightcone is returned in memory, and can be saved manually later, but including this filename will save the lightcone on each iteration, which can be helpful for checkpointing.
global_quantities (sequence of str, optional) – The fields whose mean over the box is saved at every node redshift, in
lightcone.global_quantities. By default, every field returned byLightCone.get_fields(). Each of these fields is read at every node redshift to take its mean, so when the coevals come from the cache, all of them are read from disk at every node redshift. Pass only the fields you need (e.g.lightconer.quantities) to read only those. The turnover masseslog10_mturn_acgandlog10_mturn_mcgare scalars of the ionized box, cost nothing, and are always included. When resuming fromlightcone_filename, give the same global quantities as the run that wrote the file, or leave this as None.
- Returns:
lightcone (
LightCone) – The lightcone object.coeval_callback_output (list) – Only if coeval_callback in not None.
- Other Parameters:
regenerate, write, direc, hooks – See docs of
initial_conditions()for more information.- Parameters:
lightconer (py21cmfast.lightconers.Lightconer)
initial_conditions (py21cmfast.wrapper.outputs.InitialConditions | None)
include_dvdr_in_tau21 (bool)
apply_rsds (bool)
n_rsd_subcells (int)
cache (py21cmfast.io.caching.OutputCache | None)
regenerate (bool)
progressbar (bool)
lightcone_filename (str | pathlib.Path | None)
global_quantities (collections.abc.Sequence[str] | None)
- py21cmfast.drivers.lightcone.run_lightcone(**kwargs) LightCone[source]¶
Run a lightcone simulation and return the final lightcone object.
This simply wraps
generate_lightcone()and returns the final lightcone object after the generator has been exhausted. All parameters are passed directly togenerate_lightcone().- Return type:
- py21cmfast.drivers.lightcone.setup_lightcone_instance(lightconer: py21cmfast.lightconers.Lightconer, scrollz: collections.abc.Sequence[float], inputs: py21cmfast.wrapper.inputs.InputParameters, include_dvdr_in_tau21: bool, apply_rsds: bool, photon_nonconservation_data: dict, lightcone_filename: pathlib.Path | None = None, global_quantities: collections.abc.Sequence[str] | None = None) LightCone[source]¶
Return a LightCone instance given a lightconer as input.
global_quantitiesare the names of the global quantities to save (all the fields ofLightCone.get_fields()if None). When resuming fromlightcone_filename, the file’s global quantities are used, and ifglobal_quantitiesis given it must name the same ones.- Parameters:
lightconer (py21cmfast.lightconers.Lightconer)
scrollz (collections.abc.Sequence[float])
include_dvdr_in_tau21 (bool)
apply_rsds (bool)
photon_nonconservation_data (dict)
lightcone_filename (pathlib.Path | None)
global_quantities (collections.abc.Sequence[str] | None)
- Return type: