diff options
author | Aaron LI <aly@aaronly.me> | 2018-01-01 14:44:39 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-01-01 14:51:07 +0800 |
commit | ee80b0578613410dc4b66487ec4dacd474b025d5 (patch) | |
tree | d55d9c71d5bbcf791528a4b8affe05711397a71d /fg21sim/extragalactic/clusters | |
parent | 8a6c73e48eb36f1aab223b9b2b29dc020d8571fb (diff) | |
download | fg21sim-ee80b0578613410dc4b66487ec4dacd474b025d5.tar.bz2 |
clusters/formation: Move parameter "ratio_major" to recent_major_merger()
* Simplify "max_merger" property to not check whether it is a major merger.
* Rename "max_merger" to "maximum_merger"
* Rename "simulate_mergertree()" to "simulate_mtree()"
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r-- | fg21sim/extragalactic/clusters/formation.py | 44 | ||||
-rw-r--r-- | fg21sim/extragalactic/clusters/main.py | 7 |
2 files changed, 19 insertions, 32 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py index bfe2142..a48d68e 100644 --- a/fg21sim/extragalactic/clusters/formation.py +++ b/fg21sim/extragalactic/clusters/formation.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Weitian LI <weitian@aaronly.me> +# Copyright (c) 2017-2018 Weitian LI <weitian@aaronly.me> # MIT license """ @@ -45,11 +45,6 @@ class ClusterFormation: zmax : float, optional The maximum redshift/age when to stop the formation trace. Default: 3.0 (i.e., looking back time ~11.5 Gyr) - ratio_major : float, optional - The mass ratio of the main and sub clusters to define whether - the merger is a major event or a minor one. - If ``M_main/M_sub < ratio_major``, then it is a major merger event. - Default: 3.0 merger_mass_min : float, optional Minimum mass change to be regarded as a merger event instead of accretion. @@ -63,12 +58,10 @@ class ClusterFormation: An dictionary containing the properties of the found most recent major merger event, or ``None`` if not found. """ - def __init__(self, M0, z0, zmax=3.0, ratio_major=3.0, - merger_mass_min=1e12): + def __init__(self, M0, z0, zmax=3.0, merger_mass_min=1e12): self.M0 = M0 # [Msun] self.z0 = z0 self.zmax = zmax - self.ratio_major = ratio_major self.merger_mass_min = merger_mass_min @property @@ -171,7 +164,7 @@ class ClusterFormation: dS = self.cdf_K_inv(r, dw) return dS - def simulate_mergertree(self, main_only=True): + def simulate_mtree(self, main_only=True): """ Simulate the merger tree of this cluster by tracing its formation using the PS formalism. @@ -199,11 +192,18 @@ class ClusterFormation: logger.debug("Simulated cluster formation with merger tree.") return self.mtree - @property - def recent_major_merger(self): + def recent_major_merger(self, ratio_major=3.0): """ Identify and return the most recent major merger event. + Parameters + ---------- + ratio_major : float, optional + The mass ratio of the main and sub clusters to define whether + the merger is a major event or a minor one. + If ``M_main/M_sub < ratio_major``, then it is a major merger. + Default: 3.0 + Returns ------- event : @@ -240,16 +240,15 @@ class ClusterFormation: return event @property - def max_merger(self): + def maximum_merger(self): """ The merger event corresponding to the biggest sub cluster, i.e., - the main cluster gains most mass. + the main cluster gains the most mass. NOTE ---- - Generally, the above most recent major merger event, if identified, - should also be maximum merger found here. Otherwise, a warning - message is logged. + Sometimes, the maximum merger event found here is not an major + merger event. Returns ------- @@ -261,7 +260,6 @@ class ClusterFormation: mtree = self.mtree event_max = {"M_main": -1, "M_sub": -1, "R_mass": -1, "z": -1, "age": -1} - event_major = None # Record the most recent major merger event while mtree and mtree.main: if mtree.sub is None: mtree = mtree.main @@ -272,22 +270,12 @@ class ClusterFormation: z = mtree.main.data["z"] age = mtree.main.data["age"] if (M_sub > event_max["M_sub"]): - # Track the found maximum merger event_max = {"M_main": M_main, "M_sub": M_sub, "R_mass": M_main / M_sub, "z": z, "age": age} - if (event_major is None) and (M_main/M_sub <= self.ratio_major): - # Most recent major merger event - event_major = {"M_main": M_main, "M_sub": M_sub, - "R_mass": M_main / M_sub, - "z": z, "age": age} - # Continue mtree = mtree.main - if event_major and abs(event_major["z"]-event_max["z"]) > 1e-4: - logger.warning("recent major merger != maximum merger") - if event_max["z"] <= 0: logger.warning("no mergers occurred at all!!") return None diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index a8e0576..9d3810d 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -213,14 +213,13 @@ class GalaxyClusters: age0 = COSMO.age(z0) zmax = COSMO.redshift(age0 - self.time_traceback) clform = ClusterFormation(M0=M0, z0=z0, zmax=zmax, - ratio_major=self.ratio_major, merger_mass_min=self.merger_mass_min) - clform.simulate_mergertree(main_only=True) + clform.simulate_mtree(main_only=True) if self.use_max_merger: # NOTE: may be ``None`` due to no mergers occurred at all! - mmev = clform.max_merger + mmev = clform.maximum_merger else: - mmev = clform.recent_major_merger + mmev = clform.recent_major_merger(self.ratio_major) if mmev: mdata[i, :] = [mmev["M_main"], mmev["M_sub"], mmev["z"], mmev["age"]] |