panoptes.pocs.camera package¶
Subpackages¶
- panoptes.pocs.camera.gphoto package
- Submodules
- panoptes.pocs.camera.gphoto.base module
AbstractGPhotoCameraAbstractGPhotoCamera.command()AbstractGPhotoCamera.connect()AbstractGPhotoCamera.cooling_powerAbstractGPhotoCamera.get_command_result()AbstractGPhotoCamera.get_property()AbstractGPhotoCamera.gphoto_file_download()AbstractGPhotoCamera.is_exposingAbstractGPhotoCamera.load_properties()AbstractGPhotoCamera.process_exposure()AbstractGPhotoCamera.set_properties()AbstractGPhotoCamera.set_property()AbstractGPhotoCamera.start_tether()AbstractGPhotoCamera.target_temperatureAbstractGPhotoCamera.temperatureAbstractGPhotoCamera.uid
- panoptes.pocs.camera.gphoto.canon module
- panoptes.pocs.camera.gphoto.remote module
- Module contents
- panoptes.pocs.camera.simulator package
Submodules¶
panoptes.pocs.camera.camera module¶
Abstract camera base implementation used by POCS camera drivers.
Defines the AbstractCamera class providing common behavior and interfaces for camera drivers (simulator and hardware). Subclasses implement hardware-specific connect/readout logic while reusing orchestration, FITS header creation, and exposure management provided here.
- class panoptes.pocs.camera.camera.AbstractCamera(name='Generic Camera', model='simulator', port=None, primary=False, *args, **kwargs)[source]¶
Bases:
PanBaseBase class for all cameras.
- filter_type¶
Type of filter attached to camera. If a filterwheel is present this will return the filterwheel.current_filter property, otherwise it will return the value of the filter_type keyword argument, or if that argument was not given it it will query the camera driver, e.g. ‘M’ for unfiltered monochrome camera, ‘RGGB’ for Bayer matrix colour camera.
- Type:
- filter_wheel¶
Filter wheel for the camera, default None.
- Type:
`panoptes.pocs.filterwheel.AbstractFilterWheel`|None
- temperature¶
Current temperature of the image sensor.
- Type:
astropy.units.Quantity
- target_temperature¶
image sensor cooling target temperature.
- Type:
astropy.units.Quantity
- temperature_tolerance¶
tolerance for image sensor temperature.
- Type:
astropy.units.Quantity
- cooling_power¶
Current image sensor cooling power level in percent.
- Type:
astropy.unit.Quantity
- egain¶
Image sensor gain in e-/ADU as reported by the camera.
- Type:
astropy.units.Quantity
- bitdepth¶
ADC bit depth in bits.
- Type:
astropy.units.Quantity
- timeout¶
max time to wait after exposure before TimeoutError.
- Type:
astropy.units.Quantity
Notes
The port parameter is not used by SBIG or ZWO cameras, and is deprecated for FLI cameras. For these cameras serial_number should be passed to the constructor instead. For SBIG and FLI this should simply be the serial number engraved on the camera case, whereas for ZWO cameras this should be the 8 character ID string previously saved to the camera firmware. This can be done using ASICAP, or panoptes.pocs.camera.libasi.ASIDriver.set_ID().
- autofocus(seconds=None, focus_range=None, focus_step=None, cutout_size=None, keep_files=None, take_dark=None, merit_function='vollath_F4', merit_function_kwargs=None, mask_dilations=None, coarse=False, make_plots=None, blocking=False, *args, **kwargs)[source]¶
Focuses the camera using the specified merit function. Optionally performs a coarse focus to find the approximate position of infinity focus, which should be followed by a fine focus before observing.
- Parameters:
seconds (scalar, optional) – Exposure time for focus exposures, if not specified will use value from config.
focus_range (2-tuple, optional) – Coarse & fine focus sweep range, in encoder units. Specify to override values from config.
focus_step (2-tuple, optional) – Coarse & fine focus sweep steps, in encoder units. Specify to override values from config.
cutout_size (int, optional) – Size of square central region of image to use, default 500 x 500 pixels.
keep_files (bool, optional) – If True will keep all images taken during focusing. If False (default) will delete all except the first and last images from each focus run.
take_dark (bool, optional) – If True will attempt to take a dark frame before the focus run, and use it for dark subtraction and hot pixel masking, default True.
merit_function (str/callable, optional) – Merit function to use as a focus metric, default vollath_F4.
merit_function_kwargs (dict or None, optional) – Dictionary of additional keyword arguments for the merit function.
mask_dilations (int, optional) – Number of iterations of dilation to perform on the saturated pixel mask (determine size of masked regions), default 10
coarse (bool, optional) – Whether to perform a coarse focus, otherwise will perform a fine focus. Default False.
(bool (make_plots) – Whether to write focus plots to images folder, default behaviour is to check the focuser autofocus_make_plots attribute.
optional – Whether to write focus plots to images folder, default behaviour is to check the focuser autofocus_make_plots attribute.
blocking (bool, optional) – Whether to block until autofocus complete, default False.
- Returns:
Event that will be set when autofocusing is complete
- Return type:
- Raises:
ValueError – If invalid values are passed for any of the focus parameters.
- property bit_depth¶
ADC bit depth.
- property can_take_internal_darks¶
True if the camera can take internal dark exposures. This will be true of cameras that have an internal mechanical shutter and can be commanded to keep that shutter closed during the exposure. For cameras that either lack a mechanical shutter or lack the option to keep it closed light must be kept out of the camera during dark exposures by other means, e.g. an opaque blank in a filterwheel, a lens cap, etc.
- abstractmethod connect()[source]¶
Connect to the underlying camera hardware.
Implementations should establish any required SDK/driver connections and populate camera capabilities (e.g., cooling availability) without starting an exposure.
- Returns:
None
- property cooling_enabled¶
Whether the camera’s sensor cooling is currently enabled.
- Returns:
True if cooling is enabled.
- Return type:
Note
This only needs to be implemented for cameras which have cooled image sensors, not for those that don’t (e.g. DSLRs).
- property cooling_power¶
Get current power level of the camera’s image sensor cooling system (typically as a percentage of the maximum).
Note: this only needs to be implemented for cameras which have cooled image sensors, not for those that don’t (e.g. DSLRs).
- property egain¶
Image sensor gain in e-/ADU as reported by the camera.
- property exposure_error¶
Error message from the most recent exposure or None, if there was no error.
- property file_extension¶
File extension for images saved by camera
- property filter_type¶
Image sensor filter type (e.g. ‘RGGB’) or name of the current filter (e.g. ‘g2_3’)
- get_cutout(seconds, file_path, cutout_size, keep_file=False, *args, **kwargs)[source]¶
Takes an image and returns a thumbnail cutout.
Takes an image, grabs the data, deletes the FITS file and returns a cutout from the centre of the image.
- Parameters:
seconds (astropy.units.Quantity) – exposure time, Quantity or numeric type in seconds.
file_path (str) – path to (temporarily) save the image file to.
cutout_size (int) – size of the square region of the centre of the image to return.
keep_file (bool, optional) – if True the image file will be deleted, if False it will be kept.
*args – passed to the take_exposure method
**kwargs –
passed to the take_exposure method
- property has_filterwheel¶
Return True if the camera has a filterwheel, False if not.
- property has_focuser¶
Return True if the camera has a focuser, False if not.
- property is_connected¶
Is the camera available vai gphoto2
- property is_cooled_camera¶
Whether the camera has sensor cooling capability.
- Returns:
True if the camera supports cooling.
- Return type:
- property is_exposing¶
True if an exposure is currently under way, otherwise False.
- property is_observing¶
True if an observation is currently under, otherwise False.
- property is_ready¶
True if camera is ready to start another exposure, otherwise False.
- property is_temperature_stable¶
True if image sensor temperature is stable, False if not.
See also: See temperature_tolerance for more information about the temperature stability. An uncooled camera, or cooled camera with cooling disabled, will always return False.
- process_exposure(metadata, **kwargs)[source]¶
Processes the exposure.
This checks if the file exists and if so calls _do_process_exposure.
- Parameters:
metadata (dict) – Header metadata saved for the image.
- Raises:
FileNotFoundError – If the FITS file isn’t at the specified location.
- property readiness¶
Dictionary detailing the readiness of the camera system to take an exposure.
- property readout_time¶
Readout time for the camera in seconds
- take_exposure(seconds=<Quantity 1. s>, filename=None, metadata=None, dark=False, blocking=False, timeout=<Quantity 10. s>, *args, **kwargs) Thread[source]¶
Take an exposure for given number of seconds and saves to provided filename.
- Parameters:
seconds (u.second, optional) – Length of exposure.
filename (str, optional) – Image is saved to this filename.
metadata (dict, optional) – Add key/value as FITS header. Does not support nested dicts.
dark (bool, optional) – Exposure is a dark frame, default False. On cameras that support taking dark frames internally (by not opening a mechanical shutter) this will be done, for other cameras the light must be blocked by some other means. In either case setting dark to True will cause the IMAGETYP FITS header keyword to have value ‘Dark Frame’ instead of ‘Light Frame’. Set dark to None to disable the IMAGETYP keyword entirely.
blocking (bool, optional) – If False (default) returns immediately after starting the exposure, if True will block until it completes and file exists.
timeout (astropy.Quantity) – The timeout to use for the exposure, default 10 seconds. The timeout gets added to the seconds and the self.readout_time to get the total timeout for the exposure. If the exposure takes longer than this then a panoptes.utils.error.Timeout exception will be raised.
- Returns:
The readout thread, which joins when readout has finished.
- Return type:
- Raises:
error.PanError – If camera is not connected.
error.Timeout – If the exposure takes longer than total timeout to complete.
- take_observation(observation, headers=None, filename=None, blocking=False, **kwargs) dict[source]¶
Take an observation
- Gathers various header information, sets the file path, and calls
take_exposure. Also creates a threading.Event object and a threading.Thread object. The Thread calls process_exposure after the exposure had completed and the Event is set once process_exposure finishes.
- Parameters:
observation (Observation) – Object describing the observation
headers (dict or Header, optional) – Header data to be saved along with the file.
filename (str, optional) – pass a filename for the output FITS file to override the default file naming system.
blocking (bool) – If method should wait for observation event to be complete before returning, default False.
**kwargs (dict) – Optional keyword arguments (exptime, dark)
- Returns:
The metadata from the event.
- Return type:
- property target_temperature¶
Target temperature for the camera’s image sensor cooling control.
- Returns:
The target temperature.
- Return type:
astropy.units.Quantity
Note
This only needs to be implemented for cameras which have cooled image sensors, not for those that don’t (e.g. DSLRs).
- property temperature¶
Get current temperature of the camera’s image sensor.
Note: this only needs to be implemented for cameras which can provided this information, e.g. those with cooled image sensors.
- property temperature_tolerance¶
Tolerance for image sensor temperature stability.
If the image sensor temperature differs from the target temperature by more than the temperature tolerance then the temperature is not considered stable (by is_temperature_stable) and, for cooled cameras, is_ready will report False.
- Returns:
Allowed deviation from target temperature.
- Return type:
astropy.units.Quantity
- property uid¶
Return unique identifier for camera.
- property waiting_for_readout¶
True if the most recent readout has not finished. Should be set in write_fits
- write_fits(data, header, filename)[source]¶
Write the FITS file.
This is a thin-wrapper around the fits_utils.write_fits method that marks the readout as complete.
- Parameters:
data – Numpy array-like image data to write to disk.
header – FITS header object or dict-like metadata.
filename (str | os.PathLike) – Destination file path for the FITS file.
- Returns:
None
panoptes.pocs.camera.fli module¶
FLI camera driver implementation for POCS.
Provides a Camera class backed by the libfli SDK via FLIDriver, implementing the AbstractSDKCamera interface for cooled FLI CCD/CMOS cameras.
- class panoptes.pocs.camera.fli.Camera(name='FLI Camera', target_temperature=<Quantity 25. deg_C>, *args, **kwargs)[source]¶
Bases:
AbstractSDKCameraFLI camera implementation backed by the libfli SDK.
This class wraps FLIDriver calls to provide cooling, exposure, and readout control consistent with the AbstractSDKCamera interface.
- connect()[source]¶
Connect to FLI camera.
Gets a ‘handle’, serial number and specs/capabilities from the driver
- property cooling_enabled¶
Whether the camera’s cooling is enabled.
- Returns:
Always True for FLI cameras; cooling cannot be disabled.
- Return type:
- property cooling_power¶
Current power level of the camera’s image sensor cooling system (as a percentage of the maximum).
- property is_exposing¶
True if an exposure is currently under way, otherwise False
- property target_temperature¶
Current value of the target temperature for the camera’s image sensor cooling control.
Can be set by assigning an astropy.units.Quantity.
- property temperature¶
Current temperature of the camera’s image sensor.
panoptes.pocs.camera.libasi module¶
ZWO ASI camera SDK bindings used by POCS.
This module provides a thin ctypes-based wrapper (ASIDriver) around the ASICamera2 shared library, exposing the subset of functions required by POCS for camera discovery, configuration, exposures, and readout.
- class panoptes.pocs.camera.libasi.ASIDriver(library_path=None, **kwargs)[source]¶
Bases:
AbstractSDKDriverctypes-based wrapper around the ZWO ASICamera2 SDK.
Provides convenience helpers to enumerate devices, open/close cameras, control settings, and perform exposures/video readout in a Pythonic way for use by higher-level POCS camera classes.
- disable_dark_subtract(camera_ID)[source]¶
Disable dark subtraction.
May need to call this as dark current subtraction settings persist in the registry on Windows.
- enable_dark_subtract(camera_ID, dark_file_path)[source]¶
Enable dark subtraction (not implemented).
You almost certainly wouldn’t want to use this as it only works with images taken in RGB8 format and only with dark frames saved as .BMP files. Far better to do dark subtraction in post-processing.
- get_ID(camera_ID)[source]¶
Get string ID from firmware for the camera with given integer ID
The saved ID is an array of 8 unsigned chars for some reason.
- get_camera_supported_mode(camera_ID)[source]¶
Get supported trigger modes for camera with given integer ID.
- get_control_caps(camera_ID)[source]¶
Gets the details of all the controls supported by the camera with given integer ID
- get_control_value(camera_ID, control_type)[source]¶
Gets the value of the control control_type from camera with given integer ID
- get_devices() dict[str, int][source]¶
Gets currently connected camera info.
- Returns:
- All currently connected camera serial numbers with corresponding integer
camera IDs.
- Return type:
Notes
If a camera does not have a serial number it will attempt to fall back to string ID. Cameras with neither serial number nor string ID will be left out of the dictionary as they have no unique identifier.
- get_exposure_data(camera_ID, width, height, image_type)[source]¶
Get image data from exposure on camera with given integer ID
- get_exposure_status(camera_ID)[source]¶
Get status of current exposure on camera with given integer ID
- get_num_of_controls(camera_ID)[source]¶
Gets the number of control types supported by the camera with given integer ID
- get_roi_format(camera_ID)[source]¶
Get the ROI size and image format setting for camera with given integer ID
- get_serial_number(camera_ID) str[source]¶
Get serial number of the camera with given integer ID.
The serial number is an array of 8 unsigned chars, the same as string ID, but it is interpreted differently. It is displayed in ASICAP as a 16 digit hexadecimal number, so we will convert it the same 16 character string representation.
- get_start_position(camera_ID)[source]¶
Get position of the upper left corner of the ROI for camera with given integer ID
- Parameters:
camera_ID (int) – integer ID of the camera
- Returns:
- x, y coordinates of the upper left
corner of the ROI. Note, these are in binned pixels.
- Return type:
(astropy.units.Quantity, astropy.units.Quantity)
- get_trigger_output_io_conf(camera_ID)[source]¶
Get external trigger configuration of the camera with given integer ID.
- get_video_data(camera_ID, width, height, image_type, timeout)[source]¶
Get the image data from the next available video frame
- pulse_guide_off(camera_ID, direction)[source]¶
Turn off PulseGuide on ST4 port of given camera in given direction.
- pulse_guide_on(camera_ID, direction)[source]¶
Turn on PulseGuide on ST4 port of given camera in given direction.
- send_soft_trigger(camera_ID, start_stop_signal)[source]¶
Send out a soft trigger on camera with given integer ID.
- set_ID(camera_ID, string_ID)[source]¶
Save string ID to firmware of camera with given integer ID
The saved ID is an array of 8 unsigned chars for some reason. To preserve some sanity this method takes an 8 byte UTF-8 string as input.
- set_control_value(camera_ID, control_type, value)[source]¶
Sets the value of the control control_type on camera with given integer ID
- set_roi_format(camera_ID, width, height, binning, image_type)[source]¶
Set the ROI size and image format settings for the camera with given integer ID
- set_start_position(camera_ID, start_x, start_y)[source]¶
Set position of the upper left corner of the ROI for camera with given integer ID
- class panoptes.pocs.camera.libasi.BayerPattern(*values)[source]¶
Bases:
IntEnumBayer filter type
- BG = 1¶
- GB = 3¶
- GR = 2¶
- RG = 0¶
- class panoptes.pocs.camera.libasi.CameraInfo[source]¶
Bases:
StructureCamera info structure
- bayer_pattern¶
Structure/Union member
- bit_depth¶
Structure/Union member
- camera_ID¶
Structure/Union member
- e_per_adu¶
Structure/Union member
- has_ST4_port¶
Structure/Union member
- has_cooler¶
Structure/Union member
- has_mechanical_shutter¶
Structure/Union member
- is_USB3_camera¶
Structure/Union member
- is_USB3_host¶
Structure/Union member
- is_color_camera¶
Structure/Union member
- is_trigger_camera¶
Structure/Union member
- max_height¶
Structure/Union member
- max_width¶
Structure/Union member
- name¶
Structure/Union member
- pixel_size¶
Structure/Union member
- supported_bins¶
Structure/Union member
- supported_video_format¶
Structure/Union member
- unused¶
Structure/Union member
- class panoptes.pocs.camera.libasi.CameraMode(*values)[source]¶
Bases:
IntEnumCamera status
- END = -1¶
- NORMAL = 0¶
- TRIG_FALL_EDGE = 3¶
- TRIG_HIGH_LEVEL = 5¶
- TRIG_LOW_LEVEL = 6¶
- TRIG_RISE_EDGE = 2¶
- TRIG_SOFT_EDGE = 1¶
- TRIG_SOFT_LEVEL = 4¶
- class panoptes.pocs.camera.libasi.ControlCaps[source]¶
Bases:
StructureStructure for caps (limits) on allowable parameter values for each camera control
- control_type¶
Structure/Union member
- default_value¶
Structure/Union member
- description¶
Structure/Union member
- is_auto_supported¶
Structure/Union member
- is_writable¶
Structure/Union member
- max_value¶
Structure/Union member
- min_value¶
Structure/Union member
- name¶
Structure/Union member
- unused¶
Structure/Union member
- class panoptes.pocs.camera.libasi.ControlType(*values)[source]¶
Bases:
IntEnumControl types
- ANTI_DEW_HEATER = 21¶
- AUTO_MAX_BRIGHTNESS = 12¶
- AUTO_MAX_EXP = 11¶
- AUTO_MAX_GAIN = 10¶
- AUTO_TARGET_BRIGHTNESS = 12¶
- BANDWIDTHOVERLOAD = 6¶
- BRIGHTNESS = 5¶
- COOLER_ON = 17¶
- COOLER_POWER_PERC = 15¶
- EXPOSURE = 1¶
- FAN_ON = 19¶
- FLIP = 9¶
- GAIN = 0¶
- GAMMA = 2¶
- HARDWARE_BIN = 13¶
- HIGH_SPEED_MODE = 14¶
- MONO_BIN = 18¶
- OFFSET = 5¶
- OVERCLOCK = 7¶
- PATTERN_ADJUST = 20¶
- TARGET_TEMP = 16¶
- TEMPERATURE = 8¶
- WB_B = 4¶
- WB_R = 3¶
- class panoptes.pocs.camera.libasi.ErrorCode(*values)[source]¶
Bases:
IntEnumError codes
- BUFFER_TOO_SMALL = 13¶
- CAMERA_CLOSED = 4¶
- CAMERA_REMOVED = 5¶
- END = 18¶
- EXPOSURE_IN_PROGRESS = 15¶
- GENERAL_ERROR = 16¶
- INVALID_CONTROL_TYPE = 3¶
- INVALID_FILEFORMAT = 7¶
- INVALID_ID = 2¶
- INVALID_IMGTYPE = 9¶
- INVALID_INDEX = 1¶
- INVALID_MODE = 17¶
- INVALID_PATH = 6¶
- INVALID_SEQUENCE = 12¶
- INVALID_SIZE = 8¶
- OUTOF_BOUNDARY = 10¶
- SUCCESS = 0¶
- TIMEOUT = 11¶
- VIDEO_MODE_ACTIVE = 14¶
- class panoptes.pocs.camera.libasi.ExposureStatus(*values)[source]¶
Bases:
IntEnumExposure status codes
- FAILED = 3¶
- IDLE = 0¶
- SUCCESS = 2¶
- WORKING = 1¶
- class panoptes.pocs.camera.libasi.FlipStatus(*values)[source]¶
Bases:
IntEnumFlip status
- BOTH = 3¶
- HORIZ = 1¶
- NONE = 0¶
- VERT = 2¶
- class panoptes.pocs.camera.libasi.GuideDirection(*values)[source]¶
Bases:
IntEnumGuider direction
- EAST = 2¶
- NORTH = 0¶
- SOUTH = 1¶
- WEST = 3¶
- class panoptes.pocs.camera.libasi.ID[source]¶
Bases:
StructureFixed-length (8-byte) string identifier structure used by the SDK.
- id¶
Structure/Union member
- class panoptes.pocs.camera.libasi.ImgType(*values)[source]¶
Bases:
IntEnumSupported video format
- END = -1¶
- RAW16 = 2¶
- RAW8 = 0¶
- RGB24 = 1¶
- Y8 = 3¶
panoptes.pocs.camera.libfli module¶
Low level interface to the FLI library
Reproduces in Python (using ctypes) the C interface provided by FLI’s library.
- class panoptes.pocs.camera.libfli.FLIDriver(library_path=None, **kwargs)[source]¶
Bases:
AbstractSDKDriverctypes-based wrapper for the FLI libfli SDK used by cooled FLI cameras.
Exposes a subset of the FLIDriver C API to Python with simple argument and return value handling, suitable for use by higher-level camera classes.
- FLIClose(handle)[source]¶
Close a handle to an FLI device.
- Parameters:
handle (ctypes.c_long) – handle to close
- FLIExposeFrame(handle)[source]¶
Expose a frame for a given camera.
This function exposes a frame according the settings (image area, exposure time, binning, etc.) of the camera. The settings must have been previously set to valid values using the appropriate FLISet* methods. This function is non-blocking and returns once the exposure has stated.
- Parameters:
handle (ctypes.c_long) – handle of the camera to start the exposure on.
- FLIGetArrayArea(handle)[source]¶
Get the array area of the give camera.
This function finds the total area of the CCD array for a given camera. This area is specified in terms of an upper left point and a lower right point.
- Parameters:
handle (ctypes.c_long) – handle of the camera to get the array area of.
- FLIGetCoolerPower(handle)[source]¶
Get the cooler power level for a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera to get the cooler power of.
- Returns:
cooler power, in percent.
- Return type:
- FLIGetExposureStatus(handle)[source]¶
Get the remaining exposure time of a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera to get the remaining exposure time of.
- Returns:
remaining exposure time
- Return type:
astropy.units.Quantity
- FLIGetFWRevision(handle)[source]¶
Get firmware revision of a given device
- Parameters:
handle (ctypes.c_long) – handle of the camera device to get the firmware revision of.
- Returns:
firmware revision of the camera
- Return type:
- FLIGetHWRevision(handle)[source]¶
Get hardware revision of a given device
- Parameters:
handle (ctypes.c_long) – handle of the camera device to get the hardware revision of.
- Returns:
hardware revision of the cameras
- Return type:
- FLIGetModel(handle)[source]¶
Get the model of a given device.
- Parameters:
handle (ctypes.c_long) – handle of the device to get the model of.
- Returns:
model of the device
- Return type:
string
- FLIGetPixelSize(handle)[source]¶
Get the dimensions of a pixel in the array of a given device.
- Parameters:
handle (ctypes.c_long) – handle of the device to find the pixel size of.
- Returns:
(x, y) dimensions of a pixel.
- Return type:
astropy.units.Quantity
- FLIGetSerialString(handle)[source]¶
Get the serial string of a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera device to get the serial strong of.
- Returns:
serial string of the camera
- Return type:
string
- FLIGetTemperature(handle)[source]¶
Get the temperature of a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera device to get the temperature of.
- Returns:
temperature of the camera cold finger in degrees Celsius
- Return type:
astropy.units.Quantity
- FLIGetVisibleArea(handle)[source]¶
Get the visible array area of the give camera.
This function finds the visible area of the CCD array for a given camera. This area is specified in terms of an upper left point and a lower right point.
- Parameters:
handle (ctypes.c_long) – handle of the camera to get the array area of.
- FLIGrabFrame(handle, width, height)[source]¶
Grabs an image frame from a given camera.
This function grabs the entire image frame from the specified camera and returns it as a numpy array. The width and height of the image must be specified. The width and height should be consistent with the call to FLISetImageArea() that preceded the call to FLIExposeFrame(). This function should not be called until the exposure is complete, which can be confirmed with FLIGetExposureStatus().
- Parameters:
handle (ctypes.c_long) – handle of the camera to grab a frame from.
width (int) – width of the image frame in pixels
height (int) – height of the image frame in pixels
- Returns:
image from the camera
- Return type:
- FLIGrabRow(handle, width)[source]¶
Grabs a row of image data from a given camera.
This function grabs the next available row of imae data from the specificed camera and returns it as a nupt array. The widht of the row must be specified. The width should be consistent with the call to FLISetImageArea() that preceded the call to FLIExposeFrame(). This function should not be called until the exposure is complete, which can be confirmed with FLIGetExposureStatus.
- Parameters:
handle (ctypes.c_long) – handle of the camera to grab a row from.
width (int) – width of the image row in pixelStart
- Returns:
row of image data
- Return type:
- FLIList(interface_type=2, device_type=256)[source]¶
List available devices.
This function returns a list of available FLI devices, including the device port and model name.
- Parameters:
interface_type (int, optional) – interface to search for connected devices. Valid values are libfli.FLIDOMAIN_USB (default), FLIDOMAIN_PARALLEL_PORT, FLIDOMAIN_SERIAL, FLIDOMAIN_SERIAL_1200, FLIDOMAIN_SERIAL_19200, FLIDOMAIN_INET.
device_types (int, optional) – device type to search for. Valid values are libfli.FLIDEVICE_CAMERA (default), FLIDEVICE_FILTERWHEEL, FLIDEVICE_HS_FILTERWHEEL, FLIDEVICE_FOCUSER, FLIDEVICE_ENUMERATE_BY_CONNECTION, FLIDEVICE_RAW.
- Returns:
(port, model name) for each available device
- Return type:
list of tuples
- FLIOpen(port, interface_type=2, device_type=256)[source]¶
Get a handle to an FLI device.
This function requires the port, interface type and device type of the requested device. Valid ports can be obtained with the FLIList() method.
- Parameters:
port (str) – port that the device is connected to, e.g. /dev/fliusb0
interface_type (int, optional) – interface type of the requested device. Valid values are libfli.FLIDOMAIN_USB (default), FLIDOMAIN_PARALLEL_PORT, FLIDOMAIN_SERIAL, FLIDOMAIN_SERIAL_1200, FLIDOMAIN_SERIAL_19200, FLIDOMAIN_INET.
device_type (int, optional) – device type of the requested device. Valid values are libfli.FLIDEVICE_CAMERA (default), FLIDEVICE_FILTERWHEEL, FLIDEVICE_HS_FILTERWHEEL, FLIDEVICE_FOCUSER, FLIDEVICE_ENUMERATE_BY_CONNECTION, FLIDEVICE_RAW.
- Returns:
an opaque handle used by library functions to refer to FLI hardware
- Return type:
- FLISetExposureTime(handle, exposure_time)[source]¶
Set the exposure time for a camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera to set the exposure time of.
exposure_time (u.Quantity) – required exposure time. A simple numeric type can be given instead of a Quantity, in which case the units are assumed to be seconds.
- FLISetFrameType(handle, frame_type)[source]¶
Set the frame type for a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera to set the frame type of.
frame_type (int) – frame type. Valid values are libfli.FLI_FRAME_TYPE_NORMAL,
FLI_FRAME_TYPE_DARK
FLI_FRAME_TYPE_FLOOD
FLI_FRAME_TYPE_RBI_FLUSH.
- FLISetHBin(handle, bin_factor)[source]¶
Set the horizontal bin factor for a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera to set the horizontal bin factor for.
bin_factor (int) – horizontal bin factor. The valid range is from 1 to 16 inclusive.
- FLISetImageArea(handle, upper_left, lower_right)[source]¶
Set the image area for a given camera.
This function sets the image area to an area specified in terms of an upperleft point and a lower right point. Note that the lower right point coordinate must take into account the horizontal and vertical bin factor setttings, but the upper left coordinate is absolute.
- Parameters:
handle (ctypes.c_long) – handle of the camera to set the image area of.
upper_left (int, int) – (x, y) coordinate of upper left point
lower_right (int, int) – (x, y) coordinate of lower right point
- FLISetNFlushes(handle, n_flushes)[source]¶
Set the number of flushes for a given camera.
This function sets the number of the times the CCD array of the camera is flushed before exposing a frame. Some FLI cameras support background flishing. Background flushing continuously flushes the CCD eliminating the need for pre-exposure flushings.
- Parameters:
handle (ctypes.c_long) – handle of the camera to set the number of flushes for.
n_flushes (int) – number of times to flush the CCD array before an exposure. The valid range is from 0 to 16 inclusive.
- FLISetTemperature(handle, temperature)[source]¶
Set the temperature of a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera device to set the temperature of.
temperature (astropy.units.Quantity) – temperature to set the cold finger of the camera to. A simple numeric type can be given instead of a Quantity, in which case the units are assumed to be degrees Celsius.
- FLISetVBin(handle, bin_factor)[source]¶
Set the vertical bin factor for a given camera.
- Parameters:
handle (ctypes.c_long) – handle of the camera to set the vertical bin factor for.
bin_factor (int) – vertical bin factor. The valid range is from 1 to 16 inclusive.
panoptes.pocs.camera.libfliconstants module¶
Numeric constants and bit flags from the FLI libfli C header.
These values mirror the enums and defines provided by libfli and are used by our ctypes-based FLIDriver wrapper to configure devices and interpret status.
panoptes.pocs.camera.sbig module¶
SBIG camera driver implementation backed by the SBIG Universal Driver.
Provides a Camera class that uses the ctypes-based SBIGDriver to control cooled SBIG CCD/CMOS cameras and integrate with the AbstractSDKCamera interface.
- class panoptes.pocs.camera.sbig.Camera(name='SBIG Camera', *args, **kwargs)[source]¶
Bases:
AbstractSDKCameraSBIG camera implementation using the SBIG Universal Driver (sbigudrv).
Wraps SBIGDriver calls to provide cooling, exposure, and readout control consistent with AbstractSDKCamera.
- connect()[source]¶
Connect to SBIG camera.
Gets a ‘handle’, serial number and specs/capabilities from the driver
- property cooling_enabled¶
Current status of the camera’s image sensor cooling system (enabled/disabled).
Can be set by assigning a bool.
- property cooling_power¶
Current power level of the camera’s image sensor cooling system (as a percentage of the maximum).
- property egain¶
Image sensor gain in e-/ADU as reported by the camera.
- property is_exposing¶
True if an exposure is currently under way, otherwise False
- property target_temperature¶
Current value of the target temperature for the camera’s image sensor cooling control.
Can be set by assigning an astropy.units.Quantity.
- property temperature¶
Current temperature of the camera’s image sensor.
panoptes.pocs.camera.sbigudrv module¶
Low level interface to the SBIG Unversal Driver/Library.
Reproduces in Python (using ctypes) the C interface provided by SBIG’s shared library, i.e. 1 function that does 72 different things selected by passing an integer as the first argument. This is basically a direct translation of the enums and structs defined in the library C-header to Python dicts and ctypes.Structures, plus a class (SBIGDriver) to load the library and call the single command function (SBIGDriver._send_command()).
- class panoptes.pocs.camera.sbigudrv.CFWCommand(*values)[source]¶
Bases:
IntEnumFilter wheel command enum
- CLOSE_DEVICE = 5¶
- GET_INFO = 3¶
- GOTO = 1¶
- INIT = 2¶
- OPEN_DEVICE = 4¶
- QUERY = 0¶
- class panoptes.pocs.camera.sbigudrv.CFWError(*values)[source]¶
Bases:
IntEnumFilter wheel errors enum
- BAD_COMMAND = 2¶
- BAD_MODEL = 5¶
- BUSY = 1¶
- CAL_ERROR = 3¶
- DEVICE_NOT_CLOSED = 6¶
- DEVICE_NOT_OPEN = 7¶
- I2C_ERROR = 8¶
- MOTOR_TIMEOUT = 4¶
- NONE = 0¶
- class panoptes.pocs.camera.sbigudrv.CFWGetInfoSelect(*values)[source]¶
Bases:
IntEnumFilter wheel get info select enum
- CAL_DATA = 1¶
- DATA_REGISTERS = 2¶
- FIRMWARE_VERSION = 0¶
- class panoptes.pocs.camera.sbigudrv.CFWModelSelect(*values)[source]¶
Bases:
IntEnumFilter wheel model selection enum
- AUTO = 6¶
- CFW10 = 8¶
- CFW10_SERIAL = 9¶
- CFW1603 = 13¶
- CFW2 = 1¶
- CFW402 = 5¶
- CFW5 = 2¶
- CFW6A = 7¶
- CFW8 = 3¶
- CFW9 = 10¶
- CFWL = 4¶
- CFWL8 = 11¶
- CFWL8G = 12¶
- FW5_8300 = 15¶
- FW5_STF_DETENT = 19¶
- FW5_STX = 14¶
- FW7_STX = 17¶
- FW8_8300 = 16¶
- FW8_STT = 18¶
- UNKNOWN = 0¶
- class panoptes.pocs.camera.sbigudrv.CFWParams[source]¶
Bases:
Structurectypes Structure used to hold the parameters for the CFW (colour filter wheel) command
- cfwCommand¶
Structure/Union member
- cfwModel¶
Structure/Union member
- cfwParam1¶
Structure/Union member
- cfwParam2¶
Structure/Union member
- inLength¶
Structure/Union member
- inPtr¶
Structure/Union member
- outLength¶
Structure/Union member
- outPtr¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.CFWResults[source]¶
Bases:
Structurectypes Structure used to fold the results from the CFW (colour filer wheel) command
- cfwError¶
Structure/Union member
- cfwModel¶
Structure/Union member
- cfwPosition¶
Structure/Union member
- cfwResults1¶
Structure/Union member
- cfwResults2¶
Structure/Union member
- cfwStatus¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.CFWStatus(*values)[source]¶
Bases:
IntEnumFilter wheel status enum
- BUSY = 2¶
- IDLE = 1¶
- UNKNOWN = 0¶
- class panoptes.pocs.camera.sbigudrv.EndExposureParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the End Exposure command.
- ccd¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.EndReadoutParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the End Readout Params.
- ccd¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.EstablishLinkParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Establish Link command.
- sbigUseOnly¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.EstablishLinkResults[source]¶
Bases:
Structurectypes Structure to hold the results from the Establish Link command.
- cameraType¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetCCDInfoParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Get CCD Info command, used obtain the details & capabilities of the connected camera.
- request¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetCCDInfoResults0[source]¶
Bases:
Structurectypes Structure to hold the results from the Get CCD Info command when used with requests ‘CCD_INFO_IMAGING’ or ‘CCD_INFO_TRACKING’.
The firmwareVersion field is 4 digit binary coded decimal of the form XX.XX.
- cameraType¶
Structure/Union member
- firmwareVersion¶
Structure/Union member
- name¶
Structure/Union member
- readoutInfo¶
Structure/Union member
- readoutModes¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetCCDInfoResults2[source]¶
Bases:
Structurectypes Structure to hold the results from the Get CCD Info command when used with request ‘CCD_INFO_EXTENDED’.
- badColumns¶
Structure/Union member
- columns¶
Structure/Union member
- imagingABG¶
Structure/Union member
- serialNumber¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetCCDInfoResults4[source]¶
Bases:
Structurectypes Structure to hold the results from the Get CCD Info command when used with requests ‘CCD_INFO_EXTENDED2_IMAGING’ or ‘CCD_INFO_EXTENDED2_TRACKING’.
The capabilitiesBits is a bitmap, yay.
- capabilities_b0¶
Structure/Union member
- capabilities_b1¶
Structure/Union member
- capabilities_b2¶
Structure/Union member
- capabilities_b3¶
Structure/Union member
- capabilities_b4¶
Structure/Union member
- capabilities_b5¶
Structure/Union member
- capabilities_unusued¶
Structure/Union member
- dumpExtra¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetCCDInfoResults6[source]¶
Bases:
Structurectypes Structure to hold the results from the Get CCD Info command when used with the request ‘CCD_INFO_EXTENDED3’.
The sbigudrv.h C header says there should be three bitmask fields, each of type ulong, which would be 64 bits on this platform (OS X), BUT trial and error has determined they’re actually 32 bits long.
- camera_b0¶
Structure/Union member
- camera_b1¶
Structure/Union member
- camera_unused¶
Structure/Union member
- ccd_b0¶
Structure/Union member
- ccd_b1¶
Structure/Union member
- ccd_unused¶
Structure/Union member
- extraBits¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetDriverControlParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Get Driver Control command, used to query the value of a specific driver control parameter.
- controlParameter¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetDriverControlResults[source]¶
Bases:
Structurectypes Structure to hold the result from the Get Driver Control command, used to query the value of a specific driver control parameter
- controlValue¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetDriverHandleResults[source]¶
Bases:
Structurectypes Structure to hold the results from the Get Driver Handle command. The handle is the camera ID used when switching control between connected cameras with the Set Driver Handle command.
- handle¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetDriverInfoParams[source]¶
Bases:
Structurectypes Structure used to hold the parameters for the Get Driver Info command
- request¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetDriverInfoResults0[source]¶
Bases:
Structurectypes Structure used to hold the results from the Get Driver Info command
- maxRequest¶
Structure/Union member
- name¶
Structure/Union member
- version¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.GetLinkStatusResults[source]¶
Bases:
Structurectypes Structure to hold the results from the Get Link Status command.
- baseAddress¶
Structure/Union member
- cameraType¶
Structure/Union member
- comFailed¶
Structure/Union member
- comTotal¶
Structure/Union member
- linkEstablished¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.OpenDeviceParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Open Device command.
- deviceType¶
Structure/Union member
- ipAddress¶
Structure/Union member
- lptBaseAddress¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryCommandStatusParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Query Command Status command.
- command¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryCommandStatusResults[source]¶
Bases:
Structurectypes Structure to hold the results from the Query Command Status command.
- status¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryTemperatureStatusParams[source]¶
Bases:
Structurectypes Structure used to hold the parameters for the Query Temperature Status command.
- request¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryTemperatureStatusResults[source]¶
Bases:
Structurectypes Structure used to hold the results from the Query Temperature Status command (standard version).
- ambientThermistor¶
Structure/Union member
- ccdSetpoint¶
Structure/Union member
- ccdThermistor¶
Structure/Union member
- enabled¶
Structure/Union member
- power¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryTemperatureStatusResults2[source]¶
Bases:
Structurectypes Structure used to hold the results from the Query Temperature Status command (extended version).
- ambientTemperature¶
Structure/Union member
- ccdSetpoint¶
Structure/Union member
- coolingEnabled¶
Structure/Union member
- externalTrackingCCDPower¶
Structure/Union member
- externalTrackingCCDTemperature¶
Structure/Union member
- fanEnabled¶
Structure/Union member
- fanPower¶
Structure/Union member
- fanSpeed¶
Structure/Union member
- heatsinkTemperature¶
Structure/Union member
- imagingCCDPower¶
Structure/Union member
- imagingCCDTemperature¶
Structure/Union member
- trackingCCDPower¶
Structure/Union member
- trackingCCDSetpoint¶
Structure/Union member
- trackingCCDTemperature¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryUSBInfo[source]¶
Bases:
Structurectypes (Sub-)Structure used to hold details of individual cameras returned by ‘CC_QUERY_USB’ command
- cameraFound¶
Structure/Union member
- cameraType¶
Structure/Union member
- name¶
Structure/Union member
- serialNumber¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryUSBResults[source]¶
Bases:
Structurectypes Structure used to hold the results from ‘CC_QUERY_USB’ command (max 4 cameras).
- camerasFound¶
Structure/Union member
- usbInfo¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryUSBResults2[source]¶
Bases:
Structurectypes Structure used to hold the results from ‘CC_QUERY_USB2’ command (max 8 cameras).
- camerasFound¶
Structure/Union member
- usbInfo¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.QueryUSBResults3[source]¶
Bases:
Structurectypes Structure used to hold the results from ‘CC_QUERY_USB3’ command (max 24 cameras).
- camerasFound¶
Structure/Union member
- usbInfo¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.ReadoutInfo[source]¶
Bases:
Structurectypes Structure to store details of an individual readout mode. An array of up to 20 of these will be returned as part of the GetCCDInfoResults0 struct when the Get CCD Info command is used with request ‘CCD_INFO_IMAGING’.
The gain field is a 4 digit Binary Coded Decimal (yes, really) of the form XX.XX, in units of electrons/ADU.
The pixel_width and pixel_height fields are 6 digit Binary Coded Decimals for the form XXXXXX.XX in units of microns, helpfully supporting pixels up to 1 metre across.
- gain¶
Structure/Union member
- height¶
Structure/Union member
- mode¶
Structure/Union member
- pixelHeight¶
Structure/Union member
- pixelWidth¶
Structure/Union member
- width¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.ReadoutLineParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Readout Line command.
- ccd¶
Structure/Union member
- pixelLength¶
Structure/Union member
- pixelStart¶
Structure/Union member
- readoutMode¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.SBIGDriver(library_path=None, retries=1, **kwargs)[source]¶
Bases:
AbstractSDKDriverctypes-based wrapper around the SBIG Universal Driver/Library.
Provides helpers for listing/connecting devices, temperature control, exposures, filter wheel control, and low-level command marshaling.
- cfw_get_info(handle, model='AUTO')[source]¶
Get info from the colour filter wheel
This will return the usual status information plus the firmware version and the number of filter wheel positions.
- Parameters:
- Returns:
- dictionary containing the ‘model’, ‘firmware_version’ and ‘n_positions’ for the
filter wheel.
- Return type:
- Raises:
RuntimeError – raised if the driver returns an error
- cfw_goto(handle, position, model='AUTO', cfw_event=None, timeout=<Quantity 10. s>)[source]¶
Move colour filer wheel to a given position
This function returns immediately after starting the move but spawns a thread to poll the filter wheel until the move completes (see _cfw_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:
handle (int) – handle of the camera that the filter wheel is connected to.
position (int) – position to move the filter wheel. Must an integer >= 1.
model (str, optional) – Model of the filter wheel to control. Default is ‘AUTO’, which asks the driver to autodetect the model.
cfw_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. Default is 10 seconds.
- Returns:
- dictionary containing the ‘model’, ‘position’, ‘status’ and ‘error’ values
returned by the driver.
- Return type:
- Raises:
RuntimeError – raised if the driver returns an error
- cfw_init(handle, model='AUTO', timeout=<Quantity 10. s>)[source]¶
Initialise colour filter wheel
Sends the initialise command to the colour filter wheel attached to the camera specified with handle. This will generally not be required because all SBIG filter wheels initialise themselves on power up.
- Parameters:
handle (int) – handle of the camera that the filter wheel is connected to.
model (str, optional) – Model of the filter wheel to control. Default is ‘AUTO’, which asks the driver to autodetect the model.
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. Default is 10 seconds.
- Returns:
- dictionary containing the ‘model’, ‘position’, ‘status’ and ‘error’ values
returned by the driver.
- Return type:
- Raises:
RuntimeError – raised if the driver returns an error
- cfw_query(handle, model='AUTO')[source]¶
Query status of the colour filter wheel
This is mostly used to poll the filter wheel status after asking the filter wheel to move in order to find out when the move has completed.
- Parameters:
- Returns:
- dictionary containing the ‘model’, ‘position’, ‘status’ and ‘error’ values
returned by the driver.
- Return type:
- Raises:
RuntimeError – raised if the driver returns an error
- disable_vdd_optimized(handle)[source]¶
Stops selective lowering of the CCD’s Vdd voltage to ensure consistent bias structures.
There are many driver control parameters, almost all of which we would not want to change from their default values. The one exception is DCP_VDD_OPTIMIZED. From the SBIG manual:
The DCP_VDD_OPTIMIZED parameter defaults to TRUE which lowers the CCD’s Vdd (which reduces amplifier glow) only for images 3 seconds and longer. This was done to increase the image throughput for short exposures as raising and lowering Vdd takes 100s of milliseconds. The lowering and subsequent raising of Vdd delays the image readout slightly which causes short exposures to have a different bias structure than long exposures. Setting this parameter to FALSE stops the short exposure optimization from occurring.
The default behaviour will improve image throughput for exposure times of 3 seconds or less but at the penalty of altering the bias structure between short and long exposures. This could cause systematic errors in bias frames, dark current measurements, etc. It’s probably not worth it.
- get_ccd_info(handle)[source]¶
Use Get CCD Info to gather all relevant info about CCD capabilities. Already have camera type, ‘name’ and serial number, this gets the rest.
- get_devices()[source]¶
Gets currently connected camera inf.
- Returns:
All currently connected camera serial numbers with corresponding handles.
- Return type:
- get_exposure_status(handle)[source]¶
Returns the current exposure status of the camera, e.g. ‘CS_IDLE’, ‘CS_INTEGRATING’
- get_link_status()[source]¶
Return link status information for the current device.
- Returns:
- Connection details including ‘established’, ‘camera_type’,
and communication counters.
- Return type:
- open_device(device_type)[source]¶
Open a specific SBIG device by device type code.
- Parameters:
device_type (str) – One of the supported device type strings (e.g., ‘DEV_USB1’).
- query_temp_status(handle)[source]¶
Query the camera for current temperatures and cooler state.
- Parameters:
handle – Driver handle for the target device.
- Returns:
Temperatures, power levels, and flags such as ‘cooling_enabled’.
- Return type:
- readout(handle, readout_mode, top, left, height, width)[source]¶
Read out the imaging CCD and return the image data array.
- Parameters:
handle – Driver handle for the device.
readout_mode (str) – Readout mode key (e.g., ‘RM_1X1’).
top – Subframe window parameters in pixels.
left – Subframe window parameters in pixels.
height – Subframe window parameters in pixels.
width – Subframe window parameters in pixels.
- Returns:
2D uint16 array of image data.
- Return type:
- property retries¶
Number of times to retry sending a command to the camera.
- set_temp_regulation(handle, target_temperature, enabled)[source]¶
Enable/disable cooling and set the target sensor temperature.
- Parameters:
handle – Driver handle for the device.
target_temperature – Desired CCD temperature (Quantity or float in C).
enabled (bool) – True to enable regulation, False to disable.
- start_exposure(handle, seconds, dark, antiblooming, readout_mode, top, left, height, width)[source]¶
Start an exposure on the imaging CCD.
- Parameters:
handle – Driver handle for the device.
seconds – Exposure duration (Quantity or float in seconds).
dark (bool) – If True keep shutter closed for a dark frame.
antiblooming (bool) – Whether to enable ABG if supported.
readout_mode (str) – Readout mode key (e.g., ‘RM_1X1’).
top – Subframe window parameters in pixels.
left – Subframe window parameters in pixels.
height – Subframe window parameters in pixels.
width – Subframe window parameters in pixels.
- class panoptes.pocs.camera.sbigudrv.SetDriverControlParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Set Driver Control command, used to set the value of a specific driver control parameter
- controlParameter¶
Structure/Union member
- controlValue¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.SetDriverHandleParams[source]¶
Bases:
Structurectypes Structure to hold the parameter for the Set Driver Handle command.
- handle¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.SetTemperatureRegulationParams[source]¶
Bases:
Structurectypes Structure used to hold the parameters for the Set Temperature Regulation command.
- ccdSetpoint¶
Structure/Union member
- regulation¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.SetTemperatureRegulationParams2[source]¶
Bases:
Structurectypes Structure used to hold the parameters for the Set Temperature Regulation 2 command.
- ccdSetpoint¶
Structure/Union member
- regulation¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.StartExposureParams2[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Start Exposure 2 command. (The Start Exposure command is deprecated.)
- abgState¶
Structure/Union member
- ccd¶
Structure/Union member
- exposureTime¶
Structure/Union member
- height¶
Structure/Union member
- left¶
Structure/Union member
- openShutter¶
Structure/Union member
- readoutMode¶
Structure/Union member
- top¶
Structure/Union member
- width¶
Structure/Union member
- class panoptes.pocs.camera.sbigudrv.StartReadoutParams[source]¶
Bases:
Structurectypes Structure to hold the parameters for the Start Readout command.
- ccd¶
Structure/Union member
- height¶
Structure/Union member
- left¶
Structure/Union member
- readoutMode¶
Structure/Union member
- top¶
Structure/Union member
- width¶
Structure/Union member
panoptes.pocs.camera.sdk module¶
Base classes for SDK-backed camera drivers and cameras.
Provides AbstractSDKDriver (ctypes loader + common helpers) and AbstractSDKCamera (shared orchestration for cameras controlled via SDKs).
- class panoptes.pocs.camera.sdk.AbstractSDKCamera(name='Generic SDK camera', driver=<class 'panoptes.pocs.camera.sdk.AbstractSDKDriver'>, library_path=None, filter_type=None, target_temperature=None, *args, **kwargs)[source]¶
Bases:
AbstractCameraCommon base for cameras controlled via a vendor SDK.
Handles driver lifetime, device discovery by serial_number, connection, and common cooling/temperature settling behavior reused by concrete SDK camera implementations (e.g., FLI, SBIG).
- property properties¶
A collection of camera properties as read from the camera
- class panoptes.pocs.camera.sdk.AbstractSDKDriver(name, library_path=None, *args, **kwargs)[source]¶
Bases:
PanBaseAbstract base for vendor SDK driver wrappers.
Loads the vendor’s shared library and provides a common interface for listing devices and retrieving SDK version information. Concrete driver implementations should subclass this and implement get_SDK_version() and get_devices().
Notes
Instances of this class are typically used by AbstractSDKCamera subclasses to manage a shared driver handle across multiple cameras.
panoptes.pocs.camera.zwo module¶
ZWO ASI camera implementation using the ASICamera2 SDK.
Exposes a Camera class that wraps the ASIDriver to control cooled ZWO cameras, including ROI/image type, binning, gain, bandwidth, cooling, single exposures, and basic video capture.
- class panoptes.pocs.camera.zwo.Camera(name: str = 'ZWO ASI Camera', gain: int | None = 120, image_type: str | None = 'RAW16', bandwidthoverload: float = 50, binning: int = 2, fix_bit_padding: bool = False, *args, **kwargs)[source]¶
Bases:
AbstractSDKCameraZWO ASI camera controlled via the ASICamera2 SDK.
Provides convenience properties for ROI, binning, image type, gain, and bandwidth settings, and supports single exposures and basic video capture.
- property bandwidthoverload¶
USB bandwidth usage limit as a percentage.
- property bit_depth¶
ADC bit depth
- connect(enable_cooling=False)[source]¶
Connect to ZWO ASI camera.
Gets ‘camera_ID’ (needed for all driver commands), camera properties and details of available camera commands/parameters.
- property cooling_enabled¶
Current status of the camera’s image sensor cooling system (enabled/disabled)
- property cooling_power¶
Current power level of the camera’s image sensor cooling system (as a percentage).
- property egain¶
Image sensor gain in e-/ADU for the current gain, as reported by the camera.
- property gain¶
Current value of the camera’s gain setting in internal units.
See egain for the corresponding electrons / ADU value.
- property height: Quantity¶
Current image height
- property is_exposing¶
True if an exposure is currently under way, otherwise False
- property roi: dict¶
Get the ROI of the camera, which includes the width, height, binning, and image_type.
- start_video(seconds, filename_root, max_frames, image_type=None)[source]¶
Start video capture and write frames to FITS files.
- take_exposure(seconds=<Quantity 1. s>, filename=None, metadata=None, dark=False, blocking=False, timeout=<Quantity 10. s>, *args, **kwargs) Thread[source]¶
Take an exposure, clipping exposure time to camera’s valid range.
Ensures the exposure time is within the camera’s valid range before taking the exposure. This prevents issues where setting an exposure time below the minimum (e.g., zero) would not be properly handled.
- Parameters:
seconds – Length of exposure (will be clipped to valid range)
filename – Image filename
metadata – FITS header metadata
dark – Whether this is a dark frame
blocking – Whether to block until exposure completes
timeout – Additional timeout beyond exposure + readout time
*args – Additional arguments passed to parent class
**kwargs –
Additional arguments passed to parent class
- Returns:
The readout thread
- Return type:
- property target_temperature¶
Current value of the target temperature for the camera’s image sensor cooling control.
Can be set by assigning an astropy.units.Quantity
- property temperature¶
Current temperature of the camera’s image sensor
- property width: Quantity¶
Current image width
Module contents¶
- panoptes.pocs.camera.create_cameras_from_config(config=None, cameras=None, auto_primary=True, recreate_existing=False, *args, **kwargs)[source]¶
Create camera object(s) based on the config.
Creates a camera for each camera item listed in the config. Ensures the appropriate camera module is loaded.
- Parameters:
config (dict or None) – A config object for a camera or None to lookup in config-server.
cameras (list of panoptes.pocs.camera.Camera or None) – A list of camera objects or None.
auto_primary (bool) – If True, when no camera is marked as the primary camera, the first camera in the list will be used as primary. Default True.
recreate_existing (bool) – If True, a camera object will be recreated if an existing camera with the same uid is already assigned. Should currently only affect cameras that use the sdk (i.g. not DSLRs). Default False raises an exception if camera is already assigned.
*args (list) – Passed to get_config.
**kwargs (dict) – Can pass a cameras object that overrides the info in the configuration file. Can also pass auto_detect`(bool) to try and automatically discover the ports. Any other items as passed to `get_config.
- Returns:
- An ordered dictionary of created camera objects, with the
camera name as key and camera instance as value. Returns an empty OrderedDict if there is no camera configuration items.
- Return type:
OrderedDict
- Raises:
error.CameraNotFound – Raised if camera cannot be found at specified port or if auto_detect=True and no cameras are found.
error.PanError – Description
- panoptes.pocs.camera.list_connected_gphoto2_cameras(endpoint: AnyHttpUrl | None = None)[source]¶
Detect connected cameras.
Uses gphoto2 to try and detect which cameras are connected. Cameras should be known and placed in config but this is a useful utility.
- Parameters:
endpoint (AnyHttpUrl | None) – Optional HTTP endpoint for a remote gphoto2 service. If provided, the detection command will be executed remotely.
- Returns:
A list of the ports with detected cameras.
- Return type: