py21cmfast.InputParameters

class py21cmfast.InputParameters

A class defining a collection of InputStruct instances.

This class simplifies combining different InputStruct instances together, performing validation checks between them, and being able to cross-check compatibility between different sets of instances.

Parameters:
  • random_seed – The seed that determines the realization produced by a 21cmFAST run.

  • node_redshifts – The redshifts at which coeval boxes will be computed. By default, empty if no evolution is required, and logarithmically spaced in (1+z) between z=5.5 and SimulationOptions.Z_HEAT_MAX if evolution is required.

  • cosmo_params – Cosmological parameters of a 21cmFAST run.

  • simulation_options – Parameters controlling the simulation as a whole, e.g. the box size and dimensionality.

  • matter_options – Parameters controlling the matter field generated by 21cmFAST.

  • astro_options – Options for which physical processes to include in the simulation.

  • astro_params – Astrophysical parameter values.

__attrs_post_init__()

Run a check after initialization.

Currently just checks that the halo mass ranges are sensible.

Return type:

None

__getitem__(key)

Get an item from the instance in a dict-like manner.

__repr__()

Return a string representation of the structure.

Created by combining repr methods from the InputStructs which make up this object

asdict(only_structs=False, camel=False, remove_base_cosmo=True, only_cstruct_params=True, use_aliases=True)

Convert the instance to a recursive dictionary.

Parameters:
  • only_structs (bool)

  • camel (bool)

  • remove_base_cosmo (bool)

  • only_cstruct_params (bool)

  • use_aliases (bool)

Return type:

dict[str, dict[str, Any]]

clone(**kwargs)

Generate a copy of the InputParameter structure with specified changes.

evolve_input_structs(**kwargs)

Return an altered clone of the InputParameters structs.

Unlike clone(), this function takes fields from the constituent InputStruct classes and only overwrites those sub-fields instead of the entire field

classmethod from_template(name, random_seed, node_redshifts=None, **kwargs)

Construct full InputParameters instance from native or TOML file template.

Parameters:
  • name – Either a name of a built-in template, or a path to a parameter TOML, or a list of such names/paths. If a list, the final parameters will be built from left-to-right so that the parameters at the end of the list will have precedence.

  • random_seed – A random seed to use for the run. Must be specified manually.

  • node_redshifts – The redshifts at which to evolve the simulation (if applicable). Default detects whether evolution is required and sets the node redshifts according to the simulation parameters.

Other Parameters:
  • All other parameters are interpreted as elements of :class:`InputStruct`

  • subclasses (e.g. :class:`SimulationOptions`) and will over-ride what is in

  • the template.

Parameters:
  • name (str | pathlib.Path | collections.abc.Sequence[str | pathlib.Path])

  • random_seed (int)

  • node_redshifts (tuple[float] | None)

is_compatible_with(other)

Check if this object is compatible with another parameter struct.

Compatibility is slightly different from strict equality. Compatibility requires that if a parameter struct exists on the other object, then it must be equal to this one. That is, if astro_params is None on the other InputParameter object, then this one can have astro_params as NOT None, and it will still be compatible. However the inverse is not true – if this one has astro_params as None, then all others must have it as None as well.

Parameters:

other (Self)

Return type:

bool

with_logspaced_redshifts(zmin=5.5, zmax=None, zstep_factor=None)

Create a new InputParameters instance with logspaced redshifts.

Parameters:
  • zmin (float)

  • zmax (float | None)

  • zstep_factor (float | None)

Return type:

Self

astro_options: AstroOptions
astro_params: AstroParams
cosmo_params: CosmoParams
cosmo_tables: CosmoTables
property evolution_required: bool

Whether evolution is required for these parameters.

Return type:

bool

matter_options: MatterOptions
node_redshifts
random_seed
simulation_options: SimulationOptions