aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-20 00:00:41 +0800
committerAaron LI <aly@aaronly.me>2017-07-20 00:00:41 +0800
commita172bba02606020e7ddfa3862fa32f602770c6ba (patch)
tree446c89b1241d734cd57d98e6a434c8dd6b70bc15 /fg21sim
parent871a45b2978a13beb16557d6e34172c2feb5e14a (diff)
downloadfg21sim-a172bba02606020e7ddfa3862fa32f602770c6ba.tar.bz2
clusters/formation.py: Fix bug in "_trace_main()"
Do not modify the root node of the merger tree, and return this root node after tracing the formation history. Also print some more information for debug. Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/formation.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py
index c1a93bf..0242992 100644
--- a/fg21sim/extragalactic/clusters/formation.py
+++ b/fg21sim/extragalactic/clusters/formation.py
@@ -245,10 +245,12 @@ class ClusterFormation:
# Initial properties
zc = self.z0
Mc = self.M0
- mtree = MergerTree(data={"mass": Mc,
- "z": zc,
- "age": self.cosmo.age(zc)})
+ mtree_root = MergerTree(data={"mass": Mc,
+ "z": zc,
+ "age": self.cosmo.age(zc)})
+ logger.debug("[main] z=%.4f : mass=%g [Msun]" % (zc, Mc))
+ mtree = mtree_root
while True:
# Whether to stop the trace
if self.zmax is not None and zc > self.zmax:
@@ -283,18 +285,20 @@ class ClusterFormation:
mtree.sub = MergerTree(data={"mass": M_sub,
"z": z1,
"age": age1})
+ logger.debug("[sub] z=%.4f : mass=%g [Msun]" % (z1, M_sub))
# Update main cluster
mtree.main = MergerTree(data={"mass": M_main,
"z": z1,
"age": age1})
+ logger.debug("[main] z=%.4f : mass=%g [Msun]" % (z1, M_main))
# Update for next iteration
Mc = M_main
zc = z1
mtree = mtree.main
- return mtree
+ return mtree_root
def _trace_formation(self, M, _z=None, zmax=None):
"""