py21cmfast.cli¶
Module that contains the command line app.
Attributes¶
Classes¶
Parameters for setting the node redshifts of the simulation. |
|
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. |
|
Generate the global evolution between 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: Annotated[list[Literal[*AVAILABLE_TEMPLATES]], Parameter(accepts_keys=False)], mode: py21cmfast._templates.TOMLMode = '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: Annotated[list[float], Parameter(alias='-z', required=True)], options: RunParams = RunParams(), params: Annotated[Parameters, Parameter(show=False, name='*')] = Parameters(), out: Annotated[cyclopts.types.ExistingDirectory, Parameter(name='--out', '-o')] = Path(), save_all_redshifts: Annotated[bool, Parameter(name='--save-all-redshifts', '-a', '--all')] = False, nodez_params: NodeRedshiftParameters | None = None)[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'))])
nodez_params (NodeRedshiftParameters | None)
- py21cmfast.cli.global_evolution(source_model: Literal['E-INTEGRAL', 'CONST-ION-EFF', 'L-INTEGRAL'] | None = None, options: RunParams = RunParams(param_selection=ParameterSelection(template=['EOS21'])), params: Annotated[Parameters, Parameter(show=False, name='*')] = Parameters(), min_evolved_redshift: Annotated[float, Parameter(name='--zmin-evolution', '--zmin')] = 5.5, out: Annotated[pathlib.Path, Parameter(validator=vld.Path(dir_okay=False, file_okay=False, ext='h5'))] = Path('global-evolution.h5'))[source]¶
Generate the global evolution 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:
zmin – The minimum redshift down to which to generate the global evolution.
out – The filename to which to save the global evolution data.
- Parameters:
source_model (Literal['E-INTEGRAL', 'CONST-ION-EFF', 'L-INTEGRAL'] | None)
options (RunParams)
params (Annotated[Parameters, Parameter(show=False, name='*')])
min_evolved_redshift (Annotated[float, Parameter(name=('--zmin-evolution', '--zmin'))])
out (Annotated[pathlib.Path, Parameter(validator=(vld.Path(dir_okay=False, file_okay=False, ext=('h5', )), ))])
- py21cmfast.cli.ics(options: RunParams = RunParams(), params: Annotated[Parameters, Parameter(show=False, name='*')] = Parameters(), nodez_params: NodeRedshiftParameters | None = None)[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:
nodez_params – Parameters for setting the redshifts at which to evolve the simulation.
- Parameters:
options (RunParams)
params (Annotated[Parameters, Parameter(show=False, name='*')])
nodez_params (NodeRedshiftParameters | None)
- py21cmfast.cli.lightcone(options: RunParams = RunParams(), params: Annotated[Parameters, Parameter(show=False, name='*')] = Parameters(), redshift_range: tuple[float, float] = (6.0, 30.0), out: Annotated[pathlib.Path, Parameter(validator=vld.Path(dir_okay=False, file_okay=False, ext='h5'))] = Path('lightcone.h5'), lightcone_quantities: Annotated[tuple[str], Parameter(alias='--lq')] = ('brightness_temp',), nodez_params: NodeRedshiftParameters | None = None)[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.
- 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', ))])
nodez_params (NodeRedshiftParameters | None)
- py21cmfast.cli.params(simulation_options: Annotated[_SimulationOptions, Parameter(name='*', group='SimulationOptions')] = _SimulationOptions(), astro_options: Annotated[_AstroOptions, Parameter(name='*', group='AstroOptions')] = _AstroOptions(), astro_params: Annotated[_AstroParams, Parameter(name='*', group='AstroParams')] = _AstroParams(), cosmo_params: Annotated[_CosmoParams, Parameter(name='*', group='CosmoParams')] = _CosmoParams(), matter_options: Annotated[_MatterOptions, Parameter(name='*', group='MatterOptions')] = _MatterOptions())[source]¶
Show the current simulation parameters.
- Parameters:
simulation_options (Annotated[_SimulationOptions, Parameter(name='*', group='SimulationOptions')])
astro_options (Annotated[_AstroOptions, Parameter(name='*', group='AstroOptions')])
astro_params (Annotated[_AstroParams, Parameter(name='*', group='AstroParams')])
cosmo_params (Annotated[_CosmoParams, Parameter(name='*', group='CosmoParams')])
matter_options (Annotated[_MatterOptions, Parameter(name='*', group='MatterOptions')])
- py21cmfast.cli.pr_feature(options: RunParams = RunParams(), params: Parameters = Parameters(), redshift_range: tuple[float, float] = (6.0, 30.0), outdir: cyclopts.types.ExistingDirectory = 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 = ParameterSelection(), user_params: Parameters = Parameters(), nodez_params: NodeRedshiftParameters = NodeRedshiftParameters(), unit: Literal['b', 'kb', 'mb', 'gb'] | None = None, cache_config: Literal['on', 'off', 'noloop', 'last_step_only'] = 'on')[source]¶
Compute the required storage for an entire run.
- Parameters:
param_selection (ParameterSelection)
user_params (Parameters)
nodez_params (NodeRedshiftParameters)
unit (Literal['b', 'kb', 'mb', 'gb'] | None)
cache_config (Literal['on', 'off', 'noloop', 'last_step_only'])
- py21cmfast.cli.predict_struct_size(param_selection: ParameterSelection = ParameterSelection(), user_params: Parameters = Parameters(), unit: Literal['b', 'kb', 'mb', 'gb'] | None = None, cache_config: Literal['on', 'off', 'noloop', 'last_step_only'] = 'on', nodez_params: NodeRedshiftParameters = NodeRedshiftParameters())[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'])
nodez_params (NodeRedshiftParameters)
- py21cmfast.cli.pretty_print_inputs(inputs: py21cmfast.wrapper.inputs.InputParameters, name: str, description: str, mode: py21cmfast._templates.TOMLMode = 'full')[source]¶
- Parameters:
name (str)
description (str)
mode (py21cmfast._templates.TOMLMode)
- py21cmfast.cli.template_create(out: Annotated[cyclopts.types.TomlPath, Parameter(validator=vld.Path(file_okay=False, dir_okay=False, ext='toml'))], nodez_params: NodeRedshiftParameters | None = None, param_selection: ParameterSelection = ParameterSelection(), user_params: Parameters = Parameters(), mode: py21cmfast._templates.TOMLMode = 'full', random_seed: Annotated[int | None, Parameter(name=['--random-seed', '--seed'])] = None)[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.
Node redshifts can be embedded in the template by providing one or more of
--nodez.min,--nodez.max,--nodez.step, or--nodez.n. The spacing function is controlled by--nodez.spacing(logspaceorlinear). A random seed can also be embedded with--random-seed.- Parameters:
out – The path at which to save the template file.
mode – The mode in which to write the template file. This controls which parameters are included in the template file.
random_seed – An optional random seed to include in the template file.
- Parameters:
out (Annotated[cyclopts.types.TomlPath, Parameter(validator=vld.Path(file_okay=False, dir_okay=False, ext=('toml', )))])
nodez_params (NodeRedshiftParameters | None)
param_selection (ParameterSelection)
user_params (Parameters)
mode (py21cmfast._templates.TOMLMode)
random_seed (Annotated[int | None, Parameter(name=['--random-seed', '--seed'])])