Commit 440f64c3 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Handle invalid setpoints, fix typo in exception

parent 5b77f664
......@@ -2,7 +2,7 @@ from __future__ import print_function
import socket
import logging
from astropy.coordinates import SkyCoord, AltAz
from astropy.coordinates import SkyCoord, AltAz, RangeError
from astropy import units as u
from configparser import ConfigParser
import os.path
......@@ -23,7 +23,7 @@ class telescope():
'J2000' or 'AZEL'.
'''
if setmode not in ('J2000', 'AZEL', None):
raise ValueError("Mode must be None, 'J2000' or 'AZEL', not " + mode)
raise ValueError("Mode must be None, 'J2000' or 'AZEL', not " + setmode)
self.setmode = setmode
if consoleHost is None:
......@@ -101,7 +101,11 @@ class telescope():
(ra, dec) = (vals[2], vals[3])
self.radec = SkyCoord(ra, dec, frame='icrs')
(setpoint_ra, setpoint_dec) = (vals[0], vals[1])
try:
# The setpoint can be invalid
self.setpoint_radec = SkyCoord(setpoint_ra, setpoint_dec, frame='icrs')
except RangeError:
self.setpoint_radec = None
self._event_j2000.set()
def _readtraces(self, tracehost, traceport):
......
Supports Markdown
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