diff options
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r-- | fg21sim/extragalactic/clusters/emission.py | 6 | ||||
-rw-r--r-- | fg21sim/extragalactic/clusters/formation.py | 14 | ||||
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 26 | ||||
-rw-r--r-- | fg21sim/extragalactic/clusters/helper.py | 16 | ||||
-rw-r--r-- | fg21sim/extragalactic/clusters/main.py | 6 |
5 files changed, 32 insertions, 36 deletions
diff --git a/fg21sim/extragalactic/clusters/emission.py b/fg21sim/extragalactic/clusters/emission.py index 4366025..5c9e0a7 100644 --- a/fg21sim/extragalactic/clusters/emission.py +++ b/fg21sim/extragalactic/clusters/emission.py @@ -18,7 +18,7 @@ import numpy as np import scipy.integrate import scipy.special -from ...utils import cosmo +from ...utils import COSMO from ...utils.units import (Units as AU, UnitConversions as AUC, Constants as AC) @@ -164,7 +164,7 @@ class SynchrotronEmission: Synchrotron flux at frequency ``nu``. Unit: [Jy] = 1e-23 [erg/s/cm^2/Hz] """ - DL = cosmo.DL(self.z) * AUC.Mpc2cm # [cm] + DL = COSMO.DL(self.z) * AUC.Mpc2cm # [cm] P_nu = self.power(nu) F_nu = 1e23 * P_nu / (4*np.pi * DL*DL) # [Jy] return F_nu @@ -191,7 +191,7 @@ class SynchrotronEmission: Synchrotron surface brightness at frequency ``nu``. Unit: [K] <-> [Jy/pixel] """ - DA = cosmo.DL(self.z) * AUC.Mpc2cm # [cm] + DA = COSMO.DL(self.z) * AUC.Mpc2cm # [cm] radius = self.radius * AUC.kpc2cm # [cm] omega = (np.pi * radius**2 / DA**2) * AUC.rad2deg**2 # [deg^2] pixelarea = (pixelsize * AUC.arcsec2deg) ** 2 # [deg^2] diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py index a036069..02b26f4 100644 --- a/fg21sim/extragalactic/clusters/formation.py +++ b/fg21sim/extragalactic/clusters/formation.py @@ -21,7 +21,7 @@ import scipy.special import scipy.optimize from .mergertree import MergerTree -from ...utils import cosmo +from ...utils import COSMO logger = logging.getLogger(__name__) @@ -98,7 +98,7 @@ class ClusterFormation: References: Ref.[1],Eq.(2) """ alpha = self.sigma_index - sigma = cosmo.sigma8 * (mass / cosmo.M8) ** (-alpha) + sigma = COSMO.sigma8 * (mass / COSMO.M8) ** (-alpha) return sigma def f_delta_c(self, z): @@ -110,7 +110,7 @@ class ClusterFormation: References: Ref.[1],App.A,Eq.(A1) """ - return cosmo.overdensity_crit(z) + return COSMO.overdensity_crit(z) def f_dw_max(self, mass): """ @@ -145,7 +145,7 @@ class ClusterFormation: References: Ref.[1],Sec.(3) """ alpha = self.sigma_index - mass = cosmo.M8 * (S / cosmo.sigma8**2)**(-1/(2*alpha)) + mass = COSMO.M8 * (S / COSMO.sigma8**2)**(-1/(2*alpha)) return mass @staticmethod @@ -251,7 +251,7 @@ class ClusterFormation: Mc = self.M0 mtree_root = MergerTree(data={"mass": Mc, "z": zc, - "age": cosmo.age(zc)}) + "age": COSMO.age(zc)}) logger.debug("[main] z=%.4f : mass=%g [Msun]" % (zc, Mc)) mtree = mtree_root @@ -272,7 +272,7 @@ class ClusterFormation: dS = self.gen_dS(dw) # Progenitor properties z1 = self.calc_z(w2 + dw) - age1 = cosmo.age(z1) + age1 = COSMO.age(z1) S1 = S2 + dS M1 = self.calc_mass(S1) dM = Mc - M1 @@ -310,7 +310,7 @@ class ClusterFormation: merger tree. """ z = 0.0 if _z is None else _z - node_data = {"mass": M, "z": z, "age": cosmo.age(z)} + node_data = {"mass": M, "z": z, "age": COSMO.age(z)} # Whether to stop the trace if self.zmax is not None and z > self.zmax: diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 7887ace..8fdc78c 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -44,8 +44,8 @@ import numpy as np from . import helper from .solver import FokkerPlanckSolver -from ...configs import configs -from ...utils import cosmo +from ...configs import CONFIGS +from ...utils import COSMO from ...utils.units import (Units as AU, UnitConversions as AUC, Constants as AC) @@ -88,10 +88,6 @@ class RadioHalo: Unit: [Msun] z_merger : float The redshift when the (major) merger begins. - tau_merger : float - The timescale of the merger-induced disturbance. - Unit: [Gyr] - ... Attributes ---------- @@ -102,7 +98,7 @@ class RadioHalo: Unit: [kpc] """ def __init__(self, M_obs, z_obs, M_main, M_sub, z_merger, - configs=configs): + configs=CONFIGS): self.M_obs = M_obs self.z_obs = z_obs self.M_main = M_main @@ -144,11 +140,11 @@ class RadioHalo: @property def age_obs(self): - return cosmo.age(self.z_obs) + return COSMO.age(self.z_obs) @property def age_merger(self): - return cosmo.age(self.z_merger) + return COSMO.age(self.z_merger) @property def time_crossing(self): @@ -191,13 +187,13 @@ class RadioHalo: Unit: [cm^-3] """ if zbegin is None: - tstart = cosmo.age(self.z_merger) + tstart = COSMO.age(self.z_merger) else: - tstart = cosmo.age(zbegin) + tstart = COSMO.age(zbegin) if zend is None: - tstop = cosmo.age(self.z_obs) + tstop = COSMO.age(self.z_obs) else: - tstop = cosmo.age(zend) + tstop = COSMO.age(zend) if n0_e is None: # Accumulated constantly injected electrons until ``tstart``. n_inj = np.array([self.fp_injection(gm) @@ -401,7 +397,7 @@ class RadioHalo: ---------- Ref.[sarazin1999],Eq.(9) """ - z = cosmo.redshift(t) + z = COSMO.redshift(t) mass = self._mass(t) n_th = helper.density_number_thermal(mass, z) coef = -1.20e-12 * AUC.Gyr2s # [Gyr^-1] @@ -417,7 +413,7 @@ class RadioHalo: ---------- Ref.[sarazin1999],Eq.(6,7) """ - z = cosmo.redshift(t) + z = COSMO.redshift(t) mass = self._mass(t) B = helper.magnetic_field(mass) coef = -1.37e-20 * AUC.Gyr2s # [Gyr^-1] diff --git a/fg21sim/extragalactic/clusters/helper.py b/fg21sim/extragalactic/clusters/helper.py index f20af5f..5963bab 100644 --- a/fg21sim/extragalactic/clusters/helper.py +++ b/fg21sim/extragalactic/clusters/helper.py @@ -26,8 +26,8 @@ References import numpy as np -from ...configs import configs -from ...utils import cosmo +from ...configs import CONFIGS +from ...utils import COSMO from ...utils.units import (Constants as AC, UnitConversions as AUC) @@ -51,8 +51,8 @@ def radius_virial(mass, z=0.0): Virial radius of the cluster Unit: [kpc] """ - Dc = cosmo.overdensity_virial(z) - rho = cosmo.rho_crit(z) # [g/cm^3] + Dc = COSMO.overdensity_virial(z) + rho = COSMO.rho_crit(z) # [g/cm^3] R_vir = (3*mass*AUC.Msun2g / (4*np.pi * Dc * rho))**(1/3) # [cm] R_vir *= AUC.cm2kpc # [kpc] return R_vir @@ -123,7 +123,7 @@ def mass_to_kT(mass, z=0.0): """ A = 5.34 + np.random.normal(scale=0.22) alpha = 1.72 + np.random.normal(scale=0.10) - Ez = cosmo.E(z) + Ez = COSMO.E(z) kT = 5.0 * (mass * Ez / A) ** (1/alpha) return kT @@ -151,7 +151,7 @@ def density_number_thermal(mass, z=0.0): Number density of the ICM thermal plasma Unit: [cm^-3] """ - N = mass * AUC.Msun2g * cosmo.baryon_fraction / (AC.mu * AC.u) + N = mass * AUC.Msun2g * COSMO.baryon_fraction / (AC.mu * AC.u) R_vir = radius_virial(mass, z) * AUC.kpc2cm # [cm] volume = (4*np.pi / 3) * R_vir**3 # [cm^3] n_th = N / volume # [cm^-3] @@ -258,8 +258,8 @@ def magnetic_field(mass): Ref.[cassano2012],Eq.(1) """ comp = "extragalactic/clusters" - b_mean = configs.getn(comp+"/b_mean") - b_index = configs.getn(comp+"/b_index") + b_mean = CONFIGS.getn(comp+"/b_mean") + b_index = CONFIGS.getn(comp+"/b_index") M_mean = 1.6e15 # [Msun] B = b_mean * (mass/M_mean) ** b_index diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index 7d8d494..daa1c83 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -58,7 +58,7 @@ class GalaxyClusters: # Component name name = "galaxy clusters (halos)" - def __init__(self, configs=configs): + def __init__(self, configs=CONFIGS): self.configs = configs self.sky = get_sky(configs) self._set_configs() @@ -196,8 +196,8 @@ class GalaxyClusters: if ii % 50 == 0: logger.info("[%d/%d] %.1f%% ..." % (ii, num, 100*ii/num)) z0, M0 = row.z, row.mass - age0 = cosmo.age(z0) - zmax = cosmo.redshift(age0 - self.tau_merger) + age0 = COSMO.age(z0) + zmax = COSMO.redshift(age0 - self.tau_merger) clform = ClusterFormation(M0=M0, z0=z0, zmax=zmax, ratio_major=self.ratio_major, merger_mass_min=self.merger_mass_min) |