panoptes.pocs.dome package

Submodules

panoptes.pocs.dome.abstract_serial_dome module

Abstract serial-backed dome base class.

Provides AbstractSerialDome, which wires up a serial connection based on configuration and implements common connect/disconnect helpers reused by concrete serial dome drivers.

class panoptes.pocs.dome.abstract_serial_dome.AbstractSerialDome(*args, **kwargs)[source]

Bases: AbstractDome

Abstract base class for controlling a dome via a serial connection.

Takes care of a single thing: configuring the connection to the device.

connect()[source]

Connects to the device via the serial port, if disconnected.

Returns:

Returns True if connected, False otherwise.

Return type:

bool

disconnect()[source]

Disconnect from the serial-connected dome controller.

Returns:

None

property is_connected

True if connected to the hardware or driver.

verify_connected()[source]

Throw an exception if not connected.

panoptes.pocs.dome.astrohaven module

Astrohaven clamshell dome driver using a simple RS-232 protocol.

Implements control for Astrohaven domes driven by a Vision 130 PLC. Provides open/close helpers and simple status polling based on one-character protocol codes emitted by the controller.

class panoptes.pocs.dome.astrohaven.AstrohavenDome(*args, **kwargs)[source]

Bases: AbstractSerialDome

Interface to an Astrohaven clamshell dome with a Vision 130 PLC and RS-232 interface.

Experience shows that it emits a status byte about once a second, with the codes as described in the Protocol class.

LISTEN_TIMEOUT = 3
MOVE_LISTEN_TIMEOUT = 0.1
MOVE_TIMEOUT = 10
NUM_CLOSE_FEEDBACKS = 2
close()[source]

Close both clamshell shutters to their fully closed positions.

Returns:

True if the stable state after motion reports BOTH_CLOSED.

Return type:

bool

property is_closed

Whether both clamshell shutters are reported fully closed.

property is_open

Whether both clamshell shutters are reported open by the controller.

open()[source]

Open both clamshell shutters to their limits.

Returns:

True if the stable state after motion reports BOTH_OPEN.

Return type:

bool

property status

Return a dict with dome’s current status.

panoptes.pocs.dome.astrohaven.Dome

alias of AstrohavenDome

class panoptes.pocs.dome.astrohaven.Protocol[source]

Bases: object

ASCII protocol constants emitted/accepted by the Astrohaven PLC.

Encodes status bytes for slit positions and single-character commands used to open/close each shutter and query limits.

A_CLOSE_LIMIT = 'X'
A_IS_CLOSED = '1'
A_OPEN_LIMIT = 'x'
BOTH_CLOSED = '0'
BOTH_OPEN = '3'
B_CLOSE_LIMIT = 'Y'
B_IS_CLOSED = '2'
B_OPEN_LIMIT = 'y'
CLOSE_A = 'A'
CLOSE_B = 'B'
CLOSE_BOTH = 'C'
OPEN_A = 'a'
OPEN_B = 'b'
OPEN_BOTH = 'O'
RESET = 'R'
STABLE_STATES = ('0', '3', '2', '1')

panoptes.pocs.dome.bisque module

Bisque dome controller using TheSkyX scripting interface.

Provides a Dome implementation that communicates with TheSkyX over TCP using script templates to perform operations such as connect, open/close slit, park, unpark, and query status/position.

class panoptes.pocs.dome.bisque.Dome(*args, **kwargs)[source]

Bases: AbstractDome

Dome controller backed by TheSkyX.

Uses TheSkyX’s TCP scripting interface with small JavaScript templates to perform actions and read status.

close()[source]

Command the dome to close the slit and wait until it reports closed.

Returns:

True if the slit ends up closed.

Return type:

bool

connect()[source]

Connect to the dome controller via TheSkyX.

Returns:

True if the connection succeeds.

Return type:

bool

disconnect()[source]

Disconnect from TheSkyX, closing the slit first if necessary.

Returns:

True if now disconnected.

Return type:

bool

find_home()[source]

Command TheSkyX to find the dome’s home position.

Returns:

True if TheSkyX reports success and the dome is now parked at home; otherwise returns the last known parked state.

Return type:

bool

property is_closed

Whether the dome slit is closed.

Returns:

True if slit state reads as ‘Closed’.

Return type:

bool

property is_connected

Whether the TheSkyX dome driver reports connected.

Returns:

True if connected to TheSkyX.

Return type:

bool

property is_open

Whether the dome slit is open.

Returns:

True if slit state reads as ‘Open’.

Return type:

bool

property is_parked

Whether the dome is parked (per TheSkyX responses).

open()[source]

Command the dome to open the slit and wait until it reports open.

Returns:

True if the slit ends up open.

Return type:

bool

park()[source]

Park the dome via TheSkyX and update internal state.

Returns:

True if park succeeded.

Return type:

bool

property position

Return current dome position as reported by TheSkyX.

Returns:

Parsed response from the ‘dome/position.js’ template.

Return type:

dict

read(timeout=5)[source]

Read and parse a response from TheSkyX with a simple timeout loop.

Parameters:

timeout (int) – Seconds to wait before giving up.

Returns:

Parsed JSON-like object with ‘response’ and ‘success’ keys when possible.

Return type:

dict

read_slit_state()[source]

Query TheSkyX for the current slit state and return a label.

Returns:

One of ‘Open’, ‘Closed’, ‘Unknown’, or ‘Disconnected’.

Return type:

str

property status

Return a status mapping from TheSkyX.

Returns:

Parsed response from the ‘dome/status.js’ template.

Return type:

dict

unpark()[source]

Unpark the dome via TheSkyX and update internal state.

Returns:

True if the dome reports unparked.

Return type:

bool

write(value)[source]

Send a script to TheSkyX.

Parameters:

value (str) – JavaScript command to execute.

Returns:

None

panoptes.pocs.dome.protocol_astrohaven_simulator module

panoptes.pocs.dome.simulator module

Simple dome simulator used by tests and demos.

Implements the AbstractDome interface with in-memory state transitions for open/close/connect, returning canned status values.

class panoptes.pocs.dome.simulator.Dome(*args, **kwargs)[source]

Bases: AbstractDome

Simulator for a Dome controller.

close()[source]

Close the simulated dome slit.

Returns:

True if the state is now ‘closed’.

Return type:

bool

connect()[source]

Connect to the simulated dome controller.

Returns:

True if the simulator reports connected after the call.

Return type:

bool

disconnect()[source]

Disconnect from the simulated dome controller.

Returns:

Always True for the simulator.

Return type:

bool

property is_closed

Whether the simulated dome slit is closed.

Returns:

True if the simulated state is ‘closed’.

Return type:

bool

property is_open

Whether the simulated dome slit is open.

Returns:

True if the simulated state is ‘open’.

Return type:

bool

open()[source]

Open the simulated dome slit.

Returns:

True if the state is now ‘open’.

Return type:

bool

property status

Return a minimal status dictionary for the simulated dome.

Returns:

Contains connected (bool) and open (str state) keys.

Return type:

dict

Module contents

class panoptes.pocs.dome.AbstractDome(*args, **kwargs)[source]

Bases: PanBase

Abstract base class for controlling a non-rotating dome.

This assumes that the observatory ‘dome’ is not a classic rotating dome with a narrow slit, but instead something like a roll-off roof or clam-shell, which can be observed from when open, and that the other states (closed or moving) are not used for observing.

Adding support for a rotating dome would require coordination during observing to make sure that the opening tracks the field being observed.

abstractmethod close()[source]

If not known to be closed, attempts to close the dome.

Must already be connected.

Returns: True if and when closed, False if unable to close.

abstractmethod connect()[source]

Establish a connection to the dome controller.

The sub-class implementation can access configuration information from self._config; see PanBase for more common properties.

Returns: True if connected, False otherwise.

abstractmethod disconnect()[source]

Disconnect from the dome controller.

Raises:

An exception if unable to disconnect.

abstractmethod is_closed()[source]

True if dome is known to be closed.

property is_connected

True if connected to the hardware or driver.

abstractmethod is_open()[source]

True if dome is known to be open.

abstractmethod open()[source]

If not known to be open, attempts to open the dome.

Must already be connected.

Returns: True if and when open, False if unable to open.

abstract property status

A string representing the status of the dome for presentation.

This string is NOT for use in logic, only for presentation, as there is no requirement to produce the same string for different types of domes: a roll-off roof might have a very different status than a rotating dome that is coordinating its movements with the telescope mount.

Examples: ‘Open’, ‘Closed’, ‘Opening’, ‘Closing’, ‘Left Moving’, ‘Right Stuck’

Returns: A string.

panoptes.pocs.dome.create_dome_from_config(*args, **kwargs)[source]

If there is a dome specified in the config, create a driver for it.

A dome needs a config. We assume that there is at most one dome in the config, i.e. we don’t support two different dome devices, such as might be the case if there are multiple independent actuators, for example slit, rotation and vents. Those would need to be handled by a single dome driver class.

panoptes.pocs.dome.create_dome_simulator(*args, **kwargs)[source]

Create and return a dome instance from the configured simulator driver.

Reads the ‘dome’ section from the PANOPTES configuration, loads the driver specified by the ‘driver’ key under panoptes.pocs.dome.<driver>, and constructs a Dome instance with any provided args/kwargs. This is primarily used in tests or simulated environments.

Parameters:
  • *args – Positional arguments forwarded to the Dome constructor.

  • **kwargs – Keyword arguments forwarded to the Dome constructor.

Returns:

An instance of the configured dome simulator driver.

Return type:

AbstractDome