Commit 92daa6bc authored by Tiffany Summerscales's avatar Tiffany Summerscales
Browse files

Can now pass a working directory as the first argument to megasky.py

git-svn-id: https://svn.ligo.caltech.edu/svn/bayeswave/tags/O2_online@736 c56465c9-8126-4a4f-9d7d-ac845eff4865
parent a8785832
......@@ -330,16 +330,25 @@ def make_skyview(directory='.', mdc=None, NSIDE=128, ra=None, dec=None, results=
# -- Write main script for command line running
if __name__ == "__main__":
# Example command line function calls
# megasky.py /path/to/working/dir --mdc=/path/to/mdc/mdclog.txt
# megasky.py --mdc=/path/to/mdc/mdclog.txt
# Allow navigation into specified working directory
topdir=os.getcwd()
try:
workdir=sys.argv[1]
except IndexError:
# No work directory specified, workdir=./
workdir=os.getcwd()
os.chdir(workdir)
opts, args = getopt.getopt(sys.argv[1:], "", ['directory=', 'mdc=', 'NSIDE=', 'ra=', 'dec=', 'geo'])
# Working directory is current directory unless it is specified by the
# first argument of the function call
workdir=os.getcwd()
inargs = sys.argv[1:]
if len(sys.argv) >= 2:
if os.path.isdir(sys.argv[1]):
workdir = sys.argv[1]
inargs = sys.argv[2:]
os.chdir(workdir)
opts, args = getopt.getopt(inargs, "", ['directory=', 'mdc=', 'NSIDE=', 'ra=', 'dec=', 'geo'])
# -- Set default argument values
directory='.'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment