From 12113be5f66bbfb048cc49b47c8df96d44a57807 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 26 Feb 2019 21:24:23 +0800 Subject: 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. --- fg21sim/configs/config.spec | 4 ++++ fg21sim/extragalactic/clusters/main.py | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'fg21sim') 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 ...") -- cgit v1.2.2