py21cmfast.SimulationOptions¶
- class py21cmfast.SimulationOptions¶
Bases:
InputStructStructure containing broad simulation options.
- Parameters:
HII_DIM (int, optional) – Number of cells for the low-res box (after smoothing the high-resolution matter field). Default 256.
HIRES_TO_LOWRES_FACTOR (float, optional) – The ratio of the high-resolution box dimensionality to the low-resolution box dimensionality (i.e. DIM/HII_DIM). Use this parameter to define the size as a fixed ratio, instead of specifying DIM explicitly. This is useful if the parameters will be later evolved, so that specifying a new HII_DIM keeps the fixed resolution. By default, this is None, and a default of DIM=3*HII_DIM is used. This should be at least 3, and generally an integer (though this is not enforced).
DIM (int, optional) – Number of cells for the high-res box (sampling ICs) along a principal axis. In general, prefer setting HIRES_TO_LOWRES_FACTOR instead of DIM directly. Setting both will raise an error.
LOWRES_CELL_SIZE_MPC (float, optional) – The cell size of the low-resolution boxes (i.e. after smoothing the high-resolution matter field). Use either this parameter or BOX_LEN, setting both will raise an error. This parameter is generally preferrable, as it allows you to evolve the HII_DIM later, and keep the same resolution (automatically scaling up BOX_LEN). Default is None, falling back on a cell size of 1.5 Mpc.
BOX_LEN (float, optional) – Length of the box, in Mpc. Prefer setting LOWRES_CELL_SIZE_MPC, which automatically defines this setting. Specifying both will result in an error. By default, the BOX_LEN will be calculated as 1.5 * 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.
N_THREADS (int, optional) – Sets the number of processors (threads) to be used for performing 21cmFAST. Default 1.
SAMPLER_MIN_MASS (float, optional) – The minimum mass to sample in the halo sampler when SOURCE_MODEL is “CHMF-SAMPLER”, decreasing this can drastically increase both compute time and memory usage.
SAMPLER_BUFFER_FACTOR (float, optional) – The arrays for the halo sampler will have size of SAMPLER_BUFFER_FACTOR multiplied by the expected number of halos in the box. Ideally this should be close to unity but one may wish to increase it to test alternative scenarios
N_COND_INTERP (int, optional) – The number of condition bins in the inverse CMF tables.
N_PROB_INTERP (int, optional) – The number of probability bins in the inverse CMF tables.
MIN_LOGPROB (float, optional) – The minimum log-probability of the inverse CMF tables.
HALOMASS_CORRECTION (float, optional) – This provides a corrective factor to the mass-limited (SAMPLE_METHOD==0) sampling, which multiplies the expected mass from a condition by this number. The default value of 0.9 is calibrated to the mass-limited sampling on a timestep of ZPRIME_STEP_FACTOR=1.02. If ZPRIME_STEP_FACTOR is increased, this value should be set closer to 1. This factor is also used in the partition (SAMPLE_METHOD==2) sampler, dividing nu(M) of each sample drawn.
PARKINSON_G0 (float, optional) – Only used when SAMPLE_METHOD==3, sets the normalisation of the correction to the extended press-schecter used in Parkinson et al. 2008.
PARKINSON_y1 (float, optional) – Only used when SAMPLE_METHOD==3, sets the index of the sigma power-law term of the correction to the extended Press-Schechter mass function used in Parkinson et al. 2008.
PARKINSON_y2 (float, optional) – Only used when SAMPLE_METHOD==3, sets the index of the delta power-law term of the correction to the extended Press-Schechter mass function used in Parkinson et al. 2008.
Z_HEAT_MAX (float, optional) – Maximum redshift used in the Tk and x_e evolution equations. Temperature and x_e are assumed to be homogeneous at higher redshifts. Lower values will increase performance.
ZPRIME_STEP_FACTOR (float, optional) – Logarithmic redshift step-size used in the z’ integral. Logarithmic dz. Decreasing (closer to unity) increases total simulation time for lightcones, and for Ts calculations.
INITIAL_REDSHIFT (float, optional) – Initial redshift used to perturb field from
DELTA_R_FACTOR (float, optional) – The factor by which to decrease the size of the filter in DexM when creating halo catalogues.
DENSITY_SMOOTH_RADIUS (float, optional) – The radius of the smoothing kernel in Mpc.
DEXM_OPTIMIZE_MINMASS (float, optional) – The minimum mass of a halo for which to use the DexM optimization if DEXM_OPTIMIZE is True.
DEXM_R_OVERLAP (float, optional) – The factor by which to multiply the halo radius to determine the distance within which smaller halos are excluded.
CORR_STAR (float, optional) – Self-correlation length used for updating halo properties. To model the correlation in the SHMR between timesteps, we sample from a conditional bivariate gaussian with correlation factor given by exp(-dz/CORR_STAR). This value is placed in SimulationOptions since it is used in the halo sampler, and not in the ionization routines.
CORR_SFR (float, optional) – Self-correlation length used for updating star formation rate, see “CORR_STAR” for details.
CORR_LX (float, optional) – Self-correlation length used for updating xray luminosity, see “CORR_STAR” for details.
K_MAX_FOR_CLASS (float, optional) – Maximum wavenumber to run CLASS, in 1/Mpc. Becomes relevant only if matter_options.POWER_SPECTRUM = “CLASS”.
- 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
- property BOX_LEN: float¶
The size of the box along a side, in Mpc.
If not given explicitly, it is auto-calculated via
HII_DIM * LOWRES_CELL_SIZE_MPC.- Return type:
float
- CORR_LX: float¶
- CORR_SFR: float¶
- CORR_STAR: float¶
- DELTA_R_FACTOR: float¶
- DENSITY_SMOOTH_RADIUS: float¶
- DEXM_OPTIMIZE_MINMASS: float¶
- DEXM_R_OVERLAP: float¶
- property DIM: int¶
The number of cells on a side of the hi-res box used for ICs.
If not given explicitly, it is auto-calculated via
HII_DIM * HIRES_TO_LOWRES_FACTOR.- Return type:
int
- HALOMASS_CORRECTION: float¶
- HII_DIM: int¶
- property HII_tot_num_pixels¶
Total number of pixels in the low-res box.
- property HIRES_TO_LOWRES_FACTOR: float¶
The downsampling factor from high to low-res.
- Return type:
float
- INITIAL_REDSHIFT: float¶
- K_MAX_FOR_CLASS: float | None¶
- property LOWRES_CELL_SIZE_MPC: float¶
The cell size (in Mpc) of the low-res grids.
- Return type:
float
- MIN_LOGPROB: float¶
- NON_CUBIC_FACTOR: float¶
- N_COND_INTERP: int¶
- N_PROB_INTERP: int¶
- N_THREADS: int¶
- PARKINSON_G0: float¶
- PARKINSON_y1: float¶
- PARKINSON_y2: float¶
- SAMPLER_BUFFER_FACTOR: float¶
- SAMPLER_MIN_MASS: float¶
- ZPRIME_STEP_FACTOR: float¶
- Z_HEAT_MAX: float¶
- 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 cell_size: astropy.units.Quantity[astropy.units.Mpc]¶
The resolution of a low-res cell.
- Return type:
astropy.units.Quantity[astropy.units.Mpc]
- property cell_size_hires: astropy.units.Quantity[astropy.units.Mpc]¶
The resolution of a hi-res cell.
- Return type:
astropy.units.Quantity[astropy.units.Mpc]
- 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:
- property tot_fft_num_pixels¶
Total number of pixels in the high-res box.