pyastrobackend.RPC package

Submodules

pyastrobackend.RPC.Camera module

RPC Camera solution

class pyastrobackend.RPC.Camera.Camera(backend=None)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDevice, pyastrobackend.BaseBackend.BaseCamera

check_exposure()

Check if exposure is complete.

Returns

True if exposure complete.

Return type

bool

check_exposure_success()

Check if exposure was successful - only valid if check_exposure() returns True.

Returns

True if exposure complete.

Return type

bool

event_callback(event, *args)
get_binning()

Return pixel binning.

Returns

A tuple containing the X and Y binning.

Return type

(int, int)

get_camera_description()

Get the camera name - result depends on backend in use.

Returns

Description for camera device.

Return type

str

get_camera_gain()

Return gain for camera (not all cameras support).

Returns

Camera gain

Return type

float

get_camera_name()

Get the camera name - result depends on backend in use.

Returns

Name of camera device.

Return type

str

get_cooler_power()

Get cooler power use (percentage of maximum).

Returns

Cooler power level.

Return type

float

get_cooler_state()

Get cooler state.

Returns

True if cooler is on.

Return type

bool

get_current_temperature()

Return current camera temperature.

Returns

Temperature (C)

Return type

float

get_driver_info()

Get information about camera - result depends on backend in use.

Returns

Driver information about camera device.

Return type

str

get_driver_version()

Get version information about camera - result depends on backend in use.

Returns

Driver version information.

Return type

str

get_egain()

Return gain for camera as e- per ADU.

Returns

Camera gain

Return type

float

get_exposure_progress()

Get percentage completion of exposure. Use supports_progress() to test if driver supports this call.

Returns

Percentage completion of exposure.

Return type

int

get_frame()

Return region of interest (ROI) for image capture.

Returns

A tuple containing the upper left (X, Y) for ROI and width/height.

Return type

(int, int, int, int)

get_image_data()

Return image data from last image taken.

Returns

Image data or None if not available.

get_max_binning()

Return maximum pixel binning supported.

Returns

Maximum binning value.

Return type

int

get_pixelsize()

Return pixel size for camera sensor.

Returns

A tuple containing the X and Y pixel sizes.

Return type

(float, float)

get_settings()

Returns most settings for camera as dict. Useful for RPC drivers to reduce round trips.

Following keys (not all will get values on all drivers):
  • binning: (tuple) X, Y binning

  • framesize: (tuple) Width, height of sensor

  • roi: (tuple) Upper left corner and width, height of roi

  • pixelsize: (tuple) X, Y pixel size

  • egain: (float) Gain of camera in e-/ADU

  • camera_gain: (float) Internal gain of camera

  • camera_offset: (float) Internal offset of camera

  • camera_usbbandwidth: (int) Internal USB traffic settings of camera

  • camera_current_temperature: (float) Current temperature of camera

  • camera_target_temperature: (float) Target temperature of camera

  • cooler_state: (bool) Cooler on/off status

  • cooler_power: (float) Power (0-100%) level of cooler

Returns

Dictionary of settings

Return type

dict

get_size()

Return size of sensor in pixels.

Returns

A tuple containing the X and Y pixel sizes.

Return type

(int, int)

get_state()

Get camera state.

Returns

-1

Camera State unknown

0 Camera idle

2 Camera is busy (exposing)

5 Camera error

Rtype int

get_target_temperature()

Return current target camera cooler temperature.

Returns

Target cooler temperature (C)

Return type

float

save_image_data(path, overwrite=False)

Save image data from last image taken to file. NOTE: Not availale for all backends - check with supports_saveimage().

Parameters

filename – Filename for output file

Ptype str

Returns

Image data or None if not available.

set_binning(binx, biny)

Set pixel binning.

Parameters
  • binx – X binning

  • biny – Y binning

Returns

True on success.

Return type

bool

set_camera_gain(gain)

Set gain for camera (not all cameras support).

Returns

True on success.

Return type

bool

set_cooler_state(onoff)

Set cooler on or off

Parameters

onff – True to turn on camera.

Returns

True on success.

Return type

bool

set_frame(minx, miny, width, height)

Set region of interest (ROI) for image capture.

Parameters
  • minx – Leftmost extent of ROI.

  • miny – Uppermost extent of ROI.

  • width – Width of ROI.

  • height – Height of ROI.

Returns

True on success.

Return type

bool

set_target_temperature(temp_c)

Set target camera cooler temperature.

Parameters

temp_c – Target cooler temperature (C)

Returns

True on success.

Return type

bool

start_exposure(expos)

Start an exposure.

Parameters

expos – Exposure length (seconds)

Ptype float

Returns

True on success.

Return type

bool

stop_exposure()

Stop exposure.

Returns

True on success.

Return type

bool

supports_progress()

Check if exposure progress is supported.

Returns

True if progress info is available.

Return type

bool

supports_saveimage()

Test if drive has ‘saveimage’ method.

Returns

True if available, False otherwise.

Return type

bool

class pyastrobackend.RPC.Camera.RPCCameraThread(port, user_data, *args, **kwargs)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDeviceThread

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

pyastrobackend.RPC.FilterWheel module

RPC FilterWheel solution

class pyastrobackend.RPC.FilterWheel.FilterWheel(backend=None)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDevice, pyastrobackend.BaseBackend.BaseFilterWheel

event_callback(event, *args)
get_names()

Get names of all filter positions.

Returns

List of filter names.

Return type

list

get_num_positions()

Get number of filter positions.

Returns

Number of filter positions

Return type

int

get_position()

Get position of filter wheel. First position is 0!

Returns

Position of filter wheel.

Return type

int

get_position_name()

Get name of filter at current position.

Returns

Name of current filter.

Return type

str

is_moving()

Check if filter wheel is moving.

Returns

True if filter wheel is moving.

Return type

bool

set_position(pos)

Sends request to driver to move filter wheel position

This DOES NOT wait for filter to move into position!

Use is_moving() method to check if its done.

set_position_name(name)

Sends request to driver to move filter wheel position

This DOES NOT wait for filter to move into position!

Use is_moving() method to check if its done.

class pyastrobackend.RPC.FilterWheel.RPCFilterWheelThread(port, user_data, *args, **kwargs)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDeviceThread

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

pyastrobackend.RPC.Focuser module

RPC Focuser solution

class pyastrobackend.RPC.Focuser.Focuser(backend=None)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDevice, pyastrobackend.BaseBackend.BaseFocuser

event_callback(event, *args)
get_absolute_position()

Get absolute position of focuser.

Returns

Absolute position of focuser.

Return type

int

get_current_temperature()

Get temperature from focuser.

Returns

Temperature (C).

Return type

float

get_max_absolute_position()

Get maximum possible absolute position of focuser.

Returns

Absolute maximum possible position of focuser.

Return type

int

is_moving()

Check if focuser is moving.

Returns

True if focuser is moving.

Return type

bool

move_absolute_position(abspos)

Move focuser to absolute position.

Parameters

abspos – Target position for focuser.

Returns

True on success.

Return type

bool

stop()

Stop focuser motion..

Returns

True on success.

Return type

bool

class pyastrobackend.RPC.Focuser.RPCFocuserThread(port, user_data, *args, **kwargs)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDeviceThread

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

pyastrobackend.RPC.Mount module

RPC Mount solution

class pyastrobackend.RPC.Mount.Mount(backend=None)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDevice, pyastrobackend.BaseBackend.BaseMount

abort_slew()

Abort slew.

Returns

True on success.

Return type

bool

can_park()

Test if a mount can park.

Returns

True if mount can park.

Return type

bool

event_callback(event, *args)
get_pier_side()

Returns backend specific pier side information. NOTE: NOT recommended for use as ASCOM and INDI may give different results for different drivers - not tested extensively at all so use with caution.

Returns

‘EAST’, ‘WEST’ or None if unknown.

get_position_altaz()

Returns tuple of (alt, az) in degrees

get_position_radec()

Returns tuple of (ra, dec) with ra in decimal hours and dec in degrees

get_side_physical()

Get physical side of mount. NOTE: NOT tested extensively with all INDI drivers so it is recommended to test results for ‘normal’ and ‘through the pole’ positions on both side of the pier with a given mount driver!

Returns

‘EAST’, ‘WEST’ or None if unknown.

get_side_pointing()

Get side of meridian where mount is pointing. NOTE may not be same as result from get_side_physical() if counterweights are pointing up, etc! NOTE: NOT tested extensively with all INDI drivers so it is recommended to test results for ‘normal’ and ‘through the pole’ positions on both side of the pier with a given mount driver!

Returns

‘EAST’, ‘WEST’ or None if unknown.

get_tracking()

Get mount tracking state.

Returns

True if tracking.

Return type

bool

is_parked()

Test if mount is parked.

Returns

True if mount is parked.

Return type

bool

is_slewing()

Test if mount is slewing.

Returns

True if mount is slewing.

Return type

bool

park()

Park mount.

Returns

True on success.

Return type

bool

send_radec_command(cmd, ra, dec)
set_tracking(onoff)

Enable/disable mount tracking.

Parameters

onoff – Flag to turn tracking on/off.

Returns

True on success.

Return type

bool

slew(ra, dec)

Slew to ra/dec with ra in decimal hours and dec in degrees

sync(ra, dec)

Sync to ra/dec with ra in decimal hours and dec in degrees

unpark()

Unark mount.

Returns

True on success.

Return type

bool

class pyastrobackend.RPC.Mount.RPCMountThread(port, user_data, *args, **kwargs)

Bases: pyastrobackend.RPC.RPCDeviceBase.RPCDeviceThread

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

pyastrobackend.RPC.RPCDeviceBase module

RPC Device solution

class pyastrobackend.RPC.RPCDeviceBase.RPCDevice(backend=None)

Bases: object

connect(name)
disconnect()
event_callback(event, *args)
get_list_value(value_method, value_key)
get_scalar_value(value_method, value_key, value_types)
has_chooser()
is_connected()
send_command(command, params={})
send_server_request(req, paramsdict=None)
set_scalar_value(value_method, value_key, value)
show_chooser(last_choice)
wait_for_response(reqid, timeout=90)
class pyastrobackend.RPC.RPCDeviceBase.RPCDeviceThread(port, user_data, *args, **kwargs)

Bases: threading.Thread

This constructor should always be called with keyword arguments. Arguments are:

group should be None; reserved for future extension when a ThreadGroup class is implemented.

target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.

name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.

args is the argument tuple for the target invocation. Defaults to ().

kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.

If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.

check_rpc_command_status(req_id)

See if response available for request id req_id and returns it. Removes from list of requests.

close()
emit(event, *args)
initialize()
populate_buffer()

Read in any new data into buffer.

queue_rpc_command(cmd, argsdict)

Accept rpc command and dictionary of arguments and creates the json request dictionary and submits to command queue for rpc client thread.

read_next_json_block()

read terminated JSON blocks

run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

send_polling_response()
server_disconnected()

Module contents