py21cmfast.InputParameters ========================== .. py: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** (*float*) -- The seed that determines the realization produced by a 21cmFAST run. * **node_redshifts** (*list[float]*) -- 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** (:class:`~CosmoParams`) -- Cosmological parameters of a 21cmFAST run. * **simulation_options** (:class:`~SimulationOptions`) -- Parameters controlling the simulation as a whole, e.g. the box size and dimensionality. * **matter_options** (:class:`~MatterOptions`) -- Parameters controlling the matter field generated by 21cmFAST. * **astro_options** (:class:`~AstroOptions`) -- Options for which physical processes to include in the simulation. * **astro_params** (:class:`~AstroParams`) -- Astrophysical parameter values. .. !! processed by numpydoc !! .. py:method:: asdict(only_structs: bool = False, camel: bool = False, remove_base_cosmo: bool = True, only_cstruct_params: bool = True, use_aliases: bool = True, include_cosmo_tables: Literal['always', 'if_cached', 'never'] = 'always') -> dict[str, dict[str, Any]] Convert the instance to a recursive dictionary. :Parameters: * **only_structs** -- If True, only include parameter-struct-like fields (including ``cosmo_tables`` when included). * **camel** -- If True, convert top-level input struct keys to CamelCase. * **remove_base_cosmo** -- If True, remove the non-serializable ``_base_cosmo`` object from ``cosmo_params``. * **only_cstruct_params** -- If True, keep only fields that are required by each C struct. * **use_aliases** -- If True, use constructor aliases for InputStruct fields (e.g. ``DIM`` instead of ``_DIM``). * **include_cosmo_tables** -- Controls whether cached cosmology tables are emitted in the dictionary. - ``"always"``: force materialization of :attr:`cosmo_tables` and include it in the output. This is the default for in-memory conversions. - ``"if_cached"``: include tables only if they were already materialized, which avoids triggering CLASS work during serialization. - ``"never"``: omit tables entirely, useful for portable templates. .. !! processed by numpydoc !! .. py:method:: clone(**kwargs) -> Self Generate a copy of the InputParameter structure with specified changes. .. !! processed by numpydoc !! .. py:method:: evolve_input_structs(**kwargs) -> Self 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 .. !! processed by numpydoc !! .. py:method:: from_template(name: str | pathlib.Path | collections.abc.Sequence[str | pathlib.Path], random_seed: int | None = None, node_redshifts: tuple[float] | None = None, **kwargs) -> Self :classmethod: 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. * **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.** .. !! processed by numpydoc !! .. py:method:: is_compatible_with(other: Self) -> bool 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. .. !! processed by numpydoc !! .. py:method:: with_linear_redshifts(zmin: float = 5.5, zmax: float | None = None, step: float | None = None, nz: int | None = None) -> Self Create a new InputParameters instance with linearly-spaced redshifts. :Parameters: * **zmin** -- Minimum redshift of the node grid. * **zmax** -- Maximum redshift of the node grid. Defaults to ``Z_HEAT_MAX`` from :class:`SimulationOptions`. * **zstep** -- Linear step size between consecutive redshifts. The grid will include ``zmin`` and extend up to at least ``zmax``. Ignored when ``nz`` is provided. * **nz** -- If given, produce exactly ``nz`` redshifts linearly spaced between ``zmin`` and ``zmax``, overriding ``step``. .. !! processed by numpydoc !! .. py:method:: with_logspaced_redshifts(zmin: float = 5.5, zmax: float | None = None, step: float | None = None, zstep_factor: float | None = None, nz: int | None = None) -> Self Create a new InputParameters instance with logspaced redshifts. :Parameters: * **zmin** -- Minimum redshift of the node grid. * **zmax** -- Maximum redshift of the node grid. Defaults to ``Z_HEAT_MAX`` from :class:`SimulationOptions`. * **step** -- Multiplicative step factor between consecutive ``(1 + z)`` values. Defaults to ``ZPRIME_STEP_FACTOR`` from :class:`SimulationOptions`. Ignored when ``nz`` is provided. * **nz** -- If given, produce exactly ``nz`` redshifts equally spaced in ``log(1 + z)`` between ``zmin`` and ``zmax``, overriding ``step``. .. !! processed by numpydoc !! .. py:attribute:: astro_options :type: AstroOptions .. py:attribute:: astro_params :type: AstroParams .. py:attribute:: cosmo_params :type: CosmoParams .. py:property:: cosmo_tables :type: CosmoTables Cosmological tables derived from fundamental input parameters. .. !! processed by numpydoc !! .. py:property:: evolution_required :type: bool Whether evolution is required for these parameters. .. !! processed by numpydoc !! .. py:attribute:: matter_options :type: MatterOptions .. py:attribute:: node_redshifts .. py:attribute:: random_seed :type: int .. py:attribute:: simulation_options :type: SimulationOptions