diff options
author | Aaron LI <aly@aaronly.me> | 2019-01-26 15:20:38 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2019-01-26 15:20:38 +0800 |
commit | 230c54b44958dbef49c0300d7479576c45e057c5 (patch) | |
tree | ed8977b5e27cee6e246d4418ebb176b870788030 /fg21sim/extragalactic | |
parent | 73883bf8ad77c9cfd2015b15af5af5fa73dbaf43 (diff) | |
download | fg21sim-230c54b44958dbef49c0300d7479576c45e057c5.tar.bz2 |
clusters/halo: Use t_merger to be more explicit
Add _validate_t_merger() method to validate the given time to be an
merger time.
Diffstat (limited to 'fg21sim/extragalactic')
-rw-r--r-- | fg21sim/extragalactic/clusters/halo.py | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index 2b7994a..706426e 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -227,7 +227,7 @@ class RadioHalo1M: return v_turb / cs @lru_cache() - def radius_turbulence(self, t): + def radius_turbulence(self, t_merger): """ The radius of the turbulence region, which is estimated as the stripping radius ``r_s`` of the sub-cluster if ``r_s`` is larger @@ -236,21 +236,23 @@ class RadioHalo1M: Unit: [kpc] """ - z = COSMO.redshift(t) - M_main = self.mass_main(t) + self._validate_t_merger(t_merger) + z = COSMO.redshift(t_merger) + M_main = self.mass_main(t_merger) + r_s = self.radius_stripping(t_merger) r_c = self.f_rc * helper.radius_virial(M_main, z) - r_s = self.radius_stripping(t) return max([r_s, r_c]) @lru_cache() - def radius_stripping(self, t): + def radius_stripping(self, t_merger): """ The stripping radius of the in-falling sub-cluster at time t. Unit: [kpc] """ - z = COSMO.redshift(t) - M_main = self.mass_main(t) - M_sub = self.mass_sub(t) + self._validate_t_merger(t_merger) + z = COSMO.redshift(t_merger) + M_main = self.mass_main(t_merger) + M_sub = self.mass_sub(t_merger) return helper.radius_stripping(M_main, M_sub, z, f_rc=self.f_rc, beta=self.beta) @@ -609,6 +611,14 @@ class RadioHalo1M: """ return self.age_merger + def _validate_t_merger(self, t_merger): + """ + Validate that the given time ``t_merger`` is the time when the + merger begins, otherwise raise an error. + """ + if not np.any(np.isclose(t_merger, self.age_merger)): + raise ValueError("Not a merger time: %s" % t_merger) + def mass_merged(self, t=None): """ The mass of the merged cluster. @@ -655,7 +665,7 @@ class RadioHalo1M: eta_b=eta_b, kT_out=kT_out) @lru_cache() - def _velocity_turb(self, t): + def _velocity_turb(self, t_merger): """ Calculate the turbulence velocity dispersion. @@ -686,10 +696,12 @@ class RadioHalo1M: The turbulence velocity dispersion Unit: [km/s] """ - z = COSMO.redshift(t) - M_main = self.mass_main(t) - M_sub = self.mass_sub(t) - R_turb = self.radius_turbulence(t) # [kpc] + self._validate_t_merger(t_merger) + z = COSMO.redshift(t_merger) + M_main = self.mass_main(t_merger) + M_sub = self.mass_sub(t_merger) + r_s = self.radius_stripping(t_merger) # [kpc] + R_turb = self.radius_turbulence(t_merger) # [kpc] rho_gas_f = helper.calc_gas_density_profile( M_main, z, f_rc=self.f_rc, beta=self.beta) |