def __init__(self, massdef='mean', delta_mdef=200, halo_profile_model='nfw'): Ncm.cfg_init() self.backend = 'nc' self.set_cosmo(None) self.mdef_dict = { 'mean': Nc.HaloDensityProfileMassDef.MEAN, 'critical': Nc.HaloDensityProfileMassDef.CRITICAL, 'virial': Nc.HaloDensityProfileMassDef.VIRIAL } self.hdpm_dict = { 'nfw': Nc.HaloDensityProfileNFW.new, 'einasto': Nc.HaloDensityProfileEinasto.new, 'hernquist': Nc.HaloDensityProfileHernquist.new } self.halo_profile_model = '' self.massdef = '' self.delta_mdef = 0 self.hdpm = None self.set_halo_density_profile(halo_profile_model, massdef, delta_mdef)
def __init__(self, massdef='mean', delta_mdef=200, halo_profile_model='nfw'): CLMModeling.__init__(self) # Update class attributes Ncm.cfg_init() self.backend = 'nc' self.mdef_dict = { 'mean': Nc.HaloDensityProfileMassDef.MEAN, 'critical': Nc.HaloDensityProfileMassDef.CRITICAL, 'virial':Nc.HaloDensityProfileMassDef.VIRIAL} self.hdpm_dict = { 'nfw': Nc.HaloDensityProfileNFW.new, 'einasto': Nc.HaloDensityProfileEinasto.new, 'hernquist': Nc.HaloDensityProfileHernquist.new} # Set halo profile and cosmology self.set_halo_density_profile(halo_profile_model, massdef, delta_mdef) self.set_cosmo(None)
def __init__(self, z_min, z_max, z_sigma, lnM_min, lnM_max, area, observable): Ncm.cfg_init() self.cosmo = Nc.HICosmo.new_from_name(Nc.HICosmo, "NcHICosmoDEXcdm") dist = Nc.Distance.new(z_max*1.5) wp = Nc.Window.new_from_name("NcWindowTophat") tf = Nc.TransferFunc.new_from_name("NcTransferFuncEH") vp = Nc.MatterVar.new(Nc.MatterVarStrategy.FFT, wp, tf) gf = Nc.GrowthFunc.new() mulf = Nc.MultiplicityFunc.new_from_name("NcMultiplicityFuncTinkerCrit{'Delta':<500.0>}") mf = Nc.MassFunction.new(dist, vp, gf, mulf) if observable == 'SZ': cluster_m = Nc.ClusterMass.new_from_name("NcClusterMassBenson{'M0':<3e14>, 'z0':<0.6>, 'signif-obs-min':<5.0>,'Asz':<6.24>, 'Bsz':<1.33>, 'Csz':<0.83>, 'Dsz':<0.24>}") elif observable == 'true_mass': cluster_m = Nc.ClusterMass.new_from_name("NcClusterMassNodist{'lnM-min':<% 20.15g>, 'lnM-max':<% 20.15g>}" % (lnM_min, lnM_max)) else: raise NameError('Invalid observable choice. Should be ' + '"true_mass" or "SZ"') cluster_z = Nc.ClusterRedshift.new_from_name("NcClusterPhotozGaussGlobal{'pz-min':<%f>, 'pz-max':<%f>, 'z-bias':<0.0>, 'sigma0':<%f>}" % (z_min, z_max, z_sigma)) cad = Nc.ClusterAbundance.new(mf, None, cluster_z, cluster_m) self.ncdata = Nc.DataClusterNCount.new(cad) self.mset = Ncm.MSet() self.mset.set(self.cosmo) self.mset.set(cluster_m) self.rng = Ncm.RNG.pool_get("example_ca_sampling"); self.ncdata.init_from_sampling(self.mset, cluster_z, cluster_m, area * (pi/180.0) ** 2, self.rng) del dist del vp del gf del mulf del mf del cad del cluster_z del cluster_m
import math import numpy as np import matplotlib.pyplot as plt try: import gi gi.require_version('NumCosmo', '1.0') gi.require_version('NumCosmoMath', '1.0') except: pass from gi.repository import NumCosmo as Nc from gi.repository import NumCosmoMath as Ncm Ncm.cfg_init() # # New homogeneous and isotropic cosmological model NcHICosmoDEXcdm # cosmo = Nc.HICosmo.new_from_name(Nc.HICosmo, "NcHICosmoDEXcdm") cosmo.omega_x2omega_k() cosmo.param_set_by_name("Omegak", 0.0) # # New cosmological distance objects optimizied to perform calculations # up to redshift 2.0. # dist = Nc.Distance.new(1.0) #
gi.require_version('NumCosmo', '1.0') gi.require_version('NumCosmoMath', '1.0') except: pass import math from gi.repository import NumCosmo as Nc from gi.repository import NumCosmoMath as Ncm #import threading #from numpy import pi import os import os.path import math Ncm.cfg_init () z_max = 1.32 z_min = 0.3 area = 2500 # # New homogeneous and isotropic cosmological model NcHICosmoDEXcdm # cosmo = Nc.HICosmo.new_from_name (Nc.HICosmo, "NcHICosmoDEXcdm{'H0':<71.15>, 'Omegac':<0.218>, 'Omegab':<0.044>, 'w':<-1.01>, 'Omegac-fit':<1>, 'w-fit':<1>}") cosmo.omega_x2omega_k () cosmo.param_set_by_name ("Omegak", 0.0); (Found, w_i) = cosmo.param_index_from_name ("w") cosmo.param_set_lower_bound (w_i, -3.0) cosmo.param_set_upper_bound (w_i, 0.0)