aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-02-26 21:24:23 +0800
committerAaron LI <aly@aaronly.me>2019-02-26 21:24:23 +0800
commit12113be5f66bbfb048cc49b47c8df96d44a57807 (patch)
treecde2e1ff4e1070b04b1a8dfa375dfcbb4ff1cfbb
parente405b8dbb8b8bd4c9eda80cb49235979e7500a3f (diff)
downloadfg21sim-12113be5f66bbfb048cc49b47c8df96d44a57807.tar.bz2
clusters/main: Allow to disable map generation
New configuration option 'extragalactic/clusters/make_maps' is added to control whether or not to make and save the simulated maps.
-rw-r--r--fg21sim/configs/config.spec4
-rw-r--r--fg21sim/extragalactic/clusters/main.py16
2 files changed, 14 insertions, 6 deletions
diff --git a/fg21sim/configs/config.spec b/fg21sim/configs/config.spec
index 5d13bed..e3d0aa5 100644
--- a/fg21sim/configs/config.spec
+++ b/fg21sim/configs/config.spec
@@ -373,6 +373,10 @@ stream = option("stderr", "stdout", "", default="stderr")
# Unit: [keV]
kT_out = float(default=0, min=0)
+ # Whether to make the simulated sky maps? It is useful to disable the
+ # map generation during the parameter tuning.
+ make_maps = boolean(default=True)
+
# Filename prefix for this component
prefix = string(default="cluster")
# Output directory to save the simulated results
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index 92a8195..994e0f3 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -85,6 +85,7 @@ class GalaxyClusters:
self.merger_mass_min = configs.getn(sec+"/merger_mass_min")
self.time_traceback = configs.getn(sec+"/time_traceback")
self.kT_out = configs.getn(sec+"/kT_out")
+ self.make_maps = configs.getn(sec+"/make_maps")
self.frequencies = configs.frequencies
self.filename_pattern = configs.getn("output/filename_pattern")
@@ -650,11 +651,15 @@ class GalaxyClusters:
"""
logger.info("Simulating {name} ...".format(name=self.name))
skyfiles = []
- for idx, freq in enumerate(self.frequencies):
- sky = self.simulate_frequency(freqidx=idx)
- outfile = self._outfilepath(frequency=freq)
- sky.write(outfile)
- skyfiles.append(outfile)
+ if self.make_maps:
+ for idx, freq in enumerate(self.frequencies):
+ sky = self.simulate_frequency(freqidx=idx)
+ outfile = self._outfilepath(frequency=freq)
+ sky.write(outfile)
+ skyfiles.append(outfile)
+ else:
+ logger.warning("Map generation disabled!")
+
logger.info("Done simulate {name}!".format(name=self.name))
return skyfiles
@@ -663,7 +668,6 @@ class GalaxyClusters:
Do some necessary post-simulation operations.
"""
logger.info("{name}: postprocessing ...".format(name=self.name))
- # Save the final resulting clusters catalog
logger.info("Save the cluster catalog ...")
self._save_catalog_data()
logger.info("Saving the simulated halos catalog and raw data ...")