diff options
author | Aaron LI <aly@aaronly.me> | 2017-08-18 12:16:50 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-08-18 12:16:50 +0800 |
commit | 82cfaef1068f6354933a79412ca25694d201acf7 (patch) | |
tree | d93fb38064e90fd75205875082255674cde199f8 | |
parent | 4858d2775f69e3c2c569ceaa9d8aa48071bd6102 (diff) | |
download | atoolbox-82cfaef1068f6354933a79412ca25694d201acf7.tar.bz2 |
make_lightcone.py: Fix unit and check clobber first
-rwxr-xr-x | astro/21cm/make_lightcone.py | 6 |
1 files changed, 5 insertions, 1 deletions
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): |