aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fg21sim/extragalactic/clusters/main.py55
1 files changed, 28 insertions, 27 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index f16a203..70d5e6b 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -23,7 +23,8 @@ from .psformalism import PSFormalism
from .formation import ClusterFormation
from .halo import RadioHalo
from ...share import CONFIGS, COSMO
-from ...utils.io import dataframe_to_csv, csv_to_dataframe, pickle_dump
+from ...utils.io import (dataframe_to_csv, csv_to_dataframe,
+ pickle_dump, pickle_load)
from ...utils.ds import dictlist_to_dataframe
from ...utils.convert import JyPerPix_to_K
from ...sky import get_sky
@@ -314,6 +315,31 @@ class GalaxyClusters:
hdict["Tb_mean"] = Tb_mean # [K]
logger.info("Done calculate the radio emissions.")
+ def _draw_halos(self):
+ """
+ Draw the template images for each halo, and cache them for
+ simulating the superimposed halos at requested frequencies.
+
+ NOTE
+ ----
+ The drawn template images are append to the dictionaries of
+ the corresponding halo within the ``self.halos``.
+ The templates are normalized to have *mean* value of 1.
+ """
+ num = len(self.halos)
+ logger.info("Draw template images for %d halos ..." % num)
+ i = 0
+ for hdict in self.halos:
+ i += 1
+ if i % 100 == 0:
+ logger.info("[%d/%d] %.1f%% ..." % (i, num, 100*i/num))
+ theta_e = hdict["angular_radius"] / self.sky.pixelsize
+ rprofile = helper.halo_rprofile(re=theta_e)
+ template = helper.draw_halo(rprofile, felong=hdict["felong"],
+ rotation=hdict["rotation"])
+ hdict["template"] = template
+ logger.info("Done drawn halo template images.")
+
def _save_halos_catalog(self, outfile=None):
"""
Convert the halos data (``self.halos``) into a Pandas DataFrame
@@ -325,7 +351,7 @@ class GalaxyClusters:
logger.info("Converting halos data to be a Pandas DataFrame ...")
keys = list(self.halos[0].keys())
# Ignore the ``gamma`` and ``n_e`` items
- for k in ["gamma", "n_e"]:
+ for k in ["gamma", "n_e", "template"]:
keys.remove(k)
halos_df = dictlist_to_dataframe(self.halos, keys=keys)
dataframe_to_csv(halos_df, outfile, clobber=self.clobber)
@@ -341,31 +367,6 @@ class GalaxyClusters:
outfile = self.halos_data_dumpfile
pickle_dump(self.halos, outfile=outfile, clobber=self.clobber)
- def _draw_halos(self):
- """
- Draw the template images for each halo, and cache them for
- simulating the superimposed halos at requested frequencies.
-
- NOTE
- ----
- The drawn template images are append to the dictionaries of
- the corresponding halo within the ``self.halos``.
- The templates are normalized to have *mean* value of 1.
- """
- num = len(self.halos)
- logger.info("Draw template images for %d halos ..." % num)
- i = 0
- for hdict in self.halos:
- i += 1
- if i % 100 == 0:
- logger.info("[%d/%d] %.1f%% ..." % (i, num, 100*i/num))
- theta_e = hdict["angular_radius"] / self.sky.pixelsize
- rprofile = helper.halo_rprofile(re=theta_e)
- template = helper.draw_halo(rprofile, felong=hdict["felong"],
- rotation=hdict["rotation"])
- hdict["template"] = template
- logger.info("Done drawn halo template images.")
-
def _outfilepath(self, frequency, **kwargs):
"""
Generate the path/filename to the output file for writing