def __init__( self, cosmo_params=DefaultCosmology(), units=u.Msun / u.pc**2, delta=200, mass_definition='mean', comoving=True, ): self._delta = delta self._check_mass_def(mass_definition) self.mass_definition = mass_definition self.comoving = comoving if isinstance(cosmo_params, DefaultCosmology): self.cosmo_params = CosmoParams() else: self.cosmo_params = cosmo_params self._astropy_cosmology = get_astropy_cosmology(self.cosmo_params) self.units = units self.sigma_crit = partial( maszcal.cosmology.SigmaCrit(self.cosmo_params, comoving=self.comoving, units=self.units).sdc, z_source=np.array([self.CMB_REDSHIFT]), )
def it_checks_for_inconsistent_dm_and_bary_densities(): with pytest.raises(cosmology.MatterInconsistencyError): CosmoParams( omega_cdm=0.1, omega_bary=0.01, omega_matter=0.2, omega_lambda=0.8, )
def __init__(self, mass_def, cosmology=defaults.DefaultCosmology()): self.mass_def = mass_def if isinstance(cosmology, defaults.DefaultCosmology): cosmology_ = CosmoParams() else: cosmology_ = cosmology self._init_colossus(cosmology_)
def nfw_model_alt_cosmo(): cosmo = CosmoParams( omega_matter=0.4, omega_cdm=0.3, omega_cdm_hsqr=0.7**2 * 0.3, omega_bary=0.1, omega_bary_hsqr=0.7**2 * 0.1, omega_lambda=0.6, hubble_constant=70, h=0.7, ) return maszcal.density.NfwModel(cosmo_params=cosmo)
def __init__( self, redshifts, units=u.Msun / u.pc**2, comoving_radii=True, delta=200, mass_definition='mean', cosmo_params=maszcal.defaults.DefaultCosmology(), ): self.redshifts = redshifts self.units = units self.comoving_radii = comoving_radii self.delta = delta self.mass_definition = mass_definition if isinstance(cosmo_params, maszcal.defaults.DefaultCosmology): self.cosmo_params = CosmoParams() else: self.cosmo_params = cosmo_params self.astropy_cosmology = get_astropy_cosmology(self.cosmo_params)
def nfw_model(): cosmo = CosmoParams() return maszcal.density.MatchingNfwModel(cosmo_params=cosmo)
def nfw_model(): cosmo = CosmoParams() return maszcal.density.SingleMassNfwModel(cosmo_params=cosmo)
def it_can_pass_checks_with_default_values(): CosmoParams()
def it_checks_for_consistence_between_hubble_and_h100(): with pytest.raises(cosmology.HubbleConstantError): CosmoParams(hubble_constant=100)
def it_checks_for_h_squared_param_consistency(): with pytest.raises(cosmology.MatterInconsistencyError): CosmoParams(omega_cdm_hsqr=0.1) with pytest.raises(cosmology.MatterInconsistencyError): CosmoParams(omega_bary_hsqr=0.2)
def it_checks_for_inconsistent_universe_closure(): with pytest.raises(cosmology.NonFlatUniverseError): CosmoParams( omega_matter=1, omega_lambda=1, )