Interfaces (pyobs.interfaces)
Using interface, a Module signals another one, what functionality it provides for remote
procedure calls. The base class for all interfaces in pyobs is:
- class Interface
Base class for all interfaces in pyobs.
- get_capabilities(interface: type[Interface]) Any | None[source]
Return the capabilities for the given interface, or None.
- get_state(interface: type[Interface]) Any | None[source]
Return the last received state for the given interface, or None.
- classmethod has_own_state() bool[source]
True if this interface defines its own state, as opposed to merely inheriting one from a component interface it combines (e.g. ICamera inheriting IExposure’s state). Modules publish state under the interface that actually defines it, so composite interfaces would otherwise be (wrongly) treated as publishing state too.
Modules need to implement the required interfaces. For instance, if a module operates a camera, it probably should
implement ICamera.
IAbortable
IAcquisition
- class IAcquisition
Bases:
IRunning,IAbortableThe module can acquire a target, usually by accessing a telescope and a camera.
- abstractmethod async acquire_target(**kwargs: Any) AcquisitionResult[source]
Acquire target at given coordinates.
If no RA/Dec are given, start from current position. Might not work for some implementations that require coordinates.
- Returns:
Result with time, ra, dec, alt, az, and an offset in whichever frame the mount supports.
- Raises:
AbortedError – If the acquisition was aborted.
GeneralError – If a dependency (e.g. the camera) failed.
ImageError – If the calculated offset was too large or otherwise unusable.
AcquisitionError – If target could not be acquired within the given tolerance.
- state
alias of
AcquisitionState
IAutoFocus
- class IAutoFocus
Bases:
IRunning,IAbortableThe module can perform an autofocus.
- abstractmethod async auto_focus(count: int, step: float, exposure_time: ~typing.Annotated[float, <Unit.SECONDS: 'seconds'>], **kwargs: ~typing.Any) AutoFocusResult[source]
Perform an autofocus series.
This method performs an autofocus series with “count” images on each side of the initial guess and the given step size. With count=3, step=1 and guess=10, this takes images at the following focus values: 7, 8, 9, 10, 11, 12, 13
- Parameters:
count – Number of images to take on each side of the initial guess. Should be an odd number.
step – Step size.
exposure_time – Exposure time for images.
- Returns:
Result of autofocus.
- Raises:
AbortedError – If the autofocus series was aborted.
FocusError – If focus could not be obtained.
- state
alias of
AutoFocusState
IAutoGuiding
- class IAutoGuiding
Bases:
IStartStop,IExposureTimeThe module can perform auto-guiding.
- state
alias of
GuidingState
IAutonomous
- class IAutonomous
Bases:
IStartStopThe module does some autonomous actions, mainly used for warnings to users.
IBinning
- class IBinning
Bases:
InterfaceThe camera supports binning, to be used together with
ICamera.- capabilities
alias of
BinningCapabilities
- abstractmethod async set_binning(x: int, y: int, **kwargs: Any) None[source]
Set the camera binning.
- Parameters:
x – X binning.
y – Y binning.
- Raises:
ValueError – If binning could not be set.
- state
alias of
BinningState
ICalibrate
- class ICalibrate
Bases:
InterfaceThe module can calibrate a device.
- abstractmethod async calibrate(**kwargs: Any) None[source]
Calibrate the device.
- Raises:
GeneralError – If calibration failed.
ICamera
IConfig
- class IConfig
Bases:
InterfaceThe module allows access to some of its configuration options.
- capabilities
alias of
ConfigCapabilities
- abstractmethod async get_config_value(name: str, **kwargs: Any) bool | int | float | str | list[bool | int | float | str] | dict[str, bool | int | float | str][source]
Returns current value of config item with given name.
- Parameters:
name – Name of config item.
- Returns:
Current value.
- Raises:
InvalidArgumentError – If config item of given name does not exist.
- abstractmethod async set_config_value(name: str, value: bool | int | float | str | list[bool | int | float | str] | dict[str, bool | int | float | str], **kwargs: Any) None[source]
Sets value of config item with given name.
- Parameters:
name – Name of config item.
value – New value.
- Raises:
InvalidArgumentError – If config item of given name does not exist.
ValueError – If value is invalid.
ICooling
- class ICooling
Bases:
ITemperaturesThe module can control the cooling of a device.
- abstractmethod async set_cooling(enabled: bool, setpoint: ~typing.Annotated[float, <Unit.CELSIUS: 'celsius'>], **kwargs: ~typing.Any) None[source]
Enables/disables cooling and sets setpoint.
- Parameters:
enabled – Enable or disable cooling.
setpoint – Setpoint in celsius for the cooling.
- Raises:
ValueError – If cooling could not be set.
- state
alias of
CoolingState
IData
- class IData
Bases:
InterfaceThe module can grab and return an image from whatever device.
- abstractmethod async grab_data(broadcast: bool = True, **kwargs: Any) str[source]
Grabs an image and returns reference.
- Parameters:
broadcast – Broadcast existence of image.
- Returns:
Name of image that was taken.
- Raises:
DeviceBusyError – If the device is already busy (exposing or running a sequence).
GrabImageError – If there was a problem grabbing the image.
IDataSequence
- class IDataSequence
Bases:
IAbortableThe module can grab a counted sequence of data (images, spectra, …).
- abstractmethod async abort_sequence(**kwargs: Any) None[source]
Stop the sequence after the current grab. The grab currently in progress, if any, finishes normally; no further grabs in the sequence are started.
This is the graceful counterpart to IAbortable.abort(), which remains the hard-stop path: it cancels the running grab immediately and the remaining sequence count.
- abstractmethod async grab_sequence(count: int, broadcast: bool = True, delay: Annotated[float, <Unit.SECONDS: 'seconds'>] = 0, **kwargs: Any) None[source]
Start a sequence of count grabs. Returns immediately; progress is available via the pushed DataSequenceState.
- Parameters:
count – Number of grabs to take.
broadcast – Broadcast existence of each grab.
delay – Seconds to wait between the end of one grab and the start of the next. Does not apply after the last grab. Skipped early if the sequence is aborted during the wait.
- Raises:
InvalidArgumentError – If count or delay is out of range.
DeviceBusyError – If the device is already busy (exposing or already running a sequence).
- state
alias of
DataSequenceState
IDome
- class IDome
Bases:
IRoof,IPointingAltAzThe module controls a dome, i.e. a
IRoofwith a rotating roof.
IExposure
IExposureTime
- class IExposureTime
Bases:
InterfaceThe camera supports exposure times, to be used together with
ICamera.- abstractmethod async set_exposure_time(exposure_time: ~typing.Annotated[float, <Unit.SECONDS: 'seconds'>], **kwargs: ~typing.Any) None[source]
Set the exposure time in seconds.
- Parameters:
exposure_time – Exposure time in seconds.
- Raises:
ValueError – If exposure time could not be set.
NotSupportedError – If this module doesn’t support setting exposure time directly (e.g. it’s dictated by something else, like incoming science frames).
- state
alias of
ExposureTimeState
IFilters
- class IFilters
Bases:
IMotionThe module can change filters in a device.
- capabilities
alias of
FiltersCapabilities
- abstractmethod async set_filter(filter_name: str, **kwargs: Any) None[source]
Set the current filter.
- Parameters:
filter_name – Name of filter to set.
- Raises:
InvalidArgumentError – If an invalid filter was given.
MoveError – If filter wheel cannot be moved.
- state
alias of
FilterState
IFitsHeaderAfter
- class IFitsHeaderAfter
Bases:
InterfaceThe module provides some additional header entries for FITS headers after some event (usually the end of the exposure).
- abstractmethod async get_fits_header_after(namespaces: list[str] | None = None, **kwargs: Any) dict[str, FitsHeaderEntry][source]
Returns FITS header for the current status of this module.
- Parameters:
namespaces – If given, only return FITS headers for the given namespaces.
- Returns:
Dictionary containing FITS headers.
IFitsHeaderBefore
- class IFitsHeaderBefore
Bases:
InterfaceThe module provides some additional header entries for FITS headers before some event (usually the start of the exposure).
- abstractmethod async get_fits_header_before(namespaces: list[str] | None = None, **kwargs: Any) dict[str, FitsHeaderEntry][source]
Returns FITS header for the current status of this module.
- Parameters:
namespaces – If given, only return FITS headers for the given namespaces.
- Returns:
Dictionary containing FITS headers.
IFlatField
- class IFlatField
Bases:
IAbortableThe module performs flat-fielding.
- abstractmethod async flat_field(count: int = 20, **kwargs: Any) tuple[int, ~typing.Annotated[float, <Unit.SECONDS: 'seconds'>]][source]
Do a series of flat fields.
- Parameters:
count – Number of images to take
- Returns:
Number of images actually taken and total exposure time in seconds
- Raises:
DeviceBusyError – If a flat-fielding run is already in progress.
IFocusModel
- class IFocusModel
Bases:
InterfaceThe module provides a model for the telescope focus, e.g. based on temperatures.
- abstractmethod async set_optimal_focus(**kwargs: Any) None[source]
Sets optimal focus.
- Raises:
WeatherDataError – If the weather station returned an invalid temperature reading.
FocusTimeoutError – If a temperature module didn’t respond in time.
MissingSensorError – If a configured sensor isn’t in a module’s temperature data.
- state
alias of
OptimalFocusState
IFocuser
- class IFocuser
Bases:
IMotionThe module is a focusing device.
- abstractmethod async set_focus(focus: ~typing.Annotated[float, <Unit.MM: 'mm'>], **kwargs: ~typing.Any) None[source]
Sets new focus.
- Parameters:
focus – New focus value in mm.
- Raises:
InvalidArgumentError – If given value is invalid.
AbortedError – If movement was aborted.
MoveError – If telescope cannot be moved.
- abstractmethod async set_focus_offset(offset: ~typing.Annotated[float, <Unit.MM: 'mm'>], **kwargs: ~typing.Any) None[source]
Sets focus offset.
- Parameters:
offset – New focus offset in mm.
- Raises:
ValueError – If given value is invalid.
NotSupportedError – If this module doesn’t support a separate focus offset.
MoveError – If telescope cannot be moved.
- state
alias of
FocuserState
IGain
- class IGain
Bases:
InterfaceThe camera supports setting of gain, to be used together with
ICamera.- abstractmethod async set_gain(gain: float, **kwargs: Any) None[source]
Set the camera gain.
- Parameters:
gain – New camera gain.
- Raises:
ValueError – If gain could not be set.
- abstractmethod async set_offset(offset: float, **kwargs: Any) None[source]
Set the camera offset.
- Parameters:
offset – New camera offset.
- Raises:
ValueError – If offset could not be set.
- state
alias of
GainState
IImageFormat
- class IImageFormat
Bases:
InterfaceThe module supports different image formats (e.g. INT16, FLOAT32), mainly used by cameras.
- capabilities
alias of
ImageFormatCapabilities
- abstractmethod async set_image_format(fmt: ImageFormat, **kwargs: Any) None[source]
Set the camera image format.
- Parameters:
fmt – New image format.
- Raises:
ValueError – If format could not be set.
- state
alias of
ImageFormatState
IImageType
- class IImageType
Bases:
InterfaceThe module supports different image types (e.g. object, bias, dark, etc), mainly used by cameras.
- abstractmethod async set_image_type(image_type: ImageType, **kwargs: Any) None[source]
Set the image type.
- Parameters:
image_type – New image type.
- state
alias of
ImageTypeState
IMode
- class IMode
Bases:
InterfaceThe module can change modes in a device.
- capabilities
alias of
ModeCapabilities
- abstractmethod async set_mode(mode: str, group: str = '', **kwargs: Any) None[source]
Set the current mode.
- Parameters:
mode – Name of mode to set.
group – Name of the group to set the mode for.
- Raises:
InvalidArgumentError – If an invalid mode or group was given.
MoveError – If mode selector cannot be moved.
- state
alias of
ModeState
IModule
IMotion
- class IMotion
Bases:
IReadyThe module controls a device that can move.
- abstractmethod async init(**kwargs: Any) None[source]
Initialize device.
- Raises:
InitError – If device could not be initialized.
- abstractmethod async park(**kwargs: Any) None[source]
Park device.
- Raises:
ParkError – If device could not be parked.
- state
alias of
MotionState
IMultiFiber
- class IMultiFiber
Bases:
InterfaceAn interface for multi-fiber setups that helps to set/get a fiber and retrieve position and size of the current fiber on the acquisition/guiding image.
- capabilities
alias of
MultiFiberCapabilities
- abstractmethod async set_fiber(fiber: str, **kwargs: Any) None[source]
Sets the currently active fiber. Must be in fiber_names capability.
- Parameters:
fiber – Name of fiber to set.
- Raises:
InvalidArgumentError – If fiber name is invalid.
- state
alias of
MultiFiberState
IOffsetsAltAz
- class IOffsetsAltAz
Bases:
InterfaceThe module supports Alt/Az offsets, usually combined with
ITelescopeandIPointingAltAz.- abstractmethod async set_offsets_altaz(dalt: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], daz: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Move an Alt/Az offset.
- Parameters:
dalt – Altitude offset in degrees.
daz – Azimuth offset in degrees.
- Raises:
MoveError – If device could not be moved.
- state
alias of
AltAzOffsetState
IOffsetsRaDec
- class IOffsetsRaDec
Bases:
InterfaceThe module supports RA/Dec offsets, usually combined with
ITelescopeandIPointingRaDec.- abstractmethod async set_offsets_radec(dra: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], ddec: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Move an RA/Dec offset.
- Parameters:
dra – RA offset in degrees.
ddec – Dec offset in degrees.
- Raises:
MoveError – If telescope cannot be moved.
- state
alias of
RaDecOffsetState
IPointingAltAz
- class IPointingAltAz
Bases:
InterfaceThe module can move to Alt/Az coordinates, usually combined with
ITelescope.- abstractmethod async move_altaz(alt: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], az: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Moves to given coordinates.
- Parameters:
alt – Alt in deg to move to.
az – Az in deg to move to.
- Raises:
NotSupportedError – If this device doesn’t support Alt/Az pointing.
AltitudeLimitError – If the destination is below the configured altitude limit.
MoveError – If device could not be moved.
- state
alias of
AltAzState
IPointingBody
- class IPointingBody
Bases:
InterfacePoints at and tracks a named solar-system body.
- abstractmethod async track_body(body: str, **kwargs: Any) None[source]
Starts tracking a named solar-system body.
- Parameters:
body – Name resolvable to an ephemeris (e.g. ‘moon’, ‘mars’, ‘jupiter’, or an asteroid/comet designation known to JPL Horizons).
- Raises:
NotSupportedError – If this device doesn’t support body tracking.
BodyResolutionError – If body name is not resolvable.
MoveError – If telescope could not be moved. Also propagates whatever the underlying RA/Dec move raises (e.g. MissingObserverError, AltitudeLimitError), since tracking a body is implemented as resolving it and then moving there.
IPointingHeliocentricPolar
- class IPointingHeliocentricPolar
Bases:
InterfaceThe module can move to Heliocentric Polar (Mu/Psi) coordinates, usually combined with
ITelescope.- abstractmethod async move_heliocentric_polar(mu: float, psi: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Moves on given coordinates.
- Parameters:
mu – Cosine of the angular distance from Sun centre, dimensionless (0..1).
psi – Position angle around the solar disk, in degrees.
- Raises:
MoveError – If device could not be moved. Also propagates whatever the underlying RA/Dec move raises (e.g. MissingObserverError, AltitudeLimitError), since this is typically implemented as converting to RA/Dec and then moving there.
- state
alias of
HeliocentricPolarState
IPointingHeliographicStonyhurst
- class IPointingHeliographicStonyhurst
Bases:
InterfaceThe module can move to Heliographic Stonyhurst (lon/lat) coordinates, a frame fixed to the Sun’s rotating surface, usually combined with
ITelescope.- abstractmethod async move_heliographic_stonyhurst(lon: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], lat: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Moves on given coordinates.
- Parameters:
lon – Longitude in deg to track.
lat – Latitude in deg to track.
- Raises:
MoveError – If device could not be moved. Also propagates whatever the underlying RA/Dec move raises (e.g. MissingObserverError, AltitudeLimitError), since this is typically implemented as converting to RA/Dec and then moving there.
- state
alias of
HeliographicStonyhurstState
IPointingHelioprojective
- class IPointingHelioprojective
Bases:
InterfaceThe module can move to Mu/Psi coordinates, usually combined with
ITelescope.- abstractmethod async move_helioprojective(theta_x: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], theta_y: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Moves on given coordinates.
- Parameters:
theta_x – The theta_x coordinate.
theta_y – The theta_y coordinate.
- Raises:
MoveError – If device could not be moved. Also propagates whatever the underlying RA/Dec move raises (e.g. MissingObserverError, AltitudeLimitError), since this is typically implemented as converting to RA/Dec and then moving there.
- state
alias of
HelioprojectiveState
IPointingOrbitalElements
- class IPointingOrbitalElements
Bases:
InterfacePoints at and tracks a body defined by orbital elements (asteroid, comet, NEO).
- abstractmethod async track_orbital_elements(elements: OrbitalElements, **kwargs: Any) None[source]
Starts tracking a body defined by orbital elements.
- Parameters:
elements – Orbital elements of the body to track.
- Raises:
NotSupportedError – If this device doesn’t support orbital-element tracking.
InvalidOrbitalElementsError – If elements are incomplete or inconsistent (neither mean_anomaly nor perihelion_time given).
MoveError – If telescope could not be moved. Also propagates whatever the underlying RA/Dec move raises (e.g. MissingObserverError, AltitudeLimitError), since tracking orbital elements is implemented as propagating them and then moving there.
IPointingRaDec
- class IPointingRaDec
Bases:
InterfaceThe module can move to RA/Dec coordinates, usually combined with
ITelescope.- abstractmethod async move_radec(ra: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], dec: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Starts tracking on given coordinates.
- Parameters:
ra – RA in deg to track.
dec – Dec in deg to track.
- Raises:
NotSupportedError – If this device doesn’t support RA/Dec pointing.
MissingObserverError – If no observer is configured.
AltitudeLimitError – If the destination is below the configured altitude limit.
MoveError – If device could not be moved.
- state
alias of
RaDecState
IPointingSeries
- class IPointingSeries
Bases:
InterfaceThe module provides the interface for a device that initializes and finalizes a pointing series and adds points to it.
- abstractmethod async add_pointing_measurement(**kwargs: Any) None[source]
Add a new measurement to the pointing series.
- Raises:
GeneralError – If the measurement could not be added.
IReady
IRoof
IRotation
- class IRotation
Bases:
IMotionThe module controls a device that can rotate.
- abstractmethod async set_rotation(angle: ~typing.Annotated[float, <Unit.DEGREES: 'deg'>], **kwargs: ~typing.Any) None[source]
Sets the rotation angle to the given value in degrees.
- Raises:
MoveError – If the device could not be rotated.
- state
alias of
RotationState
IRunnable
- class IRunnable
Bases:
IAbortableThe module has some action that can be started remotely.
- abstractmethod async run(**kwargs: Any) None[source]
Perform module task
- Raises:
DeviceBusyError – If this task is already running.
ScriptError – ScriptRunner-based implementations wrap whatever the underlying script raises that isn’t already a domain exception.
IRunning
IScriptRunner
- class IScriptRunner
Bases:
InterfaceThe module can execute a script.
- abstractmethod async run_script(script: str, **kwargs: Any) None[source]
Run the given script.
- Parameters:
script – Script to run.
- Raises:
ScriptError – If the script failed.
ISpectrograph
IStartStop
IStructuredConfig
- class IStructuredConfig
Bases:
InterfaceThe module accepts a whole structured (possibly nested) config object in one call, rather than per-field get/set (see IConfig for the per-field variant).
- capabilities
alias of
ConfigSchema
- abstractmethod async set_config(config: dict[str, bool | int | float | str | list[bool | int | float | str | list[ConfigValue] | dict[str, ConfigValue]] | dict[str, bool | int | float | str | list[ConfigValue] | dict[str, ConfigValue]]], **kwargs: Any) None[source]
Apply a full structured config to this module.
- Parameters:
config – Nested dict matching this module’s ConfigSchema (fetch via get_capabilities). Values are validated and deserialized into the module’s internal config dataclass.
- Raises:
ValueError – If config doesn’t match the module’s schema, or values fail validation.
- state
alias of
ConfigAppliedState
ISyncTarget
- class ISyncTarget
Bases:
InterfaceThe module can synchronize a target, e.g. via a telescope control software behinde an
ITelescope.- abstractmethod async sync_target(**kwargs: Any) None[source]
Synchronize device on current target.
- Raises:
GeneralError – If synchronization failed.
ITelescope
ITemperatures
ITrackingMode
- class ITrackingMode
Bases:
InterfaceThe module supports switching between discrete, hardware-native tracking rates.
- capabilities
alias of
TrackingModeCapabilities
- abstractmethod async set_tracking_mode(mode: TrackingMode, **kwargs: Any) None[source]
Switches to the given tracking mode.
- Parameters:
mode – Tracking mode to switch to.
- Raises:
MoveError – If mode could not be set.
InvalidArgumentError – If mode is not in this module’s capabilities.
- state
alias of
TrackingModeState
ITrackingRate
- class ITrackingRate
Bases:
InterfaceThe module accepts an arbitrary non-sidereal tracking rate as an absolute RA/Dec offset.
- capabilities
alias of
TrackingRateCapabilities
- abstractmethod async set_tracking_rate(ra_rate: ~typing.Annotated[float, <Unit.ARCSEC_PER_SEC: 'arcsec/s'>], dec_rate: ~typing.Annotated[float, <Unit.ARCSEC_PER_SEC: 'arcsec/s'>], **kwargs: ~typing.Any) None[source]
Sets an absolute tracking rate on the sky, in arcsec/sec.
- Parameters:
ra_rate – Rate in RA, arcsec/sec on the sky.
dec_rate – Rate in Dec, arcsec/sec on the sky.
- Raises:
MoveError – If rate could not be set.
- state
alias of
TrackingRateState
IVideo
IWeather
- class IWeather
Bases:
IStartStopThe module acts as a weather station.
- abstractmethod async get_sensor_value(station: str, sensor: WeatherSensors, **kwargs: Any) WeatherSensorReading[source]
Return value for given sensor.
- Parameters:
station – Name of weather station to get value from.
sensor – Name of sensor to get value from.
- Returns:
Current reading for the given sensor.
- Raises:
InvalidArgumentError – If station or sensor is unknown.
WeatherResponseError – If the underlying weather station’s response is malformed.
- state
alias of
WeatherState
IWindow
- class IWindow
Bases:
InterfaceThe camera supports windows, to be used together with
ICamera.- capabilities
alias of
WindowCapabilities
- abstractmethod async set_window(left: int, top: int, width: int, height: int, **kwargs: Any) None[source]
Set the camera window.
- Parameters:
left – X offset of window.
top – Y offset of window.
width – Width of window.
height – Height of window.
- Raises:
ValueError – If window could not be set.
- state
alias of
WindowState