diff --git a/etc/installation/astrohack-install.sh b/etc/installation/astrohack-install.sh index 4576eeb7..8c3c6993 100644 --- a/etc/installation/astrohack-install.sh +++ b/etc/installation/astrohack-install.sh @@ -71,9 +71,12 @@ if [ -z "${yesno}" ] || [ "${yesno}" = "y" ]; then echo 'get_locit_scripts () {' echo ' echo Downloading CASA pre locit script...' echo ' wget https://github.com/casangi/astrohack/raw/main/etc/locit/casa/pre-locit-script.py' - echo ' echo' echo ' echo Downloading astrohack locit script...' echo ' wget https://github.com/casangi/astrohack/raw/main/etc/locit/exec_locit.py' + echo ' echo' + echo ' echo Downloading astrohack export to parminator script...' + echo ' wget https://github.com/casangi/astrohack/raw/main/etc/locit/export_to_parminator.py' + echo ' echo' echo '}' } >> "${HOME}"/.profile diff --git a/etc/locit/exec_locit.py b/etc/locit/exec_locit.py index c89961f3..9d0527f4 100755 --- a/etc/locit/exec_locit.py +++ b/etc/locit/exec_locit.py @@ -3,7 +3,7 @@ import argparse desc = "Execute locit with a phase cal table produced by CASA\n\n" -desc += 'This script executes a subset of locits features, for a more detailed tutorial see:\n' +desc += "This script executes a subset of locit's features, for a more detailed tutorial see:\n" desc += 'https://astrohack.readthedocs.io/en/stable/locit_tutorial.html' diff --git a/etc/locit/export_to_parminator.py b/etc/locit/export_to_parminator.py new file mode 100644 index 00000000..df420c64 --- /dev/null +++ b/etc/locit/export_to_parminator.py @@ -0,0 +1,33 @@ +from astrohack import open_position +import argparse + +desc = "Export position corrections to parminator\n\n" +desc += "This script executes a subset of locit's features, for a more detailed tutorial see:\n" +desc += 'https://astrohack.readthedocs.io/en/stable/locit_tutorial.html' + + +parser = argparse.ArgumentParser(description=f'{desc}', formatter_class=argparse.RawTextHelpFormatter) + +parser.add_argument('position_file', type=str, help='position.zarr file produced by locit') +parser.add_argument('parminator_file', type=str, help='Name for the output parminator file') +parser.add_argument('-t', '--correction_threshold', type=float, default=0.01, + help='Threshold for including corrections in meters, default is 0.01') +parser.add_argument('-a', '--antennas', type=str, default='all', help='Comma separated list of antennas to ' + 'be processed, default is all antennas') +args = parser.parse_args() + + +def get_ant_list_from_input(user_ant_list): + if ',' in user_ant_list: + # break it up into a list + return user_ant_list.split(',') + else: + return user_ant_list + + +ant_list = get_ant_list_from_input(args.antennas) + +position_mds = open_position(args.position_file) +position_mds.export_results_to_parminator(args.parminator_file, + ant=ant_list, + correction_threshold=args.correction_threshold)