py21cmfast.drivers.Coeval

class py21cmfast.drivers.Coeval

A full coeval box with all associated data.

apply_rsds(field: str = 'brightness_temp', axis: str = 'z', periodic: bool = True, n_rsd_subcells: int = 4)

Apply redshift-space distortions to a particular field of the coeval box.

Parameters:
  • field (str, optional) – The field onto which redshift-space distortions shall be applied. Default is “brightness_temp”.

  • axis (str, optioanl) – The assumed axis of the line-of-sight. Options are “x”, “y”, or “z”. Default is “z”.

  • periodic (bool, optioanl) – Whether to assume periodic boundary conditions along the line-of-sight. Default is True.

  • n_rsd_subcells (int, optional) – The number of subcells into which each cell is divided when redshift space distortions are applied. Default is 4.

Returns:

field_with_rsds – A box of the field, with redshift space distortions.

Parameters:
  • field (str)

  • axis (str)

  • periodic (bool)

  • n_rsd_subcells (int)

apply_velocity_corrections(axis: str = 'z', periodic: bool = True, n_rsd_subcells: int = 4)

Apply velocity gradient corrections and redshift-space distortions to the brightness temperature field.

Parameters:
  • axis (str, optioanl) – The assumed axis of the line-of-sight. Options are “x”, “y”, or “z”. Default is “z”.

  • periodic (bool, optioanl) – Whether to assume periodic boundary conditions along the line-of-sight. Default is True.

  • n_rsd_subcells (int, optional) – The number of subcells into which each cell is divided when redshift space distortions are applied. Default is 4.

Returns:

field_with_rsds – A box of the brightness temperature, with velocity gradient corrections and redshift-space distortions.

Parameters:
  • axis (str)

  • periodic (bool)

  • n_rsd_subcells (int)

classmethod from_file(path: str | pathlib.Path, safe: bool = True) Self

Read the Coeval object from disk and return it.

Parameters:
  • path (str | pathlib.Path)

  • safe (bool)

Return type:

Self

classmethod get_fields(ignore_structs: tuple[str, Ellipsis] = ()) list[str]

Obtain a list of name of simulation boxes saved in the Coeval object.

Parameters:

ignore_structs (tuple[str, Ellipsis])

Return type:

list[str]

include_dvdr_in_tau21(axis: str = 'z', periodic: bool = True)

Include velocity gradient corrections to the brightness temperature field.

Parameters:
  • axis (str, optioanl) – The assumed axis of the line-of-sight. Options are “x”, “y”, or “z”. Default is “z”.

  • periodic (bool, optioanl) – Whether to assume periodic boundary conditions along the line-of-sight. Default is True.

Returns:

tb_with_dvdr – A box of the brightness temperature, with velocity gradient corrections.

Parameters:
  • axis (str)

  • periodic (bool)

prepare_for_next_snapshot(keepset: collections.abc.Sequence[str] | None = None, force: bool = False)

Purge intermediate computational fields to save memory.

Purges all output structs except those specified in keep.

Parameters:
  • keep (list[str], optional) – Names of structs to keep (not purge).

  • force (bool) – Force purge even if not saved to disk.

Parameters:
  • keepset (collections.abc.Sequence[str] | None)

  • force (bool)

save(path: str | pathlib.Path, clobber=False)

Save the Coeval object to disk.

Parameters:

path (str | pathlib.Path)

property astro_options

Flag Options shared by all datasets.

property astro_params

Astro params shared by all datasets.

brightness_temperature: py21cmfast.wrapper.outputs.BrightnessTemp
property cosmo_params

Cosmo params shared by all datasets.

halobox: py21cmfast.wrapper.outputs.HaloBox | None
initial_conditions: py21cmfast.wrapper.outputs.InitialConditions
property inputs: py21cmfast.wrapper.inputs.InputParameters

An InputParameters object associated with the coeval box.

Return type:

py21cmfast.wrapper.inputs.InputParameters

ionized_box: py21cmfast.wrapper.outputs.IonizedBox
property matter_options

Matter Flags shared by all datasets.

property output_structs: dict[str, py21cmfast.wrapper.outputs.OutputStruct]

Get a dictionary of OutputStruct objects contained in this Coeval instance.

This property method returns a dictionary containing all the OutputStruct objects that are attributes of the Coeval instance. It filters out any non-OutputStruct attributes.

Returns:

dict[str, OutputStruct] – A dictionary where the keys are attribute names and the values are the corresponding OutputStruct objects.

Return type:

dict[str, py21cmfast.wrapper.outputs.OutputStruct]

perturbed_field: py21cmfast.wrapper.outputs.PerturbedField
photon_nonconservation_data: dict
property random_seed

Random seed shared by all datasets.

property redshift: float

The redshift of the coeval box.

Return type:

float

property simulation_options

Matter Params shared by all datasets.

ts_box: py21cmfast.wrapper.outputs.TsBox | None