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.

Modules need to implement the required interfaces. For instance, if a module operates a camera, it probably should implement ICamera.

IAbortable

class IAbortable

Bases: pyobs.interfaces.Interface

The module has an abortable action.

abstract async abort(**kwargs: Any) None[source]

Abort current actions.

IAcquisition

class IAcquisition

Bases: pyobs.interfaces.IRunning

The module can acquire a target, usually by accessing a telescope and a camera.

abstract async acquire_target(**kwargs: Any) Dict[str, Any][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:

A dictionary with entries for datetime, ra, dec, alt, az, and either off_ra, off_dec or off_alt, off_az.

Raises:

ValueError – If target could not be acquired.

IAutoFocus

class IAutoFocus

Bases: pyobs.interfaces.IAbortable

The module can perform an auto-focus.

abstract async auto_focus(count: int, step: float, exposure_time: float, **kwargs: Any) Tuple[float, float][source]

Perform an auto-focus series.

This method performs an auto-focus 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:

Tuple of obtained best focus value and its uncertainty.

Raises:

ValueError – If focus could not be obtained.

abstract async auto_focus_status(**kwargs: Any) Dict[str, Any][source]

Returns current status of auto focus.

Returned dictionary contains a list of focus/fwhm pairs in X and Y direction.

Returns:

Dictionary with current status.

IAutoGuiding

class IAutoGuiding

Bases: pyobs.interfaces.IStartStop

The module can perform auto-guiding.

abstract async set_exposure_time(exposure_time: float, **kwargs: Any) None[source]

Set the exposure time for the auto-guider.

Parameters:

exposure_time – Exposure time in secs.

IAutonomous

class IAutonomous

Bases: pyobs.interfaces.IStartStop

The module does some autonomous actions, mainly used for warnings to users.

IBinning

class IBinning

Bases: pyobs.interfaces.Interface

The camera supports binning, to be used together with ICamera.

abstract async get_binning(**kwargs: Any) Tuple[int, int][source]

Returns the camera binning.

Returns:

Tuple with x and y.

abstract async list_binnings(**kwargs: Any) List[Tuple[int, int]][source]

List available binnings.

Returns:

List of available binnings as (x, y) tuples.

abstract 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.

ICalibrate

class ICalibrate

Bases: pyobs.interfaces.Interface

The module can calibrate a device.

abstract async calibrate(**kwargs: Any) None[source]

Calibrate the device.

ICamera

class ICamera

Bases: pyobs.interfaces.IAbortable, pyobs.interfaces.IImageGrabber

The module controls a camera.

abstract async abort(**kwargs: Any) None[source]

Aborts the current exposure and sequence.

Raises:

ValueError – If exposure could not be aborted.

abstract async get_exposure_progress(**kwargs: Any) float[source]

Returns the progress of the current exposure in percent.

Returns:

Progress of the current exposure in percent.

abstract async get_exposure_status(**kwargs: Any) pyobs.utils.enums.ExposureStatus[source]

Returns the current status of the camera, which is one of ‘idle’, ‘exposing’, or ‘readout’.

Returns:

Current status of camera.

IConfig

class IConfig

Bases: pyobs.interfaces.Interface

The module allows access to some of its configuration options.

abstract async get_config_caps(**kwargs: Any) Dict[str, Tuple[bool, bool, bool]][source]

Returns dict of all config capabilities. First value is whether it has a getter, second is for the setter, third is for a list of possible options..

Returns:

Dict with config caps

abstract async get_config_value(name: str, **kwargs: Any) Any[source]

Returns current value of config item with given name.

Parameters:

name – Name of config item.

Returns:

Current value.

Raises:

ValueError – If config item of given name does not exist.

abstract async get_config_value_options(name: str, **kwargs: Any) List[str][source]

Returns possible values for config item with given name.

Parameters:

name – Name of config item.

Returns:

Possible values.

Raises:

ValueError – If config item of given name does not exist.

abstract async set_config_value(name: str, value: Any, **kwargs: Any) None[source]

Sets value of config item with given name.

Parameters:
  • name – Name of config item.

  • value – New value.

Raises:

ValueError – If config item of given name does not exist or value is invalid.

ICooling

class ICooling

Bases: pyobs.interfaces.ITemperatures

The module can control the cooling of a device.

abstract async get_cooling_status(**kwargs: Any) Tuple[bool, float, float][source]

Returns the current status for the cooling.

Returns:

Tuple containing:

Enabled: Whether the cooling is enabled SetPoint: Setpoint for the cooling in celsius. Power: Current cooling power in percent or None.

Return type:

(tuple)

abstract async set_cooling(enabled: bool, setpoint: float, **kwargs: 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.

IDome

class IDome

Bases: pyobs.interfaces.IRoof, pyobs.interfaces.IPointingAltAz

The module controls a dome, i.e. a IRoof with a rotating roof.

IExposureTime

class IExposureTime

Bases: pyobs.interfaces.Interface

The camera supports exposure times, to be used together with ICamera.

abstract async get_exposure_time(**kwargs: Any) float[source]

Returns the exposure time in seconds.

Returns:

Exposure time in seconds.

abstract async get_exposure_time_left(**kwargs: Any) float[source]

Returns the remaining exposure time on the current exposure in seconds.

Returns:

Remaining exposure time in seconds.

abstract async set_exposure_time(exposure_time: float, **kwargs: 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.

IFilters

class IFilters

Bases: pyobs.interfaces.IMotion

The module can change filters in a device.

abstract async get_filter(**kwargs: Any) str[source]

Get currently set filter.

Returns:

Name of currently set filter.

abstract async list_filters(**kwargs: Any) List[str][source]

List available filters.

Returns:

List of available filters.

abstract async set_filter(filter_name: str, **kwargs: Any) None[source]

Set the current filter.

Parameters:

filter_name – Name of filter to set.

Raises:
  • ValueError – If an invalid filter was given.

  • MoveError – If filter wheel cannot be moved.

IFitsHeaderAfter

class IFitsHeaderAfter

Bases: pyobs.interfaces.Interface

The module provides some additional header entries for FITS headers after some event (usually the end of the exposure).

abstract async get_fits_header_after(namespaces: Optional[List[str]] = None, **kwargs: Any) Dict[str, Tuple[Any, str]][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: pyobs.interfaces.Interface

The module provides some additional header entries for FITS headers before some event (usually the start of the exposure).

abstract async get_fits_header_before(namespaces: Optional[List[str]] = None, **kwargs: Any) Dict[str, Tuple[Any, str]][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: pyobs.interfaces.IAbortable

The module performs flat-fielding.

abstract async flat_field(count: int = 20, **kwargs: Any) Tuple[int, float][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 ms

IFocusModel

class IFocusModel

Bases: pyobs.interfaces.Interface

The module provides a model for the telescope focus, e.g. based on temperatures.

abstract async get_optimal_focus(**kwargs: Any) float[source]

Returns the optimal focus.

abstract async set_optimal_focus(**kwargs: Any) None[source]

Sets optimal focus.

IFocuser

class IFocuser

Bases: pyobs.interfaces.IMotion

The module is a focusing device.

abstract async get_focus(**kwargs: Any) float[source]

Return current focus.

Returns:

Current focus.

abstract async get_focus_offset(**kwargs: Any) float[source]

Return current focus offset.

Returns:

Current focus offset.

abstract async set_focus(focus: float, **kwargs: Any) None[source]

Sets new focus.

Parameters:

focus – New focus value.

Raises:
  • MoveError – If telescope cannot be moved.

  • InterruptedError – If movement was aborted.

abstract async set_focus_offset(offset: float, **kwargs: Any) None[source]

Sets focus offset.

Parameters:

offset – New focus offset.

Raises:
  • ValueError – If given value is invalid.

  • MoveError – If telescope cannot be moved.

IImageFormat

class IImageFormat

Bases: pyobs.interfaces.Interface

The module supports different image formats (e.g. INT16, FLOAT32), mainly used by cameras.

abstract async get_image_format(**kwargs: Any) pyobs.utils.enums.ImageFormat[source]

Returns the camera image format.

Returns:

Current image format.

abstract async list_image_formats(**kwargs: Any) List[str][source]

List available image formats.

Returns:

List of available image formats.

abstract async set_image_format(fmt: pyobs.utils.enums.ImageFormat, **kwargs: Any) None[source]

Set the camera image format.

Parameters:

fmt – New image format.

Raises:

ValueError – If format could not be set.

IImageGrabber

class IImageGrabber

Bases: pyobs.interfaces.Interface

The module can grab and return an image from whatever device.

abstract async grab_image(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:

GrabImageError – If there was a problem grabbing the image.

IImageType

class IImageType

Bases: pyobs.interfaces.Interface

The module supports different image types (e.g. object, bias, dark, etc), mainly used by cameras.

abstract async get_image_type(**kwargs: Any) pyobs.utils.enums.ImageType[source]

Returns the current image type.

Returns:

Current image type.

abstract async set_image_type(image_type: pyobs.utils.enums.ImageType, **kwargs: Any) None[source]

Set the image type.

Parameters:

image_type – New image type.

ILatLon

class ILatLon

Bases: pyobs.interfaces.Interface

The module can move to general Lat/Lon coordinates, which have to be async defined by the module itself. Usually combined with ITelescope.

abstract async get_latlon(**kwargs: Any) Tuple[float, float][source]

Returns current Latitude and Longitude.

Returns:

Tuple of current Latitude and Longitude in degrees.

abstract async move_latlon(lat: float, lon: float, **kwargs: Any) None[source]

Moves to given coordinates.

Parameters:
  • lat – Latitude in deg to move to.

  • lon – Longitude in deg to move to.

Raises:

ValueError – If device could not move.

IModule

class IModule

Bases: pyobs.interfaces.Interface

The module is actually a module. Implemented by all modules.

abstract async get_error_string(**kwargs: Any) str[source]

Returns description of error, if any.

abstract async get_label(**kwargs: Any) str[source]

Returns label of module.

abstract async get_state(**kwargs: Any) pyobs.utils.enums.ModuleState[source]

Returns current state of module.

abstract async get_version(**kwargs: Any) str[source]

Returns pyobs version of module.

abstract async reset_error(**kwargs: Any) bool[source]

Reset error of module, if any.

IMotion

class IMotion

Bases: pyobs.interfaces.IReady

The module controls a device that can move.

abstract async get_motion_status(device: Optional[str] = None, **kwargs: Any) pyobs.utils.enums.MotionStatus[source]

Returns current motion status.

Parameters:

device – Name of device to get status for, or None.

Returns:

A string from the Status enumerator.

abstract async init(**kwargs: Any) None[source]

Initialize device.

Raises:

InitError – If device could not be initialized.

abstract async park(**kwargs: Any) None[source]

Park device.

Raises:

ParkError – If device could not be parked.

abstract async stop_motion(device: Optional[str] = None, **kwargs: Any) None[source]

Stop the motion.

Parameters:

device – Name of device to stop, or None for all.

IOffsetsAltAz

class IOffsetsAltAz

Bases: pyobs.interfaces.Interface

The module supports Alt/Az offsets, usually combined with ITelescope and IPointingAltAz.

abstract async get_offsets_altaz(**kwargs: Any) Tuple[float, float][source]

Get Alt/Az offset.

Returns:

Tuple with alt and az offsets.

abstract async set_offsets_altaz(dalt: float, daz: float, **kwargs: 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.

IOffsetsRaDec

class IOffsetsRaDec

Bases: pyobs.interfaces.Interface

The module supports RA/Dec offsets, usually combined with ITelescope and IPointingRaDec.

abstract async get_offsets_radec(**kwargs: Any) Tuple[float, float][source]

Get RA/Dec offset.

Returns:

Tuple with RA and Dec offsets.

abstract async set_offsets_radec(dra: float, ddec: float, **kwargs: 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.

IPointingAltAz

class IPointingAltAz

Bases: pyobs.interfaces.Interface

The module can move to Alt/Az coordinates, usually combined with ITelescope.

abstract async get_altaz(**kwargs: Any) Tuple[float, float][source]

Returns current Alt and Az.

Returns:

Tuple of current Alt and Az in degrees.

abstract async move_altaz(alt: float, az: float, **kwargs: Any) None[source]

Moves to given coordinates.

Parameters:
  • alt – Alt in deg to move to.

  • az – Az in deg to move to.

Raises:

MoveError – If device could not be moved.

IPointingHGS

class IPointingHGS

Bases: pyobs.interfaces.Interface

The module can move to Mu/Psi coordinates, usually combined with ITelescope.

abstract async get_hgs_lon_lat(**kwargs: Any) Tuple[float, float][source]

Returns current longitude and latitude position.

Returns:

Tuple of current lon, lat in degrees.

abstract async move_hgs_lon_lat(lon: float, lat: float, **kwargs: 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.

IPointingRaDec

class IPointingRaDec

Bases: pyobs.interfaces.Interface

The module can move to RA/Dec coordinates, usually combined with ITelescope.

abstract async get_radec(**kwargs: Any) Tuple[float, float][source]

Returns current RA and Dec.

Returns:

Tuple of current RA and Dec in degrees.

abstract async move_radec(ra: float, dec: float, **kwargs: Any) None[source]

Starts tracking on given coordinates.

Parameters:
  • ra – RA in deg to track.

  • dec – Dec in deg to track.

Raises:

MoveError – If device could not be moved.

IPointingSeries

class IPointingSeries

Bases: pyobs.interfaces.Interface

The module provides the interface for a device that initializes and finalizes a pointing series and adds points to it.

abstract async add_pointing_measure(**kwargs: Any) None[source]

Add a new measurement to the pointing series.

abstract async start_pointing_series(**kwargs: Any) str[source]

Start a new pointing series.

Returns:

A unique ID or filename, by which the series can be identified.

abstract async stop_pointing_series(**kwargs: Any) None[source]

Stop a pointing series.

IReady

class IReady

Bases: pyobs.interfaces.Interface

The module can be in a “not ready” state for science and need to be initialized in some way.

abstract async is_ready(**kwargs: Any) bool[source]

Returns the device is “ready”, whatever that means for the specific device.

Returns:

Whether device is ready

IRoof

class IRoof

Bases: pyobs.interfaces.IMotion

The module controls a roof.

IRotation

class IRotation

Bases: pyobs.interfaces.IMotion

The module controls a device that can rotate.

abstract async get_rotation() float[source]

Returns the current rotation angle.

abstract async set_rotation(angle: float, **kwargs: Any) None[source]

Sets the rotation angle to the given value in degrees.

abstract async track(ra: float, dec: float, **kwargs: Any) None[source]

Tracks the position angle of a rotator for an alt-az telescope.

IRunnable

class IRunnable

Bases: pyobs.interfaces.IAbortable

The module has some action that can be started remotely.

abstract async run(**kwargs: Any) None[source]

Perform module task

IRunning

class IRunning

Bases: pyobs.interfaces.Interface

The module can be running.

abstract async is_running(**kwargs: Any) bool[source]

Whether a service is running.

IScriptRunner

class IScriptRunner

Bases: pyobs.interfaces.Interface

The module can execute a script.

abstract async run_script(script: str, **kwargs: Any) None[source]

Run the given script.

Parameters:

script – Script to run.

ISpectrograph

class ISpectrograph

Bases: pyobs.interfaces.IAbortable

The module controls a camera.

abstract async abort(**kwargs: Any) None[source]

Aborts the current exposure.

Raises:

ValueError – If exposure could not be aborted.

abstract async get_exposure_progress(**kwargs: Any) float[source]

Returns the progress of the current exposure in percent.

Returns:

Progress of the current exposure in percent.

abstract async get_exposure_status(**kwargs: Any) pyobs.utils.enums.ExposureStatus[source]

Returns the current status of the camera, which is one of ‘idle’, ‘exposing’, or ‘readout’.

Returns:

Current status of camera.

abstract async grab_spectrum(broadcast: bool = True, **kwargs: Any) str[source]

Grabs a spectrum and returns reference.

Parameters:

broadcast – Broadcast existence of image.

Returns:

Name of image that was taken.

IStartStop

class IStartStop

Bases: pyobs.interfaces.IRunning

The module can be started and stopped.

abstract async start(**kwargs: Any) None[source]

Starts a service.

abstract async stop(**kwargs: Any) None[source]

Stops a service.

ISyncTarget

class ISyncTarget

Bases: pyobs.interfaces.Interface

The module can synchronize a target, e.g. via a telescope control software behinde an ITelescope.

abstract async sync_target(**kwargs: Any) None[source]

Synchronize device on current target.

ITelescope

class ITelescope

Bases: pyobs.interfaces.IMotion, pyobs.interfaces.IPointingAltAz, pyobs.interfaces.IPointingRaDec

The module controls a telescope.

ITemperatures

class ITemperatures

Bases: pyobs.interfaces.Interface

The module can return temperatures measured on some device.

abstract async get_temperatures(**kwargs: Any) Dict[str, float][source]

Returns all temperatures measured by this module.

Returns:

Dict containing temperatures.

IVideo

class IVideo

Bases: pyobs.interfaces.IImageGrabber

The module controls a video streaming device.

abstract async get_video(**kwargs: Any) str[source]

Returns path to video.

Returns:

Path to video.

IWeather

class IWeather

Bases: pyobs.interfaces.IStartStop

The module acts as a weather station.

abstract async get_current_weather(**kwargs: Any) Dict[str, Any][source]

Returns current weather.

Returns:

Dictionary containing entries for time, good, and sensor, with the latter being another dictionary with sensor information, which contain a value and a good flag.

abstract async get_sensor_value(station: str, sensor: pyobs.utils.enums.WeatherSensors, **kwargs: Any) Tuple[str, float][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:

Tuple of current value of given sensor or None and time of measurement or None.

abstract async get_weather_status(**kwargs: Any) Dict[str, Any][source]

Returns status of object in form of a dictionary. See other interfaces for details.

abstract async is_weather_good(**kwargs: Any) bool[source]

Whether the weather is good to observe.

IWindow

class IWindow

Bases: pyobs.interfaces.Interface

The camera supports windows, to be used together with ICamera.

abstract async get_full_frame(**kwargs: Any) Tuple[int, int, int, int][source]

Returns full size of CCD.

Returns:

Tuple with left, top, width, and height set.

abstract async get_window(**kwargs: Any) Tuple[int, int, int, int][source]

Returns the camera window.

Returns:

Tuple with left, top, width, and height set.

abstract 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.