py21cmfast.wrapper.inputs.AstroOptions¶
- class py21cmfast.wrapper.inputs.AstroOptions¶
Bases:
InputStructOptions for the ionization routines which enable/disable certain modules.
- Parameters:
USE_MINI_HALOS (bool, optional) – Set to True if using mini-halos parameterization. If True, USE_TS_FLUCT and INHOMO_RECO must be True.
USE_X_RAY_HEATING (bool, optional) – Whether to include X-ray heating (useful for debugging).
USE_CMB_HEATING (bool, optional) – Whether to include CMB heating. (cf Eq.4 of Meiksin 2021, arxiv.org/abs/2105.14516)
USE_LYA_HEATING (bool, optional) – Whether to use Lyman-alpha heating. (cf Sec. 3 of Reis+2021, doi.org/10.1093/mnras/stab2089)
INHOMO_RECO (bool, optional) – Whether to perform inhomogeneous recombinations. Increases the computation time.
USE_TS_FLUCT (bool, optional) – Whether to perform IGM spin temperature fluctuations (i.e. X-ray heating). Dramatically increases the computation time.
M_MIN_in_Mass (bool, optional) – Whether the minimum halo mass (for ionization) is defined by mass or virial temperature. Only has an effect when SOURCE_MODEL == ‘CONST-ION-EFF’
PHOTON_CONS_TYPE (str, optional) – Whether to perform a small correction to account for the inherent photon non-conservation. This can be one of three types of correction:
no-photoncons: No photon cosnervation correction, z-photoncons: Photon conservation correction by adjusting the redshift of the N_ion source field (Park+22) alpha-photoncons: Adjustment to the escape fraction power-law slope, based on fiducial results in Park+22, This runs a series of global xH evolutions and one calibration simulation to find the adjustment as a function of xH f-photoncons: Adjustment to the escape fraction normalisation, runs one calibration simulation to find the adjustment as a function of xH where f’/f = xH_global/xH_calibration
FIX_VCB_AVG (bool, optional) – Determines whether to use a fixed vcb=VAVG (regardless of USE_RELATIVE_VELOCITIES). It includes the average effect of velocities but not its fluctuations. See Muñoz+21 (2110.13919).
USE_EXP_FILTER (bool, optional) – Use the exponential filter (MFP-epsilon(r) from Davies & Furlanetto 2021) when calculating ionising emissivity fields NOTE: this does not affect other field filters, and should probably be used with HII_FILTER==0 (real-space top-hat)
CELL_RECOMB (bool, optional) – An alternate way of counting recombinations based on the local cell rather than the filter region. This is part of the perspective shift (see Davies & Furlanetto 2021) from counting photons/atoms in a sphere and flagging a central pixel to counting photons which we expect to reach the central pixel, and taking the ratio of atoms in the pixel. This flag simply turns off the filtering of N_rec grids, and takes the recombinations in the central cell.
USE_UPPER_STELLAR_TURNOVER (bool, optional) – Whether to use an additional powerlaw in stellar mass fraction at high halo mass. The pivot mass scale and power-law index are controlled by two parameters, UPPER_STELLAR_TURNOVER_MASS and UPPER_STELLAR_TURNOVER_INDEX respectively. This is currently only implemented using the discrete halo model, and has no effect otherwise.
HALO_SCALING_RELATIONS_MEDIAN (bool, optional) – If True, halo scaling relation parameters (F_STAR10,t_STAR etc…) define the median of their conditional distributions If False, they describe the mean. This becomes important when using non-symmetric dristributions such as the log-normal
HII_FILTER (string) – Filter for the halo or density field used to generate ionization field Available options are: ‘spherical-tophat’, ‘sharp-k’, and ‘gaussian’
HEAT_FILTER (int) – Filter for the halo or density field used to generate the spin-temperature field Available options are: ‘spherical-tophat’, ‘sharp-k’, and ‘gaussian’
IONISE_ENTIRE_SPHERE (bool, optional) – If True, ionises the entire sphere on the filter scale when an ionised region is found in the excursion set.
INTEGRATION_METHOD_ATOMIC (str, optional) – The integration method to use for conditional MF integrals of atomic halos in the grids: NOTE: global integrals will use GSL QAG adaptive integration ‘GSL-QAG’: GSL QAG adaptive integration, ‘GAUSS-LEGENDRE’: Gauss-Legendre integration, previously forced in the interpolation tables, ‘GAMMA-APPROX’: Approximate integration, assuming sharp cutoffs and a triple power-law for sigma(M) based on EPS
INTEGRATION_METHOD_MINI (str, optional) – The integration method to use for conditional MF integrals of minihalos in the grids: ‘GSL-QAG’: GSL QAG adaptive integration, ‘GAUSS-LEGENDRE’: Gauss-Legendre integration, previously forced in the interpolation tables, ‘GAMMA-APPROX’: Approximate integration, assuming sharp cutoffs and a triple power-law for sigma(M) based on EPS
- classmethod __init_subclass__()¶
Store each subclass for easy access.
- Return type:
None
- __str__()¶
Human-readable string representation of the object.
- Return type:
str
- asdict()¶
Return a dict representation of the instance.
Examples
This dict should be such that doing the following should work, i.e. it can be used exactly to construct a new instance of the same object:
>>> inp = InputStruct(**params) >>> newinp =InputStruct(**inp.asdict()) >>> inp == newinp
- Return type:
dict
- clone(**kwargs)¶
Make a fresh copy of the instance with arbitrary parameters updated.
- classmethod from_subdict(dct, safe=True)¶
Construct an instance of a parameter structure from a dictionary.
- classmethod new(x=None, **kwargs)¶
Create a new instance of the struct.
- Parameters:
x (dict | InputStruct | None) – Initial values for the struct. If x is a dictionary, it should map field names to their corresponding values. If x is an instance of this class, its attributes will be used as initial values. If x is None, the struct will be initialised with default values.
- Other Parameters:
All other parameters should be passed as if directly to the class constructor
(i.e. as parameter names).
- Parameters:
x (dict | Self | None)
Examples
>>> up = SimulationOptions({'HII_DIM': 250}) >>> up.HII_DIM 250 >>> up = SimulationOptions(up) >>> up.HII_DIM 250 >>> up = SimulationOptions() >>> up.HII_DIM 200 >>> up = SimulationOptions(HII_DIM=256) >>> up.HII_DIM 256
- CELL_RECOMB: bool¶
- FIX_VCB_AVG: bool¶
- HALO_SCALING_RELATIONS_MEDIAN: bool¶
- HEAT_FILTER: FilterOptions¶
- HII_FILTER: FilterOptions¶
- INHOMO_RECO: bool¶
- INTEGRATION_METHOD_ATOMIC: IntegralMethods¶
- INTEGRATION_METHOD_MINI: IntegralMethods¶
- IONISE_ENTIRE_SPHERE: bool¶
- M_MIN_in_Mass: bool¶
- PHOTON_CONS_TYPE: Literal['no-photoncons', 'z-photoncons', 'alpha-photoncons', 'f-photoncons']¶
- USE_CMB_HEATING: bool¶
- USE_EXP_FILTER: bool¶
- USE_LYA_HEATING: bool¶
- USE_MINI_HALOS: bool¶
- USE_TS_FLUCT: bool¶
- USE_UPPER_STELLAR_TURNOVER: bool¶
- USE_X_RAY_HEATING: bool¶
- property cdict: dict¶
A python dictionary containing the properties of the wrapped C-struct.
The memory pointed to by this dictionary is not owned by the wrapped C-struct, but is rather just a python dict. However, in contrast to
asdict(), this method transforms the properties to what they should be in C (e.g. linear space vs. log-space) before putting them into the dict.This dict also contains only the properties of the wrapped C-struct, rather than all properties of the
InputStructinstance (some attributes of the python instance are there only to guide setting of defaults, and don’t appear in the C-struct at all).- Return type:
dict
- property cstruct: py21cmfast.wrapper.structs.StructWrapper¶
The object pointing to the memory accessed by C-code for this struct.
- Return type:
- property struct: py21cmfast.wrapper.structs.StructWrapper¶
The python-wrapped struct associated with this input object.
- Return type: