From 82cfaef1068f6354933a79412ca25694d201acf7 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 18 Aug 2017 12:16:50 +0800 Subject: make_lightcone.py: Fix unit and check clobber first --- astro/21cm/make_lightcone.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/astro/21cm/make_lightcone.py b/astro/21cm/make_lightcone.py index a17c217..3c86670 100755 --- a/astro/21cm/make_lightcone.py +++ b/astro/21cm/make_lightcone.py @@ -250,7 +250,7 @@ class LightCone: Dc_min, __ = self.configs.Dc_limit w = WCS(naxis=3) w.wcs.ctype = ["pixel", "pixel", "pixel"] - w.wcs.cunit = ["cMpc", "cMpc", "cMpc"] + w.wcs.cunit = ["Mpc", "Mpc", "Mpc"] # comoving w.wcs.crpix = np.array([1.0, 1.0, 1.0]) w.wcs.crval = np.array([0.0, 0.0, Dc_min]) w.wcs.cdelt = np.array([self.configs.Dc_cell, @@ -298,6 +298,10 @@ def main(): parser.add_argument("config", help="configuration file") args = parser.parse_args() configs = Configs(args.config) + + if os.path.exists(configs.outfile) and (not configs.clobber): + raise OSError("output file already exists: %s" % configs.outfile) + cubepair = CubePair(Nside=configs.Nside, dtype=configs.dtype) lightcone = LightCone(configs) for idx, Dc in enumerate(lightcone.slices_Dc): -- cgit v1.2.2