aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-20 16:10:53 +0800
committerAaron LI <aly@aaronly.me>2017-07-20 16:10:53 +0800
commit59b6c8afe1d5f295f71588415df425e64cd7a733 (patch)
treece21ab26cbd807846dc40d6bd7e601c39a719ff7
parent038d47dbff7f5fb536386f7b9e4f5de3141136ba (diff)
downloadfg21sim-59b6c8afe1d5f295f71588415df425e64cd7a733.tar.bz2
clusters/main.py: Add basic "preprocess()" method
Signed-off-by: Aaron LI <aly@aaronly.me>
-rw-r--r--fg21sim/extragalactic/clusters/main.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index c3a89d0..438b860 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -213,12 +213,34 @@ class GalaxyClusters:
logger.info("%d (%.1f%%) clusters have recent major mergers." %
(num_major, 100*num_major/num))
+ def preprocess(self):
+ """
+ Perform the preparation procedures for the later simulations.
+
+ Attributes
+ ----------
+ _preprocessed : bool
+ This attribute presents and is ``True`` after the preparation
+ procedures have been done.
+ """
+ if hasattr(self, "_preprocessed") and self._preprocessed:
+ return
+
+ logger.info("{name}: preprocessing ...".format(name=self.name))
+ self._load_catalog()
+ self._process_catalog()
+ self._simulate_merger()
+
+ # TODO ???
+
+ self._preprocessed = True
+
def postprocess(self):
"""
Do some necessary post-simulation operations.
"""
logger.info("{name}: postprocessing ...".format(name=self.name))
- # Save the effective/inuse clusters catalog
+ # Save the final resulting clusters catalog
logger.info("Save the resulting catalog ...")
if self.catalog_outfile is None:
logger.warning("Catalog output file not set; skip saving!")