diff options
author | Aaron LI <aly@aaronly.me> | 2017-09-01 23:15:47 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-09-01 23:15:47 +0800 |
commit | b7b24d33a8c45ab62eceb9b0ed331f07a018cce2 (patch) | |
tree | b7791f2614274b97872800118deeb26e8f97698a | |
parent | d00116b42bc0609a12273823113d4828654d4ba8 (diff) | |
download | atoolbox-b7b24d33a8c45ab62eceb9b0ed331f07a018cce2.tar.bz2 |
wsclean.py: Add --dry-run argument to support dry run mode
-rwxr-xr-x | astro/oskar/wsclean.py | 14 |
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") |