Commit 956a5088 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema

Read az/el and ra/dec from telescope

parent db1d5bb6
......@@ -13,6 +13,14 @@ import re
import argparse
telescope_found = False
try:
from telescope import telescope
dt = telescope(consoleHost='console')
telescope_found = True
except:
print("Could not connect to console, no RA/DEC recorded")
def create_filterbank(infile=None, outfile=None, date=None, source=None):
"""
Create a filterbank file from the CAMRAS-format, which is generated
......@@ -48,6 +56,16 @@ def create_filterbank(infile=None, outfile=None, date=None, source=None):
else:
date = Time(date, format='isot')
az_start = 0.
za_start = 0.
src_raj = 0.
src_dej = 0.
if telescope_found:
az_start = (180*u.deg + dt.getAzEl()[0]).to(u.rad).value
za_start = (90*u.deg - dt.getAzEl()[1]).to(u.rad).value
src_raj = dt.getRaDec().ra.to_string(unit=u.hour, sep='')
src_dej = dt.getRaDec().dec.to_string(unit=u.degree, sep='')
print("Input file: {}".format(infile))
print("Output file: {}".format(outfile))
print("Source name: {}".format(source))
......@@ -69,10 +87,10 @@ def create_filterbank(infile=None, outfile=None, date=None, source=None):
fil_header["source_name"] = source
fil_header["barycentric"] = 0
fil_header["pulsarcentric"] = 0
fil_header["az_start"] = 0.0
fil_header["za_start"] = 0.0
fil_header["src_raj"] = 0.0
fil_header["src_dej"] = 0.0
fil_header["az_start"] = az_start
fil_header["za_start"] = za_start
fil_header["src_raj"] = src_raj
fil_header["src_dej"] = src_dej
fil_header["tstart"] = date
fil_header["tsamp"] = 0.00046811428571414528 # 1.0/35e6*256 chans*64 decimation
fil_header["nbits"] = 16
......
Markdown is supported
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