py21cmfast.cli

Module that contains the command line app.

Attributes

Classes

ParameterSelection

Common options for choosing simulation parameters.

Parameters

A trimmed-down version of InputParameters with all defaults of None.

RunParams

Common parameters for run functions.

Functions

cfg_avail()

Print all available builtin templates.

cfg_show(names[, mode])

Show and describe an in-built template.

coeval(redshifts[, options, params, out, ...])

Generate coeval cubes at given redshifts.

ics([options, params, min_evolved_redshift])

Run a single iteration of 21cmFAST init, saving results to file.

lightcone([options, params, redshift_range, out, ...])

Generate a lightcone between given redshifts.

params([params])

Show the current simulation parameters.

pr_feature([options, params, redshift_range, outdir])

Create standard plots comparing a default simulation against a simulation with a new feature.

predict_storage_size([param_selection, user_params, ...])

Compute the required storage for an entire run.

predict_struct_size([param_selection, user_params, ...])

Compute the required storage per output kind for given inputs.

pretty_print_inputs(inputs, name, description[, mode])

print_banner()

Print a cool banner for 21cmFAST using rich.

template_create(out[, param_selection, user_params, mode])

Create a new full simulation parameter template.

Module Contents

py21cmfast.cli.cfg_avail()[source]

Print all available builtin templates.

py21cmfast.cli.cfg_show(names, mode='full')[source]

Show and describe an in-built template.

Parameters:
  • names (Annotated[list[Literal[*AVAILABLE_TEMPLATES]], Parameter(accepts_keys=False)])

  • mode (py21cmfast._templates.TOMLMode)

py21cmfast.cli.coeval(redshifts, options=RunParams(), params=Parameters(), out=Path(), save_all_redshifts=False, min_evolved_redshift=5.5)[source]

Generate coeval cubes at given redshifts.

To specify simulation parameters, use a base template (either via –param-file or –template) and optionally override any particular simulation parameters. To see the available simulation parameters and how to specify them, use 21cmfast run params –help.

Parameters:
  • redshifts – The redshifts at which to generate the coeval boxes.

  • out – The path at which to save the coeval boxes. The coeval data at each redshift will be saved to the filename “coeval_z{redshift:.2f}.h5”.

  • save_all_redshifts – Whether to save all redshifts in node_redshifts (i.e. all those in the evolution of the simulation), or only those in the redshifts given.

  • min_evolved_redshift – The minimum redshift down to which to evolve the simulation. For some simulation configurations, this is not used at all, while for others it will subtly change the evolution.

Parameters:
  • redshifts (Annotated[list[float], Parameter(alias=('-z', ), required=True)])

  • options (RunParams)

  • params (Annotated[Parameters, Parameter(show=False, name='*')])

  • out (Annotated[cyclopts.types.ExistingDirectory, Parameter(name=('--out', '-o'))])

  • save_all_redshifts (Annotated[bool, Parameter(name=('--save-all-redshifts', '-a', '--all'))])

  • min_evolved_redshift (Annotated[float, Parameter(name=('--zmin-evolution', '--zmin'))])

py21cmfast.cli.ics(options=RunParams(), params=Parameters(), min_evolved_redshift=5.5)[source]

Run a single iteration of 21cmFAST init, saving results to file.

To specify simulation parameters, use a base template (either via –param-file or –template) and optionally override any particular simulation parameters. To see the available simulation parameters and how to specify them, use 21cmfast run params –help.

Parameters:

min_evolved_redshift – The minimum redshift down to which to evolve the simulation. For some simulation configurations, this is not used at all, while for others it will subtly change the evolution.

Parameters:
  • options (RunParams)

  • params (Annotated[Parameters, Parameter(show=False, name='*')])

  • min_evolved_redshift (Annotated[float, Parameter(name=('--zmin-evolution', '--zmin'))])

py21cmfast.cli.lightcone(options=RunParams(), params=Parameters(), redshift_range=(6.0, 30.0), out=Path('lightcone.h5'), lightcone_quantities=('brightness_temp',), min_evolved_redshift=5.5)[source]

Generate a lightcone between given redshifts.

To specify simulation parameters, use a base template (either via –param-file or –template) and optionally override any particular simulation parameters. To see the available simulation parameters and how to specify them, use 21cmfast run params –help.

Parameters:
  • redshift_range – The redshifts between which to generate the lightcone.

  • out – The filename to which to save the lightcone data.

  • lightcone_quantities – Computed fields to generate lightcones for.

  • min_evolved_redshift – The minimum redshift down to which to evolve the simulation. For some simulation configurations, this is not used at all, while for others it will subtly change the evolution.

Parameters:
  • options (RunParams)

  • params (Annotated[Parameters, Parameter(show=False, name='*')])

  • redshift_range (tuple[float, float])

  • out (Annotated[pathlib.Path, Parameter(validator=(vld.Path(dir_okay=False, file_okay=False, ext=('h5', )), ))])

  • lightcone_quantities (Annotated[tuple[str], Parameter(alias=('--lq', ))])

  • min_evolved_redshift (Annotated[float, Parameter(name=('--zmin-evolution', '--zmin'))])

py21cmfast.cli.params(params=Parameters())[source]

Show the current simulation parameters.

Parameters:

params (Parameters)

py21cmfast.cli.pr_feature(options=RunParams(), params=Parameters(), redshift_range=(6.0, 30.0), outdir=Path())[source]

Create standard plots comparing a default simulation against a simulation with a new feature.

The base of the comparison is set by either –param-file or –template. The “new feature” which is to be compared is set by overriding specific parameters at the command line (e.g –use-ts-fluct).

Plots are saved in the current directory, with the prefix “pr_feature”.

Parameters:

redshift_range – The redshifts between which to compute the lightcones for comparison.

Parameters:
  • options (RunParams)

  • params (Parameters)

  • redshift_range (tuple[float, float])

  • outdir (cyclopts.types.ExistingDirectory)

py21cmfast.cli.predict_storage_size(param_selection=ParameterSelection(), user_params=Parameters(), min_evolved_redshift=5.5, unit=None, cache_config='on')[source]

Compute the required storage for an entire run.

Parameters:
  • param_selection (ParameterSelection)

  • user_params (Parameters)

  • min_evolved_redshift (Annotated[float, Parameter(name=('--zmin-evolution', '--zmin'))])

  • unit (Literal['b', 'kb', 'mb', 'gb'] | None)

  • cache_config (Literal['on', 'off', 'noloop', 'last_step_only'])

py21cmfast.cli.predict_struct_size(param_selection=ParameterSelection(), user_params=Parameters(), unit=None, cache_config='on')[source]

Compute the required storage per output kind for given inputs.

Parameters:
  • param_selection (ParameterSelection)

  • user_params (Parameters)

  • unit (Literal['b', 'kb', 'mb', 'gb'] | None)

  • cache_config (Literal['on', 'off', 'noloop', 'last_step_only'])

py21cmfast.cli.pretty_print_inputs(inputs, name, description, mode='full')[source]
Parameters:
py21cmfast.cli.print_banner()[source]

Print a cool banner for 21cmFAST using rich.

py21cmfast.cli.template_create(out, param_selection=ParameterSelection(), user_params=Parameters(), mode='full')[source]

Create a new full simulation parameter template.

The created template file (TOML file) contains all of the available parameters. To create it, use a base template (either via –param-file or –template) and optionally override any particular simulation parameters. To see the available simulation parameters and how to specify them, use 21cmfast run params –help.

Parameters:
  • out (Annotated[cyclopts.types.TomlPath, Parameter(validator=vld.Path(file_okay=False, dir_okay=False, ext=('toml', )))])

  • param_selection (ParameterSelection)

  • user_params (Parameters)

  • mode (py21cmfast._templates.TOMLMode)

py21cmfast.cli.AVAILABLE_TEMPLATES: list[str][source]
py21cmfast.cli.FORMAT = '%(message)s'[source]
py21cmfast.cli.app[source]
py21cmfast.cli.cns[source]
py21cmfast.cli.logger[source]