aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-01-27 14:27:37 +0800
committerAaron LI <aly@aaronly.me>2019-01-27 14:27:37 +0800
commit44e98825af60e9312ee82864a887a8b3751147e0 (patch)
treee0ed08ccf8ea429fdda485dbf9448f39da7a1d1e
parent99b906360564d68b149d3e35e990e73c82676bf6 (diff)
downloadfg21sim-44e98825af60e9312ee82864a887a8b3751147e0.tar.bz2
clusters/halo: Implement radius_turb_eff() method
-rw-r--r--fg21sim/extragalactic/clusters/halo.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 94cb1c0..c5da9eb 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -778,6 +778,33 @@ class RadioHaloAM(RadioHalo1M):
"""
return max([self.radius_turb(tm) for tm in self.t_merger])
+ def radius_turb_eff(self, t, use_last=True):
+ """
+ Get the effective turbulence radius, i.e., the largest one if
+ multiple mergers are active at the given time.
+
+ Parameters
+ ----------
+ use_last : bool
+ If ``True``, return the turbulence radius of the last merger
+ event when there is no active turbulence at the given time.
+ Otherwise, return 0.
+
+ Unit: [kpc]
+ """
+ mergers = [(t, t+self.duration_turb(t), self.radius_turb(t))
+ for t in self.t_merger] # time decreasing
+ try:
+ r_eff = max([r for t1, t2, r in mergers if t >= t1 and t < t2])
+ except ValueError:
+ # No active turbulence at this time
+ if use_last:
+ r_eff = next(r for __, t2, r in mergers if t >= t2)
+ else:
+ r_eff = 0
+
+ return r_eff
+
@property
def t_begin(self):
"""