Skip to content

Commit

Permalink
Added parminator export script
Browse files Browse the repository at this point in the history
  • Loading branch information
vsmagalhaes committed Nov 22, 2024
1 parent c26cf39 commit 889f1f7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
5 changes: 4 additions & 1 deletion etc/installation/astrohack-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion etc/locit/exec_locit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'


Expand Down
33 changes: 33 additions & 0 deletions etc/locit/export_to_parminator.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 889f1f7

Please sign in to comment.