panoptes.pocs.filterwheel package

Submodules

panoptes.pocs.filterwheel.filterwheel module

class panoptes.pocs.filterwheel.filterwheel.AbstractFilterWheel(name='Generic Filter Wheel', model='simulator', camera=None, filter_names=None, timeout=None, serial_number='XXXXXX', dark_position=None, focus_offsets=None, *args, **kwargs)[source]

Bases: PanBase

Base class for all filter wheels

Parameters:
  • name (str, optional) – name of the filter wheel

  • model (str, optional) – model of the filter wheel

  • camera (pocs.camera.*.Camera, optional) – camera that this filter wheel is associated with.

  • filter_names (list of str) – names of the filters installed at each filter wheel position

  • timeout (u.Quantity, optional) – maximum time to wait for a move to complete. Should be a Quantity with time units. If a numeric type without units is given seconds will be assumed. Default is None (no timeout).

  • serial_number (str, optional) – serial number of the filter wheel, default ‘XXXXXX’

  • dark_position (int or str, optional) – used to specify either a filter wheel position or a filter name that should be used when taking dark exposures with a camera that is not able to take internal darks.

  • focus_offsets (abc.Mapping, optional) – Dictionary of filter_name: focus offset pairs to apply when moving between filters. If None (default), no offsets are applied.

property camera

Reference to the Camera object that the FilterWheel is assigned to, if any. A filter wheel should only ever be assigned to one or zero Cameras!

abstract connect()[source]

Connect to filter wheel

property current_filter

Name of the filter in the current position

filter_name(position)[source]

Name of the filter in the given integer position.

property filter_names

List of the names of the filters installed in the filter wheel

property is_connected

Is the filterwheel available

abstract property is_moving

Is the filterwheel currently moving

property is_ready
property is_unidirectional
property model

Model of the filter wheel

move_to(new_position, blocking=False)[source]

Move the filter wheel to the given position.

The position can be expressed either as an integer, or as (part of) one of the names from the filter_names list. To allow filter names of the form ‘<filter band>_<serial number>’ to be selected by band only position can be a substring from the start of one of the names in the filter_names list, provided that this produces only one match.

Parameters:
  • new_position (int or str) – position to move to.

  • blocking (bool, optional) – If False (default) return immediately, if True block until the filter wheel move has been completed.

Returns:

Event that will be set to signal when the move has completed

Return type:

threading.Event

Raises:

ValueError – if new_position is not a valid position specifier for this filterwheel.

Examples

Substring matching is useful when the filter names contain both the type of filter and a serial number, e.g. the following selects a g band filter without having to know its full name.

>>> from panoptes.pocs.filterwheel.simulator import FilterWheel
>>> fw = FilterWheel(filter_names=['u_12', 'g_04', 'r_09', 'i_20', 'z_07'])
>>> fw_event = fw.move_to('g')
>>> fw_event.wait()
True
>>> fw.current_filter
'g_04'
move_to_dark_position(blocking=False)[source]

Move to filterwheel position for taking darks.

move_to_light_position(blocking=False)[source]

Return to last filterwheel position from before taking darks.

property n_positions

Number of positions in the filter wheel

property name

Name of the filter wheel

abstract property position

Current integer position of the filter wheel

property uid

A serial number of the filter wheel

panoptes.pocs.filterwheel.libefw module

class panoptes.pocs.filterwheel.libefw.EFWDriver(library_path=None, **kwargs)[source]

Bases: AbstractSDKDriver

calibrate(filterwheel_ID)[source]

Calibrate filterwheel with given ID.

close(filterwheel_ID)[source]

Close connection to filterwheel with given ID.

get_ID(filterwheel_index)[source]

Get integer ID of filterwheel with a given index.

get_SDK_version()[source]

Get the version for the SDK.

get_devices()[source]

Get connected device ‘UIDs’ and corresponding device nodes/handles/IDs.

EFW SDK has no way to access any unique identifier for connected filterwheels. Instead we construct an ID from combination of filterwheel name, number of positions and integer ID. This will probably not be deterministic, in general, and is only guaranteed to be unique between multiple filterwheels on a single computer.

get_direction(filterwheel_ID)[source]

Get current unidirectional/bidirectional setting of filterwheel with given ID.

get_num()[source]

Get the count of connected EFW filterwheels.

get_position(filterwheel_ID)[source]

Get current position of filterwheel with given ID.

get_product_ids()[source]

Get product IDs of supported(?) EFW filterwheels.

The SDK documentation does not explain what the product IDs returned by this function are, but from experiment and analogy with a similar function in the ASI camera SDK it appears this is a list of the product IDs of the filterwheels that the SDK supports, not the product IDs of the connected filterwheels. There appears to be no way to obtain the product IDs of the connected filterwheel(s).

get_property(filterwheel_ID)[source]

Get properties of filterwheel with given ID.

open(filterwheel_ID)[source]

Open connection to filterwheel with given ID.

set_direction(filterwheel_ID, unidirectional)[source]

Set unidrectional/bidirectional for filterwheel with given ID.

set_position(filterwheel_ID, position, move_event=None, timeout=None)[source]

Set position of filterwheel with given ID.

This function returns immediately after starting the move but spawns a thread to poll the filter wheel until the move completes (see _efw_poll method for details). This thread will log the result of the move, and optionally set a threading.Event to signal that it has completed.

Parameters:
  • filterwheel_ID (int) – integer ID of the filterwheel that is moving.

  • position (int) – position to move the filter wheel. Must an integer >= 0.

  • move_event (threading.Event, optional) – Event to set once the move is complete

  • timeout (u.Quantity, optional) – maximum time to wait for the move to complete. Should be a Quantity with time units. If a numeric type without units is given seconds will be assumed.

Raises:

panoptes.utils.error.PanError – raised if the driver returns an error starting the move.

class panoptes.pocs.filterwheel.libefw.EFWInfo[source]

Bases: Structure

Filterwheel info structure.

id

Structure/Union member

name

Structure/Union member

slot_num

Structure/Union member

class panoptes.pocs.filterwheel.libefw.ErrorCode(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

CLOSED = 9
END = -1
ERROR_STATE = 6
GENERAL_ERROR = 7
INVALID_ID = 2
INVALID_INDEX = 1
INVALID_VALUE = 3
MOVING = 5
NOT_SUPPORTED = 8
REMOVED = 4
SUCCESS = 0

panoptes.pocs.filterwheel.sbig module

class panoptes.pocs.filterwheel.sbig.FilterWheel(name='SBIG Filter Wheel', model='sbig', camera=None, filter_names=None, timeout=<Quantity 10. s>, serial_number=None, *args, **kwargs)[source]

Bases: AbstractFilterWheel

Class for SBIG filter wheels connected to the I2C port of an SBIG camera.

Parameters:
  • name (str, optional) – name of the filter wheel

  • model (str, optional) – model of the filter wheel

  • camera (pocs.camera.sbig.Camera) – camera that this filter wheel is associated with.

  • filter_names (list of str) – names of the filters installed at each filter wheel position

  • timeout (u.Quantity, optional) – maximum time to wait for a move to complete. Should be a Quantity with time units. If a numeric type without units is given seconds will be assumed. Default is 10 seconds.

  • serial_number (str) – serial number of the filter wheel

connect()[source]

Connect to filter wheel. Not called by __init__ because we need the camera to be connected first. The SBIG camera connect() method will call this once it’s OK to do so.

property firmware_version

Firmware version of the filter wheel

property is_moving

Is the filterwheel currently moving

property is_unidirectional
property position

Current integer position of the filter wheel

recalibrate()[source]

Reinitialises/recalibrates the filter wheel. It should not be necessary to call this as SBIG filter wheels initialise and calibrate themselves on power up.

panoptes.pocs.filterwheel.simulator module

class panoptes.pocs.filterwheel.simulator.FilterWheel(name='Simulated Filter Wheel', model='panoptes.pocs.filterwheel.simulator.FilterWheel', camera=None, filter_names=None, timeout=<Quantity 10. s>, serial_number=None, move_time=<Quantity 1. s>, unidirectional=True, *args, **kwargs)[source]

Bases: AbstractFilterWheel

Class for simulated filter wheels.

Parameters:
  • name (str, optional) – name of the filter wheel

  • model (str, optional) – model of the filter wheel

  • camera (pocs.camera.*.Camera, optional) – camera that this filter wheel is associated with.

  • filter_names (list of str) – names of the filters installed at each filter wheel position

  • timeout (u.Quantity, optional) – maximum time to wait for a move to complete. Should be a Quantity with time units. If a numeric type without units is given seconds will be assumed. Default is 10 seconds.

  • serial_number (str) – serial number of the filter wheel

  • move_time (astropy.units.Quantity, optional) – time to move the filter wheel by one position, optional, default 1 second.

  • unidirectional (bool, optional) – If True filterwheel will only rotate in one direction, if False filterwheel will move in either to get to the requested position via the shortest path. Default is True.

connect()[source]

Connect to the filter wheel

property is_moving

Is the filterwheel currently moving

property is_unidirectional
property position

Current integer position of the filter wheel

panoptes.pocs.filterwheel.zwo module

class panoptes.pocs.filterwheel.zwo.FilterWheel(name='ZWO Filter Wheel', model='zwo', camera=None, filter_names=None, timeout=<Quantity 10. s>, serial_number=None, library_path=None, unidirectional=True, device_name=None, initial_filter=None, *args, **kwargs)[source]

Bases: AbstractFilterWheel

Class for ZWO filter wheels.

Parameters:
  • name (str, optional) – name of the filter wheel.

  • model (str, optional) – model of the filter wheel.

  • camera (pocs.camera.camera.AbstractCamera) – camera that this filterwheel is associated with.

  • filter_names (list of str) – names of the filters installed at each filterwheel position.

  • timeout (u.Quantity, optional) – maximum time to wait for a move to complete. Should be a Quantity with time units. If a numeric type without units is given seconds will be assumed. Default is 10 seconds.

  • serial_number (str) – serial number of the filter wheel.

  • library_path (str, optional) – path to the library e.g. ‘/usr/local/lib/libASICamera2.so’.

  • unidirectional (bool, optional) – If True filterwheel will only rotate in one direction, if False filterwheel will move in either to get to the requested position via the shortest path. Default is True in order to improve repeatability.

  • device_name (str, optional) – If multiple filterwheels are connected to a single computer ‘device name’ (e.g. ‘EFW_7_0’) can be used to select the desired one. See docstring of pocs.filterwheel.libefw.EFWDriver.get_devices() for details.

  • initial_filter (str or int) – Name of filter (or integer position) to move to when initialising filter.

connect()[source]

Connect to filter wheel.

property is_moving

Is the filterwheel currently moving

property is_unidirectional
property position

Current integer position of the filter wheel

recalibrate()[source]

Reinitialises/recalibrates the filter wheel.

Module contents