py21cmfast.inputs.UserParams

class py21cmfast.inputs.UserParams(*args, **kwargs)[source]

Structure containing user parameters (with defaults).

To see default values for each parameter, use UserParams._defaults_. All parameters passed in the constructor are also saved as instance attributes which should be considered read-only. This is true of all input-parameter classes.

Parameters:
  • HII_DIM (int, optional) – Number of cells for the low-res box. Default 200.

  • DIM (int,optional) – Number of cells for the high-res box (sampling ICs) along a principal axis. To avoid sampling issues, DIM should be at least 3 or 4 times HII_DIM, and an integer multiple. By default, it is set to 3*HII_DIM.

  • NON_CUBIC_FACTOR (float, optional) – Factor which allows the creation of non-cubic boxes. It will shorten/lengthen the line of sight dimension of all boxes. NON_CUBIC_FACTOR * DIM/HII_DIM must result in an integer

  • BOX_LEN (float, optional) – Length of the box, in Mpc. Default 300 Mpc.

  • HMF (int or str, optional) – Determines which halo mass function to be used for the normalisation of the collapsed fraction (default Sheth-Tormen). If string should be one of the following codes: 0: PS (Press-Schechter) 1: ST (Sheth-Tormen) 2: Watson (Watson FOF) 3: Watson-z (Watson FOF-z)

  • USE_RELATIVE_VELOCITIES (int, optional) – Flag to decide whether to use relative velocities. If True, POWER_SPECTRUM is automatically set to 5. Default False.

  • POWER_SPECTRUM (int or str, optional) – Determines which power spectrum to use, default EH (unless USE_RELATIVE_VELOCITIES is True). If string, use the following codes: 0: EH 1: BBKS 2: EFSTATHIOU 3: PEEBLES 4: WHITE 5: CLASS (single cosmology)

  • N_THREADS (int, optional) – Sets the number of processors (threads) to be used for performing 21cmFAST. Default 1.

  • PERTURB_ON_HIGH_RES (bool, optional) – Whether to perform the Zel’Dovich or 2LPT perturbation on the low or high resolution grid.

  • NO_RNG (bool, optional) – Ability to turn off random number generation for initial conditions. Can be useful for debugging and adding in new features

  • USE_FFTW_WISDOM (bool, optional) – Whether or not to use stored FFTW_WISDOMs for improving performance of FFTs

  • USE_INTERPOLATION_TABLES (bool, optional) – If True, calculates and evaluates quantites using interpolation tables, which is considerably faster than when performing integrals explicitly.

  • FAST_FCOLL_TABLES (bool, optional) – Whether to use fast Fcoll tables, as described in Appendix of Muñoz+21 (2110.13919). Significant speedup for minihaloes.

  • USE_2LPT (bool, optional) – Whether to use second-order Lagrangian perturbation theory (2LPT). Set this to True if the density field or the halo positions are extrapolated to low redshifts. The current implementation is very naive and adds a factor ~6 to the memory requirements. Reference: Scoccimarro R., 1998, MNRAS, 299, 1097-1118 Appendix D.

  • MINIMIZE_MEMORY (bool, optional) – If set, the code will run in a mode that minimizes memory usage, at the expense of some CPU/disk-IO. Good for large boxes / small computers.

Methods

__init__(*args, **kwargs)

clone(**kwargs)

Make a fresh copy of the instance with arbitrary parameters updated.

convert(key, val)

Make any conversions of values before saving to the instance.

get_fieldnames([cstruct])

Obtain the C-side field names of this struct.

get_fields([cstruct])

Obtain the C-side fields of this struct.

get_pointer_fields([cstruct])

Obtain all pointer fields of the struct (typically simulation boxes).

refresh_cstruct()

Delete the underlying C object, forcing it to be rebuilt.

update(**kwargs)

Update the parameters of an existing class structure.

Attributes

DIM

Number of cells for the high-res box (sampling ICs) along a principal axis.

FAST_FCOLL_TABLES

Check that USE_INTERPOLATION_TABLES is True.

HII_tot_num_pixels

Total number of pixels in the low-res box.

HMF

The HMF to use (an int, mapping to a given form).

NON_CUBIC_FACTOR

Factor to shorten/lengthen the line-of-sight dimension (non-cubic boxes).

POWER_SPECTRUM

The power spectrum generator to use, as an integer.

USE_INTERPOLATION_TABLES

Whether to use interpolation tables for integrals, speeding things up.

defining_dict

Pure python dictionary representation of this class, as it would appear in C.

fieldnames

List names of fields of the underlying C struct.

fields

List of fields of the underlying C struct (a list of tuples of "name, type").

hmf_model

String representation of the HMF model used.

pointer_fields

List of names of fields which have pointer type in the C struct.

power_spectrum_model

String representation of the power spectrum model used.

primitive_fields

List of names of fields which have primitive type in the C struct.

pystruct

A pure-python dictionary representation of the corresponding C structure.

self

Dictionary which if passed to its own constructor will yield an identical copy.

tot_fft_num_pixels

Total number of pixels in the high-res box.