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

Refactor track_doppler, make dt and lo fixed arguments

parent b590b9cf
......@@ -45,8 +45,8 @@ class DummyLocalOscillator(object):
self._frequency = freq
print("Dummy LO set to 1GHz {:+.3f}".format((self._frequency-1*u.GHz).to(u.kHz)))
track_doppler.track_doppler(lo=DummyLocalOscillator(), dt=DummyTelescope())
#track_doppler.track_doppler(lo=DummyLocalOscillator(), dt=DummyTelescope(), doppler_function=doppler_frequency)
track_doppler.track_doppler(DummyTelescope(), DummyLocalOscillator())
#track_doppler.track_doppler(DummyTelescope(), DummyLocalOscillator(), doppler_function=doppler_frequency)
if __name__ == '__main__':
unittest.main()
......@@ -3,15 +3,18 @@
import astropy.units as u
import argparse
import track_doppler
from telescope import telescope
from camrasdevices import LocalOscillator
def main():
parser = argparse.ArgumentParser(description = "Adjust the frequency of the local oscillator to Doppler track a frequency at the pointing of the telescope")
parser.add_argument("-d", "--doppler-executable", help="Executable for computing the Doppler correction", default="/home/harm/bin/doppler_mb")
parser.add_argument("-f", "--frequency", help="Frequency to track, default is HI frequency at {}".format(track_hi.freq_hi), default=track_hi.freq_hi, type=float)
args = parser.parse_args()
track_doppler.track_frequency(tracking_frequency=args.frequency, doppler_executable=args.doppler_executable)
dt = telescope()
lo = LocalOscillator()
track_doppler.track_frequency(dt, lo, tracking_frequency=args.frequency)
if __name__ == '__main__':
main()
......@@ -38,7 +38,7 @@ def doppler_harm_bl(sky_coordinate, time, tracking_frequency, location):
def doppler_harm_mb(sky_coordinate, time, tracking_frequency, location):
return doppler_harm(sky_coordinate, time, tracking_frequency, location, 'mb')
def track_doppler(lo=None, dt=None,
def track_doppler(dt, lo,
tracking_frequency=freq_hi,
doppler_function=doppler_harm_bl,
exit_event=None,
......@@ -47,19 +47,13 @@ def track_doppler(lo=None, dt=None,
set, return the LO frequency to 1GHz.
Args:
lo (LocalOscillator): the local oscillator of which the frequency will be set.
Defaults to None, in this case one will be created
dt (Telescope): a Telescope instance to read the current pointing from.
Defaults to None, in this case one will be created
lo (LocalOscillator): the local oscillator of which the frequency will be set.
doppler_function (function): a function that computes the doppler frequency.
This function gets a SkyCoord and a time (float), and should return a frequency Quantity
timeout (float): timeout between updates of the Local Oscillator
"""
if not lo:
lo = LocalOscillator();
if not dt:
dt = telescope();
if not exit_event:
exit_event = threading.Event()
dt_lat = 52.812019 * u.deg
......
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