diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-29 15:59:17 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-29 15:59:17 +0800 |
commit | b60e1c2232d9f8e187ecb877b323154445b991f6 (patch) | |
tree | c276d99610e64cc643c0b2c39b1389027e4201aa /fg21sim/extragalactic/clusters/formation.py | |
parent | e02dbad25018386e9ebe38e1495a95b46633ec70 (diff) | |
download | fg21sim-b60e1c2232d9f8e187ecb877b323154445b991f6.tar.bz2 |
clusters/formation: Move history() to mergertree.get_history()
Diffstat (limited to 'fg21sim/extragalactic/clusters/formation.py')
-rw-r--r-- | fg21sim/extragalactic/clusters/formation.py | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py index 65e32b6..dc39b62 100644 --- a/fg21sim/extragalactic/clusters/formation.py +++ b/fg21sim/extragalactic/clusters/formation.py @@ -17,14 +17,13 @@ References """ import logging -import operator as op import numpy as np import scipy.integrate import scipy.special import scipy.optimize -from .mergertree import MergerTree +from .mergertree import MergerTree, get_history from ...share import COSMO @@ -256,14 +255,10 @@ class ClusterFormation: def history(self, mtree=None, merger_only=False): """ - Extract and return all the formation events, e.g., merger and - accretion. + Extract all the formation history (merger and accretion events). Parameters ---------- - mtree : `~MergerTree`, optional - The simulated merger tree from which to extract the history. - Default: ``self.mtree`` merger_only : bool, optional If ``True``, only extract the merger events. @@ -275,29 +270,7 @@ class ClusterFormation: """ if mtree is None: mtree = self.mtree - - evlist = [] - for main, sub in mtree.itermain(): - z, age, M_main = op.itemgetter("z", "age", "mass")(main) - if sub: - # merger - M_sub = sub["mass"] - R_mass = M_main / M_sub - else: - # accretion - if merger_only: - continue - M_sub, R_mass = None, None - - evlist.append({ - "z": z, - "age": age, - "M_main": M_main, - "M_sub": M_sub, - "R_mass": R_mass, - }) - - return evlist + return get_history(mtree=mtree, merger_only=merger_only) def mergers(self, mtree=None): """ |