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 ...@@ -2,7 +2,7 @@ from __future__ import print_function
import socket import socket
import logging import logging
from astropy.coordinates import SkyCoord, AltAz from astropy.coordinates import SkyCoord, AltAz, RangeError
from astropy import units as u from astropy import units as u
from configparser import ConfigParser from configparser import ConfigParser
import os.path import os.path
...@@ -23,7 +23,7 @@ class telescope(): ...@@ -23,7 +23,7 @@ class telescope():
'J2000' or 'AZEL'. 'J2000' or 'AZEL'.
''' '''
if setmode not in ('J2000', 'AZEL', None): 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 self.setmode = setmode
if consoleHost is None: if consoleHost is None:
...@@ -101,7 +101,11 @@ class telescope(): ...@@ -101,7 +101,11 @@ class telescope():
(ra, dec) = (vals[2], vals[3]) (ra, dec) = (vals[2], vals[3])
self.radec = SkyCoord(ra, dec, frame='icrs') self.radec = SkyCoord(ra, dec, frame='icrs')
(setpoint_ra, setpoint_dec) = (vals[0], vals[1]) (setpoint_ra, setpoint_dec) = (vals[0], vals[1])
self.setpoint_radec = SkyCoord(setpoint_ra, setpoint_dec, frame='icrs') 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() self._event_j2000.set()
def _readtraces(self, tracehost, traceport): 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