From 9a5478446d5e28b64783efe9c8282f2eb27be1a5 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 10 Jan 2019 00:11:08 +0800 Subject: clusters/main: Add _calc_cluster_info() Move the calculation of Rvir, kT, and B from halo.py to main.py. --- fg21sim/extragalactic/clusters/halo.py | 29 ----------------------------- fg21sim/extragalactic/clusters/main.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 29 deletions(-) (limited to 'fg21sim') diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index c367eb5..19a1575 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -225,14 +225,6 @@ class RadioHalo: v_turb = self._velocity_turb(t_merger) # [km/s] return v_turb / cs - @property - def radius_virial_obs(self): - """ - The virial radius of the "current" cluster (``M_obs``) at ``z_obs``. - Unit: [kpc] - """ - return helper.radius_virial(mass=self.M_obs, z=self.z_obs) - @lru_cache() def radius_turbulence(self, t): """ @@ -285,27 +277,6 @@ class RadioHalo: """ return (4*np.pi/3) * self.radius**3 - @property - def B_obs(self): - """ - The magnetic field strength at the simulated observation - time (i.e., cluster mass of ``self.M_obs``), will be used - to calculate the synchrotron emissions. - - Unit: [uG] - """ - return helper.magnetic_field(mass=self.M_obs, z=self.z_obs, - configs=self.configs) - - @property - def kT_obs(self): - """ - The ICM mean temperature of the cluster at ``z_obs``. - Unit: [keV] - """ - return helper.kT_cluster(self.M_obs, z=self.z_obs, - configs=self.configs) - @lru_cache() def kT(self, t): """ diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index 2a1a6b3..bd68f0d 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -172,6 +172,28 @@ class GalaxyClusters: ] logger.info("Added catalog items: age, lon, lat, felong, rotation.") + def _calc_cluster_info(self): + """ + Calculate some basic information for each cluster. + """ + logger.info("Calculating basic information for each cluster ...") + for cdict in enumerate(self.catalog): + z, mass = cdict["z"], cdict["mass"] + Rvir = helper.radius_virial(mass, z) + kT = helper.kT_cluster(mass, z, configs=self.configs) + B = helper.magnetic_field(mass, z, configs=self.configs) + cdict.update([ + ("Rvir", Rvir), + ("kT", kT), + ("B", B), + ]) + + self.comments += [ + "Rvir - [kpc] virial radius", + "kT - [keV] ICM mean temperature", + "B - [uG] magnetic field", + ] + def _simulate_mergers(self): """ Simulate the formation history of each cluster to build their @@ -519,6 +541,7 @@ class GalaxyClusters: else: self._simulate_catalog() self._process_catalog() + self._calc_cluster_info() self._simulate_mergers() if self.use_dump_halos_data: -- cgit v1.2.2