diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-26 17:19:26 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-26 17:19:26 +0800 |
commit | 3c362e744b0acde57a8f99de8f671d7b258b8de9 (patch) | |
tree | 81a3650e81fbfc9c0577b6340686ee2bf1343ab0 /fg21sim/extragalactic/clusters | |
parent | a5aa0b4e4c270c84aa4347c9789332b75d661a11 (diff) | |
download | fg21sim-3c362e744b0acde57a8f99de8f671d7b258b8de9.tar.bz2 |
clusters/halo: Fold _merger_idx() into _merger_event()
Update _merger_time() accordingly.
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 14a9028..b11f060 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -774,27 +774,12 @@ class RadioHaloAM(RadioHalo1M): """ return self.age_merger[-1] - def _merger_idx(self, t): - """ - Determine the index of the merger event within which the given - time is located, i.e.: - age_merger[idx-1] >= t > age_merger[idx] - """ - return (self.age_merger > t).sum() - - def _merger_time(self, t): - """ - Determine the beginning time of the merger event within which - the given time is located. - """ - idx = self._merger_idx(t) - return self.age_merger[idx] - def _merger_event(self, t): """ - Return the merger event at cosmic time ``t``. + Return the most recent merger event happend before the given time, + i.e., the merger event that the given time locates in. """ - idx = self._merger_idx(t) + idx = (self.age_merger > t).sum() return { "idx": idx, "M_main": self.M_main[idx], @@ -803,6 +788,14 @@ class RadioHaloAM(RadioHalo1M): "age": self.age_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["age"] + def mass_merged(self, t): """ The mass of merged cluster at the given (cosmic) time. |