py21cmfast.SimulationOptions ============================ .. py:class:: py21cmfast.SimulationOptions Bases: :py:obj:`InputStruct` Structure containing broad simulation options. :ivar HII_DIM: Number of cells for the low-res box (after smoothing the high-resolution matter field). Default 256. :vartype HII_DIM: int, optional :ivar HIRES_TO_LOWRES_FACTOR: 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). :vartype HIRES_TO_LOWRES_FACTOR: float, optional :ivar DIM: 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. :vartype DIM: int, optional :ivar LOWRES_CELL_SIZE_MPC: 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. :vartype LOWRES_CELL_SIZE_MPC: float, optional :ivar BOX_LEN: 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. :vartype BOX_LEN: float, optional :ivar NON_CUBIC_FACTOR: 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. :vartype NON_CUBIC_FACTOR: float, optional :ivar N_THREADS: Sets the number of processors (threads) to be used for performing 21cmFAST. Default 1. :vartype N_THREADS: int, optional :ivar SAMPLER_MIN_MASS: 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. :vartype SAMPLER_MIN_MASS: float, optional :ivar SAMPLER_BUFFER_FACTOR: 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. :vartype SAMPLER_BUFFER_FACTOR: float, optional :ivar N_COND_INTERP: The number of condition bins in the inverse CMF tables. :vartype N_COND_INTERP: int, optional :ivar N_PROB_INTERP: The number of probability bins in the inverse CMF tables. :vartype N_PROB_INTERP: int, optional :ivar MIN_LOGPROB: The minimum log-probability of the inverse CMF tables. :vartype MIN_LOGPROB: float, optional :ivar HALOMASS_CORRECTION: 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. :vartype HALOMASS_CORRECTION: float, optional :ivar PARKINSON_G0: Only used when SAMPLE_METHOD==3, sets the normalisation of the correction to the extended press-schecter used in Parkinson et al. 2008. :vartype PARKINSON_G0: float, optional :ivar PARKINSON_y1: 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. :vartype PARKINSON_y1: float, optional :ivar PARKINSON_y2: 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. :vartype PARKINSON_y2: float, optional :ivar Z_HEAT_MAX: 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. :vartype Z_HEAT_MAX: float, optional :ivar ZPRIME_STEP_FACTOR: 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. :vartype ZPRIME_STEP_FACTOR: float, optional :ivar INITIAL_REDSHIFT: Initial redshift used to perturb field from :vartype INITIAL_REDSHIFT: float, optional :ivar DELTA_R_FACTOR: The factor by which to decrease the size of the filter in DexM when creating halo catalogues. :vartype DELTA_R_FACTOR: float, optional :ivar DENSITY_SMOOTH_RADIUS: The radius of the smoothing kernel in Mpc. :vartype DENSITY_SMOOTH_RADIUS: float, optional :ivar DEXM_OPTIMIZE_MINMASS: The minimum mass of a halo for which to use the DexM optimization if DEXM_OPTIMIZE is True. :vartype DEXM_OPTIMIZE_MINMASS: float, optional :ivar DEXM_R_OVERLAP: The factor by which to multiply the halo radius to determine the distance within which smaller halos are excluded. :vartype DEXM_R_OVERLAP: float, optional :ivar CORR_STAR: 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. :vartype CORR_STAR: float, optional :ivar CORR_SFR: Self-correlation length used for updating star formation rate, see "CORR_STAR" for details. :vartype CORR_SFR: float, optional :ivar CORR_LX: Self-correlation length used for updating xray luminosity, see "CORR_STAR" for details. :vartype CORR_LX: float, optional :ivar K_MAX_FOR_CLASS: Maximum wavenumber to run CLASS, in 1/Mpc. Becomes relevant only if ``matter_options.POWER_SPECTRUM = "CLASS"``. :vartype K_MAX_FOR_CLASS: float, optional :ivar MIN_XE_FOR_FCOLL_IN_TAUX: Minimum global x_e value for which the collapsed fraction (f_coll) is evaluated in the tau_X integral (X-ray optical depth). When x_e is above this threshold value, it is assumed that f_coll=0, in order to speed up the calculations. For now, this parameter becomes relevant only when run_global_evolution is called, as it controls the runtime of this function (higher values reduce the runtime, in expense of degraded precision). :vartype MIN_XE_FOR_FCOLL_IN_TAUX: float, optional .. !! 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:property:: BOX_LEN :type: 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``. .. !! processed by numpydoc !! .. py:attribute:: CORR_LX :type: float .. py:attribute:: CORR_SFR :type: float .. py:attribute:: CORR_STAR :type: float .. py:attribute:: DELTA_R_FACTOR :type: float .. py:attribute:: DENSITY_SMOOTH_RADIUS :type: float .. py:attribute:: DEXM_OPTIMIZE_MINMASS :type: float .. py:attribute:: DEXM_R_OVERLAP :type: float .. py:property:: DIM :type: 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``. .. !! processed by numpydoc !! .. py:attribute:: HALOMASS_CORRECTION :type: float .. py:attribute:: HII_DIM :type: int .. py:property:: HII_tot_num_pixels Total number of pixels in the low-res box. .. !! processed by numpydoc !! .. py:property:: HIRES_TO_LOWRES_FACTOR :type: float The downsampling factor from high to low-res. .. !! processed by numpydoc !! .. py:attribute:: INITIAL_REDSHIFT :type: float .. py:attribute:: K_MAX_FOR_CLASS :type: float | None .. py:property:: LOWRES_CELL_SIZE_MPC :type: float The cell size (in Mpc) of the low-res grids. .. !! processed by numpydoc !! .. py:attribute:: MIN_LOGPROB :type: float .. py:attribute:: MIN_XE_FOR_FCOLL_IN_TAUX :type: float .. py:attribute:: NON_CUBIC_FACTOR :type: float .. py:attribute:: N_COND_INTERP :type: int .. py:attribute:: N_PROB_INTERP :type: int .. py:attribute:: N_THREADS :type: int .. py:attribute:: PARKINSON_G0 :type: float .. py:attribute:: PARKINSON_y1 :type: float .. py:attribute:: PARKINSON_y2 :type: float .. py:attribute:: SAMPLER_BUFFER_FACTOR :type: float .. py:attribute:: SAMPLER_MIN_MASS :type: float .. py:attribute:: ZPRIME_STEP_FACTOR :type: float .. py:attribute:: Z_HEAT_MAX :type: float .. 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:: cell_size :type: astropy.units.Quantity[astropy.units.Mpc] The resolution of a low-res cell. .. !! processed by numpydoc !! .. py:property:: cell_size_hires :type: astropy.units.Quantity[astropy.units.Mpc] The resolution of a hi-res cell. .. !! processed by numpydoc !! .. py:property:: tot_fft_num_pixels Total number of pixels in the high-res box. .. !! processed by numpydoc !!