panoptes.pocs.mount package¶
Subpackages¶
- panoptes.pocs.mount.ioptron package
- Submodules
- panoptes.pocs.mount.ioptron.base module
- panoptes.pocs.mount.ioptron.cem40 module
- panoptes.pocs.mount.ioptron.hae16 module
- panoptes.pocs.mount.ioptron.ieq30pro module
- Module contents
MountGPSMountHemisphereMountInfoMountInfo.CEM120MountInfo.CEM120ECMountInfo.CEM120EC2MountInfo.CEM25MountInfo.CEM26MountInfo.CEM26ECMountInfo.CEM40MountInfo.CEM40ECMountInfo.CEM60MountInfo.CEM60ECMountInfo.CEM70MountInfo.CEM70ECMountInfo.GEM28MountInfo.GEM28ECMountInfo.GEM45MountInfo.GEM45ECMountInfo.HAE16MountInfo.iEQ30ProMountInfo.iEQ45ProMountInfo.iEQ45ProAA
MountMovementSpeedMountStateMountTimeSourceMountTrackingState
Submodules¶
panoptes.pocs.mount.bisque module¶
Bisque/TheSkyX-based mount driver.
Implements a mount driver that communicates with Software Bisque’s TheSkyX via its TCP scripting interface, using small JavaScript templates for commands.
- class panoptes.pocs.mount.bisque.Mount(*args, **kwargs)[source]¶
Bases:
AbstractMountMount driver that proxies motions and queries to TheSkyX.
Uses small JavaScript template files to issue commands over TheSkyX’s TCP interface and parses JSON-like responses to update status and execute slews.
- 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:
- disconnect()[source]¶
Disconnect from TheSkyX and mark connection closed.
- Returns:
True if now disconnected.
- Return type:
- 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:
- 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:
- 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.
- 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:
- 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
- slew_to_target(timeout=120, **kwargs)[source]¶
Slews to the current _target_coordinates
- Returns:
indicating success
- Return type:
panoptes.pocs.mount.mount module¶
Abstract base class and helpers for telescope mounts.
Provides AbstractMount, a hardware-agnostic base with common properties (status, tracking, parking, slewing) and orchestration helpers (target handling, coordinate conversion, command table mapping). Concrete mount implementations (iOptron, Bisque, simulator, etc.) subclass this and implement device-specific read/write/query and motion control.
- class panoptes.pocs.mount.mount.AbstractMount(location, commands=None, *args, **kwargs)[source]¶
Bases:
PanBaseAbstract 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.
- disconnect()[source]¶
Disconnect from the mount, parking if necessary.
If the mount is not currently parked this will issue a park command before closing the connection, then mark the connection as closed.
- 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. Example:
- {
# axis: (arcsec, millisecond, direction) ‘ra’: (float, float, str), ‘dec’: (float, float, str),
}
- Return type:
- property has_target¶
Whether a target coordinate has been set for the mount.
- Returns:
True if set_target_coordinates has been called successfully.
- Return type:
- home_and_park(*args, **kwargs)[source]¶
Convenience method to first slew to the home position and then park.
- abstractmethod initialize(*arg, **kwargs)[source]¶
Initialize the mount hardware and prepare for use.
Subclasses should perform device-specific setup such as establishing communications, homing, and applying any required configuration so the mount is ready to slew and track.
- property is_connected¶
Checks the serial connection on the mount to determine if connection is open
- Type:
- 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 the mount in a specified direction for a duration.
- Parameters:
- Raises:
AssertionError – If the provided direction is not valid.
Exception – Propagates any low-level I/O exceptions encountered while issuing movement commands to the mount; movement is stopped in the finally block regardless.
- 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:
- query(cmd, params=None, **kwargs)[source]¶
Send a command to the mount and return the response.
The command key is translated to a mount-specific serial command (using the loaded commands YAML), written to the connection, and the response is read back.
- Parameters:
- Returns:
The raw response from the mount.
- Return type:
- Raises:
AssertionError – If the mount has not been initialized.
error.InvalidMountCommand – If the command key is not known.
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'
- abstractmethod read(*args, **kwargs)[source]¶
Low-level read from the mount connection.
- Parameters:
*args – Transport-specific positional options (e.g., size).
**kwargs – Transport-specific keyword options (e.g., timeout).
- Returns:
Raw response string from the device.
- Return type:
- 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:
- abstractmethod 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:
- 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
- slew_to_target(blocking: bool = False, timeout: int | float = 180) bool[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.
- property status¶
Return a snapshot of current mount parameters and positions.
- Returns:
- Mapping of basic rates, movement speed, current coordinates
(if available), and target coordinates (if set), augmented by subclass-specific fields from _update_status().
- Return type:
panoptes.pocs.mount.serial module¶
Serial-backed mount base class and helpers.
Provides AbstractSerialMount, which opens a configured RS-232 connection and implements common read/write/query helpers reused by concrete serial mounts.
- class panoptes.pocs.mount.serial.AbstractSerialMount(location, *args, **kwargs)[source]¶
Bases:
AbstractMount,ABCAbstract base for mounts controlled via a serial connection.
Handles creating the SerialData connection from configuration and provides default implementations for common connect/read/write helpers.
- 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]¶
Disconnect from the serial-connected mount controller.
Closes the underlying serial connection (if open) and updates the connection flag accordingly.
- 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¶
Simple in-memory mount simulator for development and tests.
Implements the AbstractMount interface with timed state changes and canned responses so higher-level logic can be exercised without hardware.
- class panoptes.pocs.mount.simulator.Mount(location, *args, **kwargs)[source]¶
Bases:
AbstractMountMount class for a simulator. Use this when you don’t actually have a mount attached.
- 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:
- move_direction(direction='north', seconds=1.0)[source]¶
Move mount in specified direction for given amount of seconds
- 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:
- slew_to_target(slew_delay=0.5, *args, **kwargs)[source]¶
Simulate slewing to the current target, then begin tracking.
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_location – astropy.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]¶
Create and return a simulator-backed Mount instance.
Updates the config to point the ‘mount’ section at the simulator driver and constructs a Mount object from panoptes.pocs.mount.simulator using the provided EarthLocation (or one derived from configuration).
- Parameters:
mount_info (dict | None) – Optional dict to write to the ‘mount’ config. If None, uses a default simulator config pointing at panoptes.pocs.mount.simulator.
earth_location (astropy.coordinates.EarthLocation | None) – Site location to pass to the Mount constructor. If None, it is created from configuration via create_location_from_config().
db_type (str) – Database backend type for the PanBase used by the Mount (default ‘memory’).
*args – Additional positional args forwarded to the simulator Mount constructor.
**kwargs – Additional keyword args forwarded to the simulator Mount constructor.
- Returns:
A newly constructed simulator Mount instance.
- Return type: