aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/foregrounds.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-21 00:04:14 +0800
committerAaron LI <aly@aaronly.me>2017-07-21 00:12:18 +0800
commitbbea345360b0d0bdcbab7354965d48037e027c01 (patch)
tree5e00325c2da2d5f2cb85f19db914c13486ae7339 /fg21sim/foregrounds.py
parentdc2abe21d24a04aa36b9c8bd2e95d32982c225f8 (diff)
downloadfg21sim-bbea345360b0d0bdcbab7354965d48037e027c01.tar.bz2
foregrounds.py: Do not create products manifest if not configured
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/foregrounds.py')
-rw-r--r--fg21sim/foregrounds.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/fg21sim/foregrounds.py b/fg21sim/foregrounds.py
index 2fceef6..abb829f 100644
--- a/fg21sim/foregrounds.py
+++ b/fg21sim/foregrounds.py
@@ -79,8 +79,12 @@ class Foregrounds:
self._set_configs()
# Initialize the products manifest
logger.info("Initialize the products manifest ...")
- manifestfile = self.configs.get_path("output/manifest")
- self.products = Products(manifestfile, load=False)
+ self.manifestfile = self.configs.get_path("output/manifest")
+ if self.manifestfile:
+ self.products = Products(self.manifestfile, load=False)
+ else:
+ self.products = None
+ logger.warning("Output products manifest not configured!")
# Initialize enabled components
self.components = OrderedDict()
for comp in self.components_id:
@@ -176,7 +180,9 @@ class Foregrounds:
def preprocess(self):
"""Perform the preparation procedures for the final simulations."""
- self.products.frequencies = (self.frequencies, str(self.freq_unit))
+ if self.products:
+ self.products.frequencies = (self.frequencies,
+ str(self.freq_unit))
logger.info("Perform preprocessing for all enabled components ...")
for comp_obj in self.components.values():
comp_obj.preprocess()
@@ -205,13 +211,15 @@ class Foregrounds:
skymap_comb = np.zeros(shape=sky.shape)
for comp_id, comp_obj in self.components.items():
skymap, filepath = comp_obj.simulate_frequency(freq)
- if filepath is not None:
+ if filepath and self.products:
self.products.add_product(comp_id, freq_id, filepath)
if self.combine:
skymap_comb += skymap
if self.combine:
filepath_comb = self._output(skymap_comb, freq)
- self.products.add_product("combined", freq_id, filepath_comb)
+ if self.products:
+ self.products.add_product("combined", freq_id,
+ filepath_comb)
def postprocess(self):
"""Perform the post-simulation operations before the end."""
@@ -219,4 +227,5 @@ class Foregrounds:
for comp_obj in self.components.values():
comp_obj.postprocess()
# Save the products manifest
- self.products.dump(clobber=self.clobber, backup=True)
+ if self.products:
+ self.products.dump(clobber=self.clobber, backup=True)