py21cmfast.wrapper.initial_conditions

py21cmfast.wrapper.initial_conditions(*, user_params=None, cosmo_params=None, random_seed=None, regenerate=None, write=None, direc=None, hooks: dict[Callable, dict[str, Any]] | None = None, **global_kwargs) InitialConditions[source]

Compute initial conditions.

Parameters:
  • user_params (UserParams instance, optional) – Defines the overall options and parameters of the run.

  • cosmo_params (CosmoParams instance, optional) – Defines the cosmological parameters used to compute initial conditions.

  • regenerate (bool, optional) – Whether to force regeneration of data, even if matching cached data is found. This is applied recursively to any potential sub-calculations. It is ignored in the case of dependent data only if that data is explicitly passed to the function.

  • write (bool, optional) – Whether to write results to file (i.e. cache). This is recursively applied to any potential sub-calculations.

  • hooks – Any extra functions to apply to the output object. This should be a dictionary where the keys are the functions, and the values are themselves dictionaries of parameters to pass to the function. The function signature should be (output, **params), where the output is the output object.

  • direc (str, optional) – The directory in which to search for the boxes and write them. By default, this is the directory given by boxdir in the configuration file, ~/.21cmfast/config.yml. This is recursively applied to any potential sub-calculations.

  • **global_kwargs – Any attributes for GlobalParams. This will temporarily set global attributes for the duration of the function. Note that arguments will be treated as case-insensitive.

Returns:

InitialConditions