panoptes.pocs.mount package

Subpackages

Submodules

panoptes.pocs.mount.bisque module

class panoptes.pocs.mount.bisque.Mount(*args, **kwargs)[source]

Bases: AbstractMount

property at_mount_park

Mount slewing status.

Type:

bool

connect()[source]

Connects to the mount via the serial port (self._port)

Returns:

Returns the self.is_connected property which checks

the actual serial connection.

Return type:

bool

disconnect()[source]
initialize(unpark=False, *args, **kwargs)[source]

Initialize the connection with the mount and setup for location.

If the mount is successfully initialized, the _setup_location_for_mount method is also called.

Returns:

Returns the value from self.is_initialized.

Return type:

bool

property is_home

Mount home status.

Type:

bool

property is_parked

Mount parked status.

Type:

bool

property is_slewing

Mount slewing status.

Type:

bool

property is_tracking

Mount tracking status.

Type:

bool

move_direction(direction='north', seconds=1.0, arcmin=None, rate=None)[source]

Move mount in specified direction for given amount of seconds

park(timeout=120)[source]

Slews to the park position and parks the mount.

Note

When mount is parked no movement commands will be accepted.

Returns:

indicating success

Return type:

bool

query(*args, **kwargs)[source]

Override the query method to use the command lock.

This is required because TheSkyX cannot handle simulataneous commands. This function will block until the lock is released.

read(timeout=5)[source]
set_park_position()[source]
set_target_coordinates(coords)[source]

Sets the RA and Dec for the mount’s current target.

Parameters:

coords (astropy.coordinates.SkyCoord) – coordinates specifying target location

Returns:

Boolean indicating success

Return type:

bool

slew_to_home(blocking=False, timeout=120)[source]

Slews the mount to the home position.

Note

Home position and Park position are not the same thing

Parameters:
  • blocking (bool, optional) – If command should block while slewing to home, default False.

  • timeout (int, optional) – Timeout in seconds, default 120.

Returns:

indicating success

Return type:

bool

slew_to_target(timeout=120, **kwargs)[source]

Slews to the current _target_coordinates

Returns:

indicating success

Return type:

bool

slew_to_zero(blocking=False)[source]

Calls slew_to_home in base class. Can be overridden.

unpark()[source]

Unparks the mount. Does not do any movement commands but makes them available again.

Returns:

indicating success

Return type:

bool

write(value)[source]

panoptes.pocs.mount.mount module

class panoptes.pocs.mount.mount.AbstractMount(location, commands=None, *args, **kwargs)[source]

Bases: PanBase

Abstract Base class for controlling a mount. This provides the basic functionality for the mounts. Sub-classes should override the initialize method for mount-specific issues as well as any helper methods specific mounts might need. See “NotImplemented Methods” section of this module.

Sets the following properties:

  • self.non_sidereal_available = False

  • self.PEC_available = False

  • self._is_initialized = False

Parameters:
  • config (dict) – Custom configuration passed to base mount. This is usually read from the main system config.

  • commands (dict) – Commands for the telescope. These are read from a yaml file that maps the mount-specific commands to common commands.

  • location (EarthLocation) – An astropy.coordinates.EarthLocation that contains location information.

property at_mount_park

True if mount is at park position.

Type:

bool

abstract connect()[source]

Connect to the mount.

correct_tracking(correction_info, axis_timeout=30.0)[source]

Make tracking adjustment corrections.

Parameters:
  • correction_info (dict[tuple]) – Correction info to be applied, see get_tracking_correction.

  • axis_timeout (float, optional) – Timeout for adjustment in each axis, default 30 seconds.

Raises:

error.Timeout – Timeout error.

disconnect()[source]
distance_from_target()[source]

Get current distance from target

Returns:

An angle represeting the current on-sky separation from the target

Return type:

u.Angle

get_current_coordinates()[source]

Reads out the current coordinates from the mount.

Note

See _mount_coord_to_skycoord and _skycoord_to_mount_coord for translation of mount specific coordinates to astropy.coordinates.SkyCoord

Returns:

astropy.coordinates.SkyCoord

get_ms_offset(offset, axis='ra')[source]

Get offset in milliseconds at current speed

Parameters:
  • offset (astropy.units.Angle) – Offset in arcseconds

  • axis (str) – The name of the axis to move, default ‘ra’.

Returns:

Offset in milliseconds at current speed

Return type:

astropy.units.Quantity

get_target_coordinates()[source]

Gets the RA and Dec for the mount’s current target. This does NOT necessarily reflect the current position of the mount, see get_current_coordinates.

Return type:

astropy.coordinates.SkyCoord

get_tracking_correction(offset_info, pointing_ha, min_tracking_threshold=None, max_tracking_threshold=None)[source]

Determine the needed tracking corrections from current position.

This method will determine the direction and number of milliseconds to correct the mount for each axis in order to correct for any tracking drift. The Declination axis correction (‘north’ or ‘south’) depends on the movement of the camera box with respect to the pier, which can be determined from the Hour Angle (HA) of the pointing image in the sequence.

Note

Correction values below 50ms will be skipped and values above 99999ms will be clipped.

Parameters:
  • offset_info (OffsetError) – A named tuple describing the offset error. See pocs.images.OffsetError.

  • pointing_ha (float) – The Hour Angle (HA) of the mount at the beginning of the observation sequence in degrees. This affects the direction of the Dec adjustment.

  • min_tracking_threshold (int, optional) – Minimum size of tracking correction allowed in milliseconds. Tracking corrections lower than this are ignored. Default 100ms from self.min_tracking_threshold.

  • max_tracking_threshold (int, optional) – Maximum size of tracking correction allowed in milliseconds. Tracking corrections higher than this are set to this value. Default 99999ms from self.max_tracking_threshold.

Returns:

Offset corrections for each axis as needed

dict: {
    # axis: (arcsec, millisecond, direction)
    'ra': (float, float, str),
    'dec': (float, float, str),
}

Return type:

dict

property has_target
home_and_park(*args, **kwargs)[source]

Convenience method to first slew to the home position and then park.

abstract initialize(*arg, **kwargs)[source]
property is_connected

Checks the serial connection on the mount to determine if connection is open

Type:

bool

property is_home

Mount home status.

Type:

bool

property is_initialized

Has mount been initialised with connection

Type:

bool

property is_parked

Mount parked status.

Type:

bool

property is_slewing

Mount slewing status.

Type:

bool

property is_tracking

Mount tracking status.

Type:

bool

property location

The location details for the mount.

When a new location is set,`_setup_location_for_mount` is called, which will update the mount with the current location. It is anticipated the mount won’t change locations while observing so this should only be done upon mount initialization.

Type:

astropy.coordinates.SkyCoord

move_direction(direction='north', seconds=1.0)[source]

Move mount in specified direction for given amount of seconds

property movement_speed

Movement speed when button pressed.

Type:

bool

park(*args, **kwargs)[source]

Slews to the park position and parks the mount.

The park position must be set manually first for this method to work.

Most mount subclasses will override this method to provide mount-specific park functionality.

Note

When mount is parked no movement commands will be accepted.

Returns:

indicating success

Return type:

bool

query(cmd, params=None, **kwargs)[source]

Sends a query to the mount and returns response.

Performs a send and then returns response. Will do a translate on cmd first. This should be the major serial utility for commands. Accepts an additional args that is passed along with the command. Checks for and only accepts one args param.

Parameters:
  • cmd (str) – A command to send to the mount. This should be one of the commands listed in the mount commands yaml file.

  • params (str, optional) – Params to pass to serial connection

Examples

>>> from panoptes.pocs.mount import create_mount_from_config
>>> mount = create_mount_from_config()       
>>> mount.query('set_local_time', '101503')  
'1'
>>> mount.query('get_local_time')            
'101503'
Returns:

The response from the mount.

Return type:

str

Deleted Parameters:

*args: Parameters to be sent with command if required.

abstract read(*args, **kwargs)[source]
search_for_home()[source]

Search for the home position if supported.

set_target_coordinates(coords)[source]

Sets the RA and Dec for the mount’s current target.

Parameters:

coords (astropy.coordinates.SkyCoord) – coordinates specifying target location

Returns:

Boolean indicating success

Return type:

bool

abstract set_tracking_rate(direction='ra', delta=1.0)[source]

Sets the tracking rate for the mount

slew_to_coordinates(coords, *args, **kwargs)[source]

Slews to given coordinates.

Parameters:

coords (astropy.SkyCoord) – The coordinates to slew to.

Returns:

indicating success

Return type:

bool

slew_to_home(blocking=True, timeout=180)[source]

Slews the mount to the home position.

Note

Home position and Park position are not the same thing

Parameters:
  • blocking (bool, optional) – If command should block while slewing to home, default True.

  • timeout (int, optional) – Maximum time spent slewing to home, default 180 seconds.

Returns:

indicating success

Return type:

bool

slew_to_target(blocking=False, timeout=180)[source]

Slews to the currently assigned target coordinates.

Slews the mount to the coordinates that have been assigned by ~set_target_coordinates. If no coordinates have been set, do nothing and return False, otherwise return response from the mount.

If blocking=True then wait for up to timeout seconds for the mount to reach the is_tracking state. If a timeout occurs, raise a pocs.error.Timeout exception.

Parameters:
  • blocking (bool, optional) – If command should block while slewing to home, default False.

  • timeout (int, optional) – Maximum time spent slewing to home, default 180 seconds.

Returns:

indicating success

Return type:

bool

slew_to_zero(blocking=False)[source]

Calls slew_to_home in base class. Can be overridden.

property state

Mount state.

Type:

bool

property status
property tracking_rate

Mount tracking rate

Type:

bool

unpark()[source]

Unparks the mount. Does not do any movement commands but makes them available again.

Returns:

indicating success

Return type:

bool

update_status()[source]

Thin-wrapper to call the status property.

abstract write(cmd)[source]

panoptes.pocs.mount.serial module

class panoptes.pocs.mount.serial.AbstractSerialMount(location, *args, **kwargs)[source]

Bases: AbstractMount, ABC

connect()[source]

Connects to the mount via the serial port (self._port)

Returns:

Returns the self.is_connected property (bool) which checks the actual serial connection.

disconnect()[source]
read(*args)[source]

Reads from the serial connection.

Returns:

Response from mount

Return type:

str

set_tracking_rate(direction='ra', delta=0.0)[source]

Set the tracking rate for the mount :param direction: Either ra or dec :type direction: str, optional :param delta: Offset multiple of sidereal rate, defaults to 0.0 :type delta: float, optional

write(cmd)[source]

Sends a string command to the mount via the serial port.

First ‘translates’ the message into the form specific mount can understand using the mount configuration yaml file. This method is most often used from within query and may become a private method in the future.

Note

This command currently does not support the passing of parameters. See query instead.

Parameters:

cmd (str) – A command to send to the mount. This should be one of the commands listed in the mount commands yaml file.

panoptes.pocs.mount.simulator module

class panoptes.pocs.mount.simulator.Mount(location, *args, **kwargs)[source]

Bases: AbstractMount

Mount class for a simulator. Use this when you don’t actually have a mount attached.

connect()[source]

Connect to the mount.

disconnect()[source]
get_current_coordinates()[source]

Reads out the current coordinates from the mount.

Note

See _mount_coord_to_skycoord and _skycoord_to_mount_coord for translation of mount specific coordinates to astropy.coordinates.SkyCoord

Returns:

astropy.coordinates.SkyCoord

get_ms_offset(offset, axis='ra')[source]

Fake offset in milliseconds

Parameters:

offset (astropy.units.Angle) – Offset in arcseconds

Returns:

Offset in milliseconds at current speed

Return type:

astropy.units.Quantity

initialize(unpark=False, *arg, **kwargs)[source]

Initialize the connection with the mount and setup for location.

iOptron mounts are initialized by sending the following two commands to the mount:e

  • Version

  • MountInfo

If the mount is successfully initialized, the _setup_location_for_mount method is also called.

Returns:

Returns the value from self._is_initialized.

Return type:

bool

move_direction(direction='north', seconds=1.0)[source]

Move mount in specified direction for given amount of seconds

park()[source]

Sets the mount to park for simulator

query(cmd, params=None, **kwargs)[source]

Sends a query to the mount and returns response.

Performs a send and then returns response. Will do a translate on cmd first. This should be the major serial utility for commands. Accepts an additional args that is passed along with the command. Checks for and only accepts one args param.

Parameters:
  • cmd (str) – A command to send to the mount. This should be one of the commands listed in the mount commands yaml file.

  • params (str, optional) – Params to pass to serial connection

Examples

>>> from panoptes.pocs.mount import create_mount_from_config
>>> mount = create_mount_from_config()       
>>> mount.query('set_local_time', '101503')  
'1'
>>> mount.query('get_local_time')            
'101503'
Returns:

The response from the mount.

Return type:

str

Deleted Parameters:

*args: Parameters to be sent with command if required.

read(*args)[source]
set_tracking_rate(direction='ra', delta=0.0)[source]

Sets the tracking rate for the mount

slew_to_home(blocking=False, timeout=1)[source]

Slews the mount to the home position.

Note

Home position and Park position are not the same thing

Returns:

indicating success

Return type:

bool

slew_to_target(slew_delay=0.5, *args, **kwargs)[source]

Slews to the currently assigned target coordinates.

Slews the mount to the coordinates that have been assigned by ~set_target_coordinates. If no coordinates have been set, do nothing and return False, otherwise return response from the mount.

If blocking=True then wait for up to timeout seconds for the mount to reach the is_tracking state. If a timeout occurs, raise a pocs.error.Timeout exception.

Parameters:
  • blocking (bool, optional) – If command should block while slewing to home, default False.

  • timeout (int, optional) – Maximum time spent slewing to home, default 180 seconds.

Returns:

indicating success

Return type:

bool

stop_slew(next_position='is_tracking')[source]
unpark()[source]

Unparks the mount. Does not do any movement commands but makes them available again.

Returns:

indicating success

Return type:

bool

write(cmd)[source]

Module contents

panoptes.pocs.mount.create_mount_from_config(mount_info=None, earth_location=None, *args, **kwargs) AbstractMount[source]

Create a mount instance based on the provided config.

Creates an instance of the AbstractMount sub-class in the module specified in the config. Specifically, the class must be in a file called pocs/mount/<DRIVER_NAME>.py, and the class must be called Mount.

Parameters:
  • mount_info – Optional param which overrides the ‘mount’ entry in config if provided. Useful for testing.

  • earth_locationastropy.coordinates.EarthLocation instance, representing the location of the mount on the Earth. If not specified, the config must include the observatory’s location (Latitude, Longitude and Altitude above mean sea level). Useful for testing.

  • *args – Other positional args will be passed to the concrete class specified in the config.

  • **kwargs – Other keyword args will be passed to the concrete class specified in the config.

Returns:

An instance of the Mount class if the config (or mount_info) is complete. None if neither mount_info nor config[‘mount’] is provided.

Raises:

error.MountNotFound – Exception raised when mount cannot be created because of incorrect configuration.

panoptes.pocs.mount.create_mount_simulator(mount_info=None, earth_location=None, db_type='memory', *args, **kwargs)[source]