Skip to content

Commit

Permalink
Add extra debugging.
Browse files Browse the repository at this point in the history
Make `loop://` device work better so can do better testing on specific mount implementations (instead of the simulator).
  • Loading branch information
wtgee committed Nov 11, 2023
1 parent 7597771 commit a026acb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/panoptes/pocs/mount/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ def create_mount_from_config(mount_info=None,
port = mount_info['serial']['port']
logger.info(f'Looking for {driver} on {port}.')
if port is None or len(glob(port)) == 0:
raise error.MountNotFound(msg=f'Mount {port=} not available.')
if port == 'loop://':
logger.warning('Using loop:// for mount connection.')
else:
raise error.MountNotFound(msg=f'Mount {port=} not available.')
except KeyError:
# See Issue 866
if model == 'bisque':
Expand Down
9 changes: 6 additions & 3 deletions src/panoptes/pocs/mount/ioptron/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ def _mount_coord_to_skycoord(self, mount_coords):
astropy.SkyCoord: Mount coordinates as astropy SkyCoord with
EarthLocation included.
"""
self.logger.debug(f'Mount coordinates: {mount_coords}')
coords_match = self._coords_format.fullmatch(mount_coords)

coords = None

self.logger.trace(f'Mount coordinates: {coords_match}')
self.logger.debug(f'Mount coordinates match: {coords_match}')

if coords_match is not None:
if self._ra_coords_units == 'millisecond':
self.logger.debug(f'Converting RA from {self._ra_coords_units} to degrees')
ra = (int(coords_match.group('ra')) * getattr(u, self._ra_coords_units)).to(u.hour).value
ra = (ra * u.hourangle).to(u.degree)
else:
Expand All @@ -255,17 +255,20 @@ def _mount_coord_to_skycoord(self, mount_coords):
if dec_sign == '-':
dec = dec * -1

self.logger.debug(f'Creating SkyCoord for {ra=} {dec=}')
coords = SkyCoord(ra=ra, dec=dec, frame='icrs', unit=(u.deg, u.deg))
else:
self.logger.warning('Cannot create SkyCoord from mount coordinates')

self.logger.debug(f'Created SkyCoord: {coords=}')
return coords

def _skycoord_to_mount_coord(self, coords):
""" Converts between SkyCoord and a iOptron RA/Dec format. """

# Do some special handling of older firmware that had RA coords in a time unit.
if self._ra_coords_units == 'millisecond':
self.logger.debug(f'Converting RA from degrees to {self._ra_coords_units}')
ra_coord = (coords.ra.to(u.hourangle).value * u.hour).to(self._ra_coords_units).value
else:
ra_coord = coords.ra.to(self._ra_coords_units).value
Expand Down

0 comments on commit a026acb

Please sign in to comment.