Skip to content
Snippets Groups Projects
Commit 359ec6a6 authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

Add script to point array by RA and DEC

(oostrum)
parent 4fa90d32
Branches
Tags test
No related merge requests found
#! /usr/bin/env python
#
# Boudewijn Hut, hut@astron.nl
# Edited to accept RA, DEC by Leon Oostrum, oostrum@astron.nl
'''
This script orchestrates APERTIFs full field of view experiment
'''
import sys
import socket
sys.path.insert(0, '/opt/apertif/lib/python2.7/site-packages/')
from apertif.drivers.dcu.DCUBoards import DCUBoards
from apertif.drivers.log.LOGBoards import LOGBoards
#import apertif.drivers.noisesrc.NoiseSource
from apertif.drivers.uniboard.UniBoards import UniBoards
from lofar.parameterset import parameterset;
import numpy
import time
import pickle
import os
from apertif.common.converters import convert_2_int_list
import matplotlib.pyplot as plt
import numpy as np
import TechnicalCommissioning as tcx
import itertools
import struct
import scipy.io as spio
import pickle
DO_STOW = False
DO_POINT = True
def get_ra_dec(ra, dec):
ra = ra.split(':')
ra = (float(ra[0]) + float(ra[1])/60 + float(ra[2])/3600) * 15
dec = dec.split(':')
dec = float(dec[0]) + float(dec[1])/60 + float(dec[2])/3600
def main():
# Assign source based on passed argument
try:
src_ra, src_dec = sys.argv[1:3]
except ValueError:
print 'Both RA and DEC should be supplied'
sys.exit()
if (not src_ra[:1].isdigit()) or (not src_dec[:1].isdigit()):
print 'Could not parse RA and/or DEC:', src_ra, src_dec
sys.exit()
# Assign user passed dishes
telescopes = None # implicit whole array
tel = 'rta'
if len(sys.argv)==4:
s = sys.argv[3]
telescopes = [i for i in s.split(',')]
tel = telescopes[0]
print 'RA, DEC:', src_ra, src_dec
# check running on correct machine
tcx.check_host()
exit_status = 0
try:
if DO_STOW:
tcx.stowarray('park')
if DO_POINT:
tcx.output('Selected RA, DEC: %s %s' % src_ra, src_dec)
src_ra, src_dec = get_ra_dec(src_ra, src_dec)
tcx.output('Determined source coordinates: (RA, dec) = (%d, %d) degree' % (src_RA, src_dec))
tcx.output('Pointing telescopes RT2-RTD to %s: (RA, dec) = (%d, %d) degree' % (source, src_RA, src_dec))
tcx.pointarray(src_RA, src_dec, telescopes)
tcx.output('Checking %s to be on position' % tel.upper())
# check on-pos for a single telescope
tcx.wait_till_array_on_pointing([tel])
tcx.output('%s is on position now' % tel.upper())
except Exception, ex:
print sys.argv[0] + ' Exception: ' + str(ex)
raise
exit_status = 1
finally:
print sys.argv[0] + ' Finished'
return exit_status
if __name__ == '__main__':
#from sys import exit
exit(main())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment