diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-26 21:07:53 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-26 21:07:53 +0800 |
commit | 3dfd7ce87f8d5351ca25c2392d69da30696b051c (patch) | |
tree | 5fb266caf9f6671ace11b6fa4221d6b739b201ac /fg21sim/extragalactic/clusters | |
parent | 4782fe57225db9d553f6a7659105b8fc85c54ce1 (diff) | |
download | fg21sim-3dfd7ce87f8d5351ca25c2392d69da30696b051c.tar.bz2 |
clusters/halo: Rewrite _merger_time() to get the effective merger
If the acceleration durations of multiple mergers overlap, the one with
the largest efficiency (i.e., smallest tau_acc) is chosen.
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index f66c347..4a62d3e 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -788,14 +788,6 @@ class RadioHaloAM(RadioHalo1M): "t": self.t_merger[idx], } - def _merger_time(self, t): - """ - Determine the beginning time of the merger event within which - the given time is located. - """ - merger = self._merger_event(t) - return merger["t"] - def mass_merged(self, t): """ The mass of merged cluster at the given (cosmic) time. @@ -845,6 +837,30 @@ class RadioHaloAM(RadioHalo1M): rate = (mass0 - mass1) / (t0 - t1) return (mass1 + rate * (t - t1)) + def _merger_time(self, t): + """ + Determine the beginning time of the merger event that is doing + effective acceleration at the given time. + + At a certain time, there may be multiple past merger events with + different turbulence durations (``tau_turb``) and acceleration + efficiencies (``tau_acc``). Therefore, multiple mergers can cover + the given time. The one with the largest acceleration efficiency + (i.e., smallest ``tau_acc``) is chosen and its beginning time is + returned. Otherwise, the most recent merger event happened before + the given time is chosen. + """ + mergers = [(tm, tm+self.duration_turb(tm), self.tau_acceleration(tm)) + for tm in self.t_merger] + m_active = [(tm, tend, tau) for (tm, tend, tau) in mergers + if t >= tm and t < tend] + if m_active: + m_eff = min(m_active, key=lambda item: item[2]) + return m_eff[0] + else: + m = self._merger_event(t) + return m["t"] + class RadioHalo: """ |