Commit 155a2b9d authored by Goran Jelic-Cizmek's avatar Goran Jelic-Cizmek
Browse files

Fixed bug in omega_nu in interface

When setting `m_ncdm`, the value of `Omega0_nu` wasn't being set accordingly.
parent ddd4a1ec
......@@ -238,6 +238,8 @@ cdef extern from "common.h":
int N_ncdm
double Omega0_nu
int only_cross_correlations
......
......@@ -319,13 +319,21 @@ cdef class Coffe:
_check_parameter('omega_cdm', value, (int, float), 0, 1)
if not np.allclose(value, self.omega_cdm):
# we set the value, rebalance the Omega budget, and free memory
self._check_omegas(value, self.omega_baryon, self.omega_gamma)
self._check_omegas(value, self.omega_baryon, self.omega_gamma, self.omega_nu)
self._parameters.Omega0_cdm = value
self._parameters.Omega0_m = self._parameters.Omega0_cdm + self._parameters.Omega0_baryon
self._balance_content()
self._free_except_parameters()
@property
def omega_nu(self):
"""
Returns the energy density fraction of massive neutrinos.
"""
return self._parameters.Omega0_nu
@property
def omega_m(self):
"""
......@@ -536,6 +544,8 @@ cdef class Coffe:
_check_parameter('m_ncdm', value, (int, float), 0, 10)
if not np.allclose(value, self.m_ncdm):
self._parameters.m_ncdm = value
self._parameters.Omega0_nu = value / 93.14 / self.h / self.h
self.omega_cdm = self.omega_m - self.omega_baryon - self.omega_nu
self._free_power_spectrum()
self._free_integrals()
self._free_corrfunc()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment