aboutsummaryrefslogtreecommitdiffstats
path: root/astro/oskar
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-02-06 16:46:52 +0800
committerAaron LI <aly@aaronly.me>2018-02-06 16:46:52 +0800
commit9621d66105248b3f460b54e64f2b98e60b1fa839 (patch)
treee4137eeffb1bfde8157d865aaa0029fccd368b67 /astro/oskar
parent297fb2fd4678d39f20684013108b4545ea84a1ea (diff)
downloadatoolbox-9621d66105248b3f460b54e64f2b98e60b1fa839.tar.bz2
astro/wsclean.py: allow use 'WSCLEAN_BIN' to specify path to the binary
Diffstat (limited to 'astro/oskar')
-rwxr-xr-xastro/oskar/wsclean.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/astro/oskar/wsclean.py b/astro/oskar/wsclean.py
index 9924d3b..05953fa 100755
--- a/astro/oskar/wsclean.py
+++ b/astro/oskar/wsclean.py
@@ -19,6 +19,10 @@ import time
import tempfile
+WSCLEAN_BIN = os.environ.get("WSCLEAN_BIN", "wsclean")
+print("WSClean binary: %s" % WSCLEAN_BIN)
+
+
def printlog(msg, logfile=None, **kwargs):
if logfile:
files = [sys.stdout, logfile]
@@ -42,7 +46,7 @@ def wsclean(args, dryrun=False, logfile=None):
"""
tmpdir = tempfile.TemporaryDirectory()
cmd = [
- "wsclean", "-temp-dir", tmpdir.name,
+ WSCLEAN_BIN, "-temp-dir", tmpdir.name,
] + [str(arg) for arg in args] # NOTE: Convert all arguments to strings
printlog("CWD: %s" % os.getcwd())
printlog("CMD: %s" % " ".join(cmd), logfile=logfile)
@@ -72,7 +76,9 @@ def wsclean(args, dryrun=False, logfile=None):
def main():
parser = argparse.ArgumentParser(
- description="Run WSClean with more handy arguments")
+ description="Run WSClean with more handy arguments",
+ epilog="NOTE: use env variable 'WSCLEAN_BIN' to specify the path " +
+ "to the WSClean binary")
parser.add_argument("-a", "--args", dest="args",
help="additional arguments for WSClean, " +
"in a quoted string separated by space, e.g.," +