aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-10-27 11:15:35 +0800
committerAaron LI <aaronly.me@outlook.com>2016-10-27 11:18:12 +0800
commit5cbbaab825382d1fc174d5f7502947a7846d0361 (patch)
treefd91d15a412e3ece5981cd44704b776e92d6c8ec
parentb657912d9080d814690122a59f91fe2001717c9e (diff)
downloadfg21sim-5cbbaab825382d1fc174d5f7502947a7846d0361.tar.bz2
Update to use the new "checksum" config option
Also add a warning log message for "galactic/snr.py" and "extragalactic/clusters.py".
-rw-r--r--fg21sim/extragalactic/clusters.py5
-rw-r--r--fg21sim/galactic/freefree.py3
-rw-r--r--fg21sim/galactic/snr.py5
-rw-r--r--fg21sim/galactic/synchrotron.py3
4 files changed, 12 insertions, 4 deletions
diff --git a/fg21sim/extragalactic/clusters.py b/fg21sim/extragalactic/clusters.py
index 540ec52..753b025 100644
--- a/fg21sim/extragalactic/clusters.py
+++ b/fg21sim/extragalactic/clusters.py
@@ -108,6 +108,7 @@ class GalaxyClusters:
#
self.filename_pattern = self.configs.getn("output/filename_pattern")
self.use_float = self.configs.getn("output/use_float")
+ self.checksum = self.configs.getn("output/checksum")
self.clobber = self.configs.getn("output/clobber")
self.nside = self.configs.getn("common/nside")
self.freq_unit = au.Unit(self.configs.getn("frequency/unit"))
@@ -160,6 +161,8 @@ class GalaxyClusters:
# Save catalog data
if os.path.exists(self.catalog_outfile):
if self.clobber:
+ logger.warning("Remove existing catalog file: {0}".format(
+ self.catalog_outfile))
os.remove(self.catalog_outfile)
else:
raise OSError("Output file already exists: {0}".format(
@@ -599,7 +602,7 @@ class GalaxyClusters:
if self.use_float:
hpmap = hpmap.astype(np.float32)
write_fits_healpix(filepath, hpmap, header=header,
- clobber=self.clobber)
+ clobber=self.clobber, checksum=self.checksum)
logger.info("Write simulated map to file: {0}".format(filepath))
def preprocess(self):
diff --git a/fg21sim/galactic/freefree.py b/fg21sim/galactic/freefree.py
index 2023798..bc5741b 100644
--- a/fg21sim/galactic/freefree.py
+++ b/fg21sim/galactic/freefree.py
@@ -82,6 +82,7 @@ class FreeFree:
#
self.filename_pattern = self.configs.getn("output/filename_pattern")
self.use_float = self.configs.getn("output/use_float")
+ self.checksum = self.configs.getn("output/checksum")
self.clobber = self.configs.getn("output/clobber")
self.nside = self.configs.getn("common/nside")
self.freq_unit = au.Unit(self.configs.getn("frequency/unit"))
@@ -230,7 +231,7 @@ class FreeFree:
if self.use_float:
hpmap = hpmap.astype(np.float32)
write_fits_healpix(filepath, hpmap, header=header,
- clobber=self.clobber)
+ clobber=self.clobber, checksum=self.checksum)
logger.info("Write simulated map to file: {0}".format(filepath))
def preprocess(self):
diff --git a/fg21sim/galactic/snr.py b/fg21sim/galactic/snr.py
index 380f61a..5fc52e3 100644
--- a/fg21sim/galactic/snr.py
+++ b/fg21sim/galactic/snr.py
@@ -85,6 +85,7 @@ class SuperNovaRemnants:
#
self.filename_pattern = self.configs.getn("output/filename_pattern")
self.use_float = self.configs.getn("output/use_float")
+ self.checksum = self.configs.getn("output/checksum")
self.clobber = self.configs.getn("output/clobber")
self.nside = self.configs.getn("common/nside")
self.freq_unit = au.Unit(self.configs.getn("frequency/unit"))
@@ -133,6 +134,8 @@ class SuperNovaRemnants:
"specindex", "rotation"]
if os.path.exists(self.catalog_outfile):
if self.clobber:
+ logger.warning("Remove existing catalog file: {0}".format(
+ self.catalog_outfile))
os.remove(self.catalog_outfile)
else:
raise OSError("Output file already exists: {0}".format(
@@ -359,7 +362,7 @@ class SuperNovaRemnants:
if self.use_float:
hpmap = hpmap.astype(np.float32)
write_fits_healpix(filepath, hpmap, header=header,
- clobber=self.clobber)
+ clobber=self.clobber, checksum=self.checksum)
logger.info("Write simulated map to file: {0}".format(filepath))
def preprocess(self):
diff --git a/fg21sim/galactic/synchrotron.py b/fg21sim/galactic/synchrotron.py
index 7ab33f0..b82b636 100644
--- a/fg21sim/galactic/synchrotron.py
+++ b/fg21sim/galactic/synchrotron.py
@@ -61,6 +61,7 @@ class Synchrotron:
# output
self.filename_pattern = self.configs.getn("output/filename_pattern")
self.use_float = self.configs.getn("output/use_float")
+ self.checksum = self.configs.getn("output/checksum")
self.clobber = self.configs.getn("output/clobber")
self.nside = self.configs.getn("common/nside")
self.lmin = self.configs.getn("common/lmin")
@@ -192,7 +193,7 @@ class Synchrotron:
if self.use_float:
hpmap = hpmap.astype(np.float32)
write_fits_healpix(filepath, hpmap, header=header,
- clobber=self.clobber)
+ clobber=self.clobber, checksum=self.checksum)
logger.info("Write simulated map to file: {0}".format(filepath))
def preprocess(self):