py21cmfast.MatterOptions ======================== .. py:class:: py21cmfast.MatterOptions Bases: :py:obj:`InputStruct` Structure containing options which affect the matter field (ICs, perturbedfield, halos). :ivar HMF: Determines which halo mass function to be used for the normalisation of the collapsed fraction (default Sheth-Tormen). Should be one of the following codes: PS (Press-Schechter) ST (Sheth-Tormen) Watson (Watson FOF) Watson-z (Watson FOF-z) Delos (Delos+23) Reed07 (Reed+07; arXiv:0607150) Yung24 (Yung+24; arXiv:2304.04348) :ivar USE_RELATIVE_VELOCITIES: Flag to decide whether to use relative velocities. If True, POWER_SPECTRUM is automatically set to 5. Default False. :vartype USE_RELATIVE_VELOCITIES: int, optional :ivar POWER_SPECTRUM: Determines which power spectrum to use, default EH (unless `USE_RELATIVE_VELOCITIES` is True). Use the following codes: * EH : Eisenstein & Hu 1999 * BBKS: Bardeen et al. 1986 * EFSTATHIOU: Efstathiou et al. 1992 * PEEBLES: Peebles 1980 * WHITE: White 1985 * CLASS: Uses fits from the CLASS code :ivar PERTURB_ON_HIGH_RES: Whether to perform the Zel'Dovich or 2LPT perturbation on the low or high resolution grid. :ivar USE_FFTW_WISDOM: Whether or not to use stored FFTW_WISDOMs for improving performance of FFTs :ivar USE_INTERPOLATION_TABLES: Defines the interpolation tables used in the code. Default is 'hmf-interpolation'. There are three levels available: * 'no-interpolation': No interpolation tables are used. * 'sigma-interpolation': Interpolation tables are used for sigma(M) only. * 'hmf-interpolation': Interpolation tables are used for sigma(M) the halo mass function. :ivar PERTURB_ALGORITHM: Whether to use second-order Lagrangian perturbation theory (2LPT), Zel'dovich (ZELDOVICH), or linear evolution (LINEAR). Set this to 2LPT 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. :ivar MINIMIZE_MEMORY: 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. :ivar SAMPLE_METHOD: The sampling method to use in the halo sampler when calculating progenitor populations: * MASS-LIMITED : Mass-limited CMF sampling, where samples are drawn until the expected mass is reached * NUMBER-LIMITED : Number-limited CMF sampling, where we select a number of halos from the Poisson distribution and then sample the CMF that many times * PARTITION : Sheth et al 1999 Partition sampling, where the EPS collapsed fraction is sampled (gaussian tail) and then the condition is updated using the conservation of mass. * BINARY-SPLIT : Parkinson et al 2008 Binary split model as in DarkForest (Qiu et al 2021) where the EPS merger rate is sampled on small internal timesteps such that only binary splits can occur. .. note:: The initial sampling from the density grid will ALWAYS use NUMBER-LIMITED sampling (method 1) :ivar FILTER: Filter to use for sigma (matter field variance) and radius to mass conversions. available options are: `spherical-tophat` and `gaussian` :ivar HALO_FILTER: Filter to use for the DexM halo finder. available options are: `spherical-tophat`, `sharp-k` and `gaussian` :ivar SMOOTH_EVOLVED_DENSITY_FIELD: Smooth the evolved density field after perturbation. :ivar DEXM_OPTMIZE: Use a faster version of the DexM halo finder which excludes halos from forming within a certain distance of larger halos. :ivar KEEP_3D_VELOCITIES: Whether to keep the 3D velocities in the ICs. If False, only the z velocity is kept. :ivar SOURCE_MODEL: The source model to use in the simulation. Options are: * ``E-INTEGRAL``: The traditional excursion-set formalism, where source properties are defined on the Eulerian grid after 2LPT in regions of filter scale R (see the X_FILTER options for filter shapes). This integrates over the CHMF using the smoothed density grids, then multiplies the result by (1 + delta) to get the source properties in each cell. * ``CONST-ION-EFF``: Similar to E-INTEGRAL, but ionizing efficiency is constant and does not depend on the halo mass (see Mesinger+ 2010). * ``L-INTEGRAL``: Analagous to the 'ESF-L' model described in Trac+22, where source properties are defined on the Lagrangian (IC) grid by integrating the CHMF prior to the IGM physics and then mapping properties to the Eulerian grid using 2LPT. * ``DEXM-ESF``: The DexM excursion-set formalism, where discrete halo catalogues are generated on the Lagrangian (IC) grid using an excursion-set halo finder. Source properties are defined on the Lagrangian grid and then mapped to the Eulerian grid using 2LPT. This model utilised the 'L-INTEGRAL' method for halos below the DexM mass resolution, which is the mass of the high-resolution (DIM^3) cells. * ``CHMF-SAMPLER``: The CHMF sampler, where discrete halo catalogues are generated by sampling the CHMF on the IC grid, between the low-resolution (HII_DIM^3) cell mass and a minimum mass defined by the user (SAMPLER_MIN_MASS). This model uses the 'L-INTEGRAL' method for halos below the SAMPLER_MIN_MASS, and the 'DEXM-ESF' method for halos above the HII_DIM cell mass. .. !! processed by numpydoc !! .. py:method:: asdict() -> dict Return a dict representation of the instance. .. rubric:: 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 .. !! processed by numpydoc !! .. py:method:: clone(**kwargs) Make a fresh copy of the instance with arbitrary parameters updated. .. !! processed by numpydoc !! .. py:method:: from_subdict(dct: dict[str, Any], safe: bool = True) -> Self :classmethod: Construct an instance of this class from a dictionary. .. !! processed by numpydoc !! .. py:method:: new(x: dict | Self | None = None, **kwargs) :classmethod: 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).** .. rubric:: Examples >>> params = SimulationOptions.new({'HII_DIM': 250}) >>> params.HII_DIM 250 >>> params = SimulationOptions.new(params) >>> params.HII_DIM 250 >>> params = SimulationOptions.new() >>> params.HII_DIM 200 >>> params = SimulationOptions.new(HII_DIM=256) >>> params.HII_DIM 256 .. !! processed by numpydoc !! .. py:attribute:: DEXM_OPTIMIZE :type: bool .. py:attribute:: FILTER :type: FilterOptions .. py:attribute:: HALO_FILTER :type: FilterOptions .. py:attribute:: HMF :type: Literal['PS', 'ST', 'WATSON', 'WATSON-Z', 'DELOS', 'REED07', 'YUNG24'] .. py:attribute:: KEEP_3D_VELOCITIES :type: bool .. py:attribute:: MINIMIZE_MEMORY :type: bool .. py:attribute:: PERTURB_ALGORITHM :type: Literal['LINEAR', 'ZELDOVICH', '2LPT'] .. py:attribute:: PERTURB_ON_HIGH_RES :type: bool .. py:attribute:: POWER_SPECTRUM :type: Literal['EH', 'BBKS', 'EFSTATHIOU', 'PEEBLES', 'WHITE', 'CLASS'] .. py:attribute:: SAMPLE_METHOD :type: Literal['MASS-LIMITED', 'NUMBER-LIMITED', 'PARTITION', 'BINARY-SPLIT'] .. py:attribute:: SMOOTH_EVOLVED_DENSITY_FIELD :type: bool .. py:attribute:: SOURCE_MODEL :type: Literal['CONST-ION-EFF', 'E-INTEGRAL', 'L-INTEGRAL', 'DEXM-ESF', 'CHMF-SAMPLER'] .. py:attribute:: USE_FFTW_WISDOM :type: bool .. py:attribute:: USE_INTERPOLATION_TABLES :type: Literal['no-interpolation', 'sigma-interpolation', 'hmf-interpolation'] .. py:attribute:: USE_RELATIVE_VELOCITIES :type: bool .. py:property:: cdict :type: 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 :meth:`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 :class:`InputStruct` instance (some attributes of the python instance are there only to guide setting of defaults, and don't appear in the C-struct at all). .. !! processed by numpydoc !! .. py:property:: has_discrete_halos :type: bool Whether the current options will produce discrete halo catalogues. .. !! processed by numpydoc !! .. py:property:: lagrangian_source_grid :type: bool Whether the current source model is Lagrangian. .. !! processed by numpydoc !! .. py:property:: mass_dependent_zeta :type: bool Whether the current source model uses mass-dependent zeta. .. !! processed by numpydoc !!