diff options
author | Aaron LI <aly@aaronly.me> | 2017-11-25 13:59:19 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-11-25 13:59:19 +0800 |
commit | 8a351c1a0bd413dd055b7529e97fe4e7ca2654c3 (patch) | |
tree | 3f02c5051d4078424c2af0df6955963638d7f60a /astro | |
parent | 6f3fba36ef22de456af71844e9428e921daf6683 (diff) | |
download | atoolbox-8a351c1a0bd413dd055b7529e97fe4e7ca2654c3.tar.bz2 |
astro/ps2d.py: Check outfile existence before calculation
Diffstat (limited to 'astro')
-rwxr-xr-x | astro/ps2d.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/astro/ps2d.py b/astro/ps2d.py index c8a4620..718b59a 100755 --- a/astro/ps2d.py +++ b/astro/ps2d.py @@ -533,6 +533,9 @@ def main(): help="output 2D power spectrum FITS file") args = parser.parse_args() + if (not args.clobber) and os.path.exists(args.outfile): + raise OSError("outfile '%s' already exists" % args.outfile) + with fits.open(args.infile[0]) as f: cube = f[0].data header = f[0].header |