From 9621d66105248b3f460b54e64f2b98e60b1fa839 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 6 Feb 2018 16:46:52 +0800 Subject: astro/wsclean.py: allow use 'WSCLEAN_BIN' to specify path to the binary --- astro/oskar/wsclean.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'astro/oskar') 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.," + -- cgit v1.2.2