py21cmfast.wrapper.inputs

Input parameter classes.

There are four input parameter/option classes, not all of which are required for any given function. They are SimulationOptions, CosmoParams, AstroParams and AstroOptions. Each of them defines a number of variables, and all of these have default values, to minimize the burden on the user. These defaults are accessed via the _defaults_ class attribute of each class. The available parameters for each are listed in the documentation for each class below.

Attributes

Exceptions

InputCrossValidationError

Initialize self. See help(type(self)) for accurate signature.

Classes

AstroOptions

Options for the ionization routines which enable/disable certain modules.

AstroParams

Astrophysical parameters.

CosmoParams

Cosmological parameters (with defaults) which translates to a C struct.

CosmoTables

Class for storing interpolation tables of cosmological functions (e.g. transfer functions, growth factor).

InputParameters

A class defining a collection of InputStruct instances.

InputStruct

A convenient interface to create a C structure with defaults specified.

MatterOptions

Structure containing options which affect the matter field (ICs, perturbedfield, halos).

SimulationOptions

Structure containing broad simulation options.

Table1D

Class for setting 1D interpolation table.

Functions

between(mn, mx)

Validate that a value is between two values.

check_halomass_range(inputs)

Check that the halo mass range is sensible given the parameters.

choice_field(*[, validator])

Create an attrs.field that is a choice.

choice_transformer(choice, att)

Produce a transformer that converts a string to int.

choice_validator(inst, att, val)

Validate that a value is one of the choices.

dex2exp_transformer(x, att)

Convert from dex to exponential space.

field(*[, transformer])

Define an attrs field with a 'transformer' property.

get_logspaced_redshifts(min_redshift, z_step_factor, ...)

Compute a sequence of redshifts to evolve over that are log-spaced.

input_param_field(kls)

Create an attrs field that must be an InputStruct.

logtransformer(x, att)

Convert from log to linear space.

Module Contents

py21cmfast.wrapper.inputs.between(mn, mx)[source]

Validate that a value is between two values.

py21cmfast.wrapper.inputs.check_halomass_range(inputs)[source]

Check that the halo mass range is sensible given the parameters.

This function checks that the minimum halo mass set by the various resolutions and flags does not have any gaps. We raise an error if there is a gap, and a warning if it is above the turnover mass.

Parameters:

inputs (InputParameters)

Return type:

None

py21cmfast.wrapper.inputs.choice_field(*, validator=None, **kwargs)[source]

Create an attrs.field that is a choice.

py21cmfast.wrapper.inputs.choice_transformer(choice, att)[source]

Produce a transformer that converts a string to int.

The function must be passed a list of string choices. The resulting int is the index of the choice made.

Parameters:
  • choice (str)

  • att (attrs.Attribute)

Return type:

int

py21cmfast.wrapper.inputs.choice_validator(inst, att, val)[source]

Validate that a value is one of the choices.

Parameters:

att (attrs.Attribute)

py21cmfast.wrapper.inputs.dex2exp_transformer(x, att)[source]

Convert from dex to exponential space.

Parameters:

att (attrs.Attribute)

py21cmfast.wrapper.inputs.field(*, transformer=None, **kw)[source]

Define an attrs field with a ‘transformer’ property.

The transformer, if given, should be a function of a single variable, which will be the attribute’s value. It will be used to transform the value before usage in C-code (e.g. by transformin from log to linear space).

py21cmfast.wrapper.inputs.get_logspaced_redshifts(min_redshift, z_step_factor, max_redshift)[source]

Compute a sequence of redshifts to evolve over that are log-spaced.

Parameters:
  • min_redshift (float)

  • z_step_factor (float)

  • max_redshift (float)

Return type:

tuple[float]

py21cmfast.wrapper.inputs.input_param_field(kls)[source]

Create an attrs field that must be an InputStruct.

Parameters:

kls (InputStruct subclass) – The parameter structure which should be returned as an attrs field

Parameters:

kls (InputStruct)

py21cmfast.wrapper.inputs.logtransformer(x, att)[source]

Convert from log to linear space.

Parameters:

att (attrs.Attribute)

py21cmfast.wrapper.inputs.FilterOptions[source]
py21cmfast.wrapper.inputs.IntegralMethods[source]
py21cmfast.wrapper.inputs.Planck18[source]
py21cmfast.wrapper.inputs.logger[source]