py21cmfast.cli¶
Module that contains the command line app.
Attributes¶
Classes¶
Common options for choosing simulation parameters. |
|
A trimmed-down version of InputParameters with all defaults of None. |
|
Common parameters for run functions. |
Functions¶
Print all available builtin templates. |
|
|
Show and describe an in-built template. |
|
Generate coeval cubes at given redshifts. |
|
Run a single iteration of 21cmFAST init, saving results to file. |
|
Generate a lightcone between given redshifts. |
|
Show the current simulation parameters. |
|
Create standard plots comparing a default simulation against a simulation with a new feature. |
|
Compute the required storage for an entire run. |
|
Compute the required storage per output kind for given inputs. |
|
|
Print a cool banner for 21cmFAST using rich. |
|
|
Create a new full simulation parameter template. |
Module Contents¶
- 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:
name (str)
description (str)
mode (py21cmfast._templates.TOMLMode)
- 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)