aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-01-05 20:59:19 +0800
committerAaron LI <aly@aaronly.me>2018-01-05 20:59:19 +0800
commit36610bafadfc60f49799e5d22a7999e9e5e0ebef (patch)
tree94e886cb6351a51ef7c75ded3c124cedc545e5f1
parent900dc8a09932dc3d101e66c8da3c7449a34bc983 (diff)
downloadfg21sim-36610bafadfc60f49799e5d22a7999e9e5e0ebef.tar.bz2
clusters: small cleanups
-rw-r--r--fg21sim/extragalactic/clusters/halo.py17
-rw-r--r--fg21sim/extragalactic/clusters/main.py13
2 files changed, 18 insertions, 12 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index c9bb56b..3ada79a 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -283,7 +283,7 @@ class RadioHalo:
"""
if t is None:
t = self.age_begin
- mass = self.mass_main(t=t)
+ mass = self.mass_main(t)
z = COSMO.redshift(t)
return helper.kT_cluster(mass=mass, z=z, configs=self.configs)
@@ -417,13 +417,14 @@ class RadioHalo:
logger.debug("Derive the initial electron spectrum ...")
# NOTE: subtract ``time_step`` to avoid the acceleration at the
# last step at ``age_begin``.
- tstart = self.age_begin - self.time_init - self.time_step
- tstop = self.age_begin - self.time_step
+ dt = self.time_step
+ tstart = self.age_begin - self.time_init - dt
+ tstop = self.age_begin - dt
# Use a bigger time step to save time
- self.fpsolver.tstep = 3 * self.time_step
+ self.fpsolver.tstep = 3 * dt
n_e = self.fpsolver.solve(u0=n0_e, tstart=tstart, tstop=tstop)
# Restore the original time step
- self.fpsolver.tstep = self.time_step
+ self.fpsolver.tstep = dt
return n_e
def calc_electron_spectrum(self, tstart=None, tstop=None, n0_e=None):
@@ -558,7 +559,7 @@ class RadioHalo:
----------
Ref.[donnert2013],Eq.(15)
"""
- tau_acc = self.tau_acceleration(t=t)
+ tau_acc = self.tau_acceleration(t)
gamma = np.asarray(gamma)
diffusion = gamma**2 / 4 / tau_acc
return diffusion
@@ -566,7 +567,7 @@ class RadioHalo:
def fp_advection(self, gamma, t):
"""
Advection term/coefficient for the Fokker-Planck equation,
- which describes a systematic tendency for upward or downard
+ which describes a systematic tendency for upward or downward
drift of particles.
This term is also called the "generalized cooling function"
@@ -595,7 +596,7 @@ class RadioHalo:
The (cosmic) time when the merger begins.
Unit: [Gyr]
"""
- return self.age_begin
+ return self.age_merger
def mass_merged(self, t=None):
"""
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index a060416..688f19e 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -250,11 +250,15 @@ class GalaxyClusters:
if ii % 50 == 0:
logger.info("[%d/%d] %.1f%% ..." % (ii, num, 100*ii/num))
cdict = self.catalog[idx]
- z_obs = cdict["z"]
- M_obs = cdict["mass"]
merger_num = cdict["merger_num"]
- logger.info("[%d/%d] M[%.2e] @ z[%.3f] with %d mergers" %
- (ii, num, M_obs, z_obs, merger_num))
+ M_obs = cdict["mass"]
+ z_obs = cdict["z"]
+ M1 = cdict["merger_mass1"][merger_num-1]
+ z1 = cdict["merger_z"][merger_num-1]
+ info = ("[%d/%d] " % (ii, num) +
+ "M(%.2e)@z(%.3f) -> M(%.2e)@z(%.3f) with %d merger(s)" %
+ (ii, num, M1, z1, M_obs, z_obs, merger_num))
+ logger.info(info)
halo = RadioHaloAM(M_obs=M_obs, z_obs=z_obs,
M_main=cdict["merger_mass1"],
M_sub=cdict["merger_mass2"],
@@ -265,6 +269,7 @@ class GalaxyClusters:
data = OrderedDict([
("z0", z_obs),
("M0", M_obs), # [Msun]
+ ("merger_num", merger_num),
("lon", cdict["lon"]), # [deg] longitude
("lat", cdict["lat"]), # [deg] longitude
("felong", cdict["felong"]), # fraction of elongation