#!/usr/local/bin/python2.7 # Wrapper for RFI reduction scripts # # Configure the REDRFIPATH environment variable to the location of this script # import os import shutil import argparse # Parse command line arguments parser = argparse.ArgumentParser(prog="redrfi", description="Reduces VLBA RFI data and creates a website with the results", epilog="") parser.add_argument("-c", "--config", help="copy default configredrfi.py to current directory", action="store_true") parser.add_argument("-d", "--docs", help="copy the documentation file to current directory", action="store_true") parser.add_argument("-s", "--scheds", help="copy sample schedules to current directory", action="store_true") args = parser.parse_args() # Make a default copy of configredrfi.py on the current directory if args.config: print 'Making a copy of configredrfi.py on the current directory' shutil.copy(os.path.join(os.environ['REDRFIPATH'], 'configredrfi.py'), './configredrfi.py') # Make a copy of the documenation on the current directory elif args.docs: print 'Making a copy of the documentation on the current directory' print 'The documentation is in rfi-plots-info.pdf' shutil.copy(os.path.join(os.environ['REDRFIPATH'], 'rfi-plots-info.pdf'), 'rfi-plots-info.pdf') # Make a copy of the sample schedules on the current directory elif args.scheds: print 'Making a copy of the sample schedules on the current directory' print 'The sample schedules are in sample-schedules/' shutil.copytree(os.path.join(os.environ['REDRFIPATH'], 'sample-schedules'), 'sample-schedules') # Run the scripts else: os.system('python $REDRFIPATH/create_dirs.py') os.system('python $REDRFIPATH/write_aips_script.py') os.system('python $REDRFIPATH/parse_listr_scans.py') os.system('python2.7 $REDRFIPATH/plot_total_power.py') os.system('python2.7 $REDRFIPATH/generate_webpages.py')