Commit bafe129c authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Add trackHI.py

parent 7caaa6e7
......@@ -9,6 +9,7 @@ meta = dict(name='hpib',
description='Controlling HPIB-software in the CAMRAS Dwingeloo Radio Telescope',
platforms='Linux, Mac OSX',
py_modules=['hpib', 'camrasdevices'],
scripts=['trackHI.py'],
install_requires=['pyserial']
)
......
#!/usr/bin/env python
import astropy.units as u
import numpy as np
import subprocess
from telescope import telescope
from camrasdevices import Receiver, LocalOscillator
import time
freq_HI = 1420.405751
def track_frequency(lo=LocalOscillator(), dt=telescope(),
tracking_frequency=freq_HI):
"""Sets the Local Oscillator to a frequency to correct for Doppler shift"""
dt_lat = np.deg2rad(52.812019)
dt_lon = np.deg2rad(6.396169)
dt_alt = 25.0
for pointing in dt.getJ2000():
ra = pointing['radec'].ra.to(u.rad).value
dec = pointing['radec'].dec.to(u.rad).value
t = time.time()
argstring = "{ra} {dec} 2000 {time} {dt_lat} {dt_lon} {dt_alt}".format(
ra=ra, dec=dec, time=t, dt_lat=dt_lat, dt_lon=dt_lon, dt_alt=dt_alt)
doppler_cmd = "/home/harm/bin/doppler_mb " + argstring + " " + str(tracking_frequency)
freq_doppler = float(subprocess.Popen(doppler_cmd, stdout=subprocess.PIPE, shell=True).stdout.read())
dfreq = 1000.0 + tracking_frequency - freq_doppler
lo.frequency = dfreq * 1e6
if __name__ == '__main__':
track_frequency()
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