py21cmfast.CosmoParams ====================== .. py:class:: py21cmfast.CosmoParams Bases: :py:obj:`InputStruct` Cosmological parameters (with defaults) which translates to a C struct. To see default values for each parameter, use ``CosmoParams._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. Default parameters are based on Plank18, https://arxiv.org/pdf/1807.06209.pdf, Table 2, last column. [TT,TE,EE+lowE+lensing+BAO] :Parameters: * **SIGMA_8** (*float, optional*) -- RMS mass variance (power spectrum normalisation). * **hlittle** (*float, optional*) -- The hubble parameter, H_0/100. * **OMm** (*float, optional*) -- Omega matter. * **OMb** (*float, optional*) -- Omega baryon, the baryon component. * **POWER_INDEX** (*float, optional*) -- Spectral index of the power spectrum. * **A_s** (*float, optional*) -- Amplitude of primordial curvature power spectrum, at k_pivot = 0.05 Mpc^-1. .. !! processed by numpydoc !! .. py:method:: __init_subclass__() :classmethod: Store each subclass for easy access. .. !! processed by numpydoc !! .. py:method:: __str__() Human-readable string representation of the object. .. !! processed by numpydoc !! .. py:method:: asdict() Return a dict representation of the instance. .. rubric:: Examples This dict is 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_astropy(cosmo, **kwargs) :classmethod: Create a CosmoParams object from an astropy cosmology object. Pass SIGMA_8 and POWER_INDEX as kwargs if you want to override the default values. .. !! processed by numpydoc !! .. py:method:: from_subdict(dct, safe=True) :classmethod: Construct an instance of a parameter structure from a dictionary. .. !! processed by numpydoc !! .. py:method:: new(x = 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 >>> 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 .. !! processed by numpydoc !! .. py:property:: A_s :type: float Amplitude of primordial curvature power spectrum, at k_pivot = 0.05 Mpc^-1. If not given explicitly, it is auto-calculated via sigma_8 and the other cosmological parameters. .. !! processed by numpydoc !! .. py:attribute:: OMb :type: float .. py:attribute:: OMk :type: float .. py:property:: OMl Omega lambda, dark energy density. .. !! processed by numpydoc !! .. py:attribute:: OMm :type: float .. py:attribute:: OMn :type: float .. py:attribute:: OMr :type: float .. py:attribute:: OMtot :type: float .. py:attribute:: POWER_INDEX :type: float .. py:property:: SIGMA_8 :type: float RMS mass variance (power spectrum normalisation). If not given explicitly, it is auto-calculated via A_s and the other cosmological parameters. .. !! processed by numpydoc !! .. py:attribute:: Y_He :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:: cosmo An astropy cosmology object for this cosmology. .. !! processed by numpydoc !! .. py:property:: cstruct :type: py21cmfast.wrapper.structs.StructWrapper The object pointing to the memory accessed by C-code for this struct. .. !! processed by numpydoc !! .. py:attribute:: hlittle :type: float .. py:property:: struct :type: py21cmfast.wrapper.structs.StructWrapper The python-wrapped struct associated with this input object. .. !! processed by numpydoc !! .. py:attribute:: wl :type: float