aboutsummaryrefslogtreecommitdiffstats
path: root/astro/oskar
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-09-01 23:15:47 +0800
committerAaron LI <aly@aaronly.me>2017-09-01 23:15:47 +0800
commitb7b24d33a8c45ab62eceb9b0ed331f07a018cce2 (patch)
treeb7791f2614274b97872800118deeb26e8f97698a /astro/oskar
parentd00116b42bc0609a12273823113d4828654d4ba8 (diff)
downloadatoolbox-b7b24d33a8c45ab62eceb9b0ed331f07a018cce2.tar.bz2
wsclean.py: Add --dry-run argument to support dry run mode
Diffstat (limited to 'astro/oskar')
-rwxr-xr-xastro/oskar/wsclean.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/astro/oskar/wsclean.py b/astro/oskar/wsclean.py
index 18e4b4c..29cfdbb 100755
--- a/astro/oskar/wsclean.py
+++ b/astro/oskar/wsclean.py
@@ -16,10 +16,14 @@ import subprocess
import time
-def wsclean(args):
- t1 = time.perf_counter()
+def wsclean(args, dryrun=False):
cmd = ["wsclean"] + args
print("CMD: %s" % " ".join(cmd))
+ if dryrun:
+ print(">>> DRY RUN MODE <<<")
+ return
+
+ t1 = time.perf_counter()
subprocess.check_call(cmd)
t2 = time.perf_counter()
print("-----------------------------------------------------------")
@@ -29,6 +33,8 @@ def wsclean(args):
def main():
parser = argparse.ArgumentParser(description="Run WSClean")
+ parser.add_argument("-n", "--dry-run", dest="dryrun", action="store_true",
+ help="do not actually run WSClean")
parser.add_argument("--args", dest="args", nargs="*",
help="additional arguments for WSClean")
parser.add_argument("--dirty", dest="dirty", action="store_true",
@@ -116,9 +122,9 @@ def main():
cmdargs += ["-name", nameprefix]
cmdargs += args.ms
- wsclean(cmdargs)
+ wsclean(cmdargs, dryrun=args.dryrun)
- if args.dirty:
+ if args.dirty and not args.dryrun:
# Remove the output "-image" since it is identical to "-dirty"
os.remove(nameprefix+"-image.fits")