flicamera Reference

lib

exception flicamera.lib.FLIError[source]

Bases: Exception

An error from the FLI library.

exception flicamera.lib.FLIWarning[source]

Bases: UserWarning

A warning from the FLI library.

class flicamera.lib.LibFLI(shared_object: str | None = None, debug: bool = False, simulation_mode: bool = False, log: Callable[[str], None] | None = None)[source]

Bases: CDLL

Wrapper for the FLI library.

Parameters:
  • shared_object – The path to the FLI library shared object. If not provided, uses the default, internal version.

  • debug – Whether to use the debug mode.

get_camera(serial)[source]

Gets a camera by its serial string.

list_cameras()[source]

Returns a list of connected camera names.

set_debug(debug=True)[source]

Turns the debug system on/off.

class flicamera.lib.LibFLIDevice(name, lib)[source]

Bases: object

A FLI device.

cancel_exposure()[source]

Cancels an exposure.

disconnect()[source]

Disconnects and frees the device.

get_cooler_power()[source]

Returns the cooler power.

get_exposure_time_left()[source]

Returns the remaining exposure time, in milliseconds..

get_visible_area() Tuple[int, int, int, int][source]

Returns the visible area.

Returns:

visible_area – The visible area in the format \((ul_x, ul_y, lr_x, lr_y)\). See set_image_area for details. The visible area does not change regardless of the binning or image area defined; it’s the total available area. Note that \(lr_x-ul_x\) and \(lr_y-ul_y\) match the total size of the CCD, but \(lr_x\) or \(lr_y\) are not necessarily zero.

open()[source]

Opens the device and grabs information.

read_frame()[source]

Reads the image frame.

This function reads the image buffer row by row. In principle it could be optimised by writing a C function to encapsulate the loop, but tests show that the gain is marginal so it’s ok to keep it as a pure Python method.

set_binning(hbin, vbin)[source]

Sets the binning.

The image area is automatically re-adjusted to be the full visible area. If you want to change this, use set_image_area manually.

set_exposure_time(exp_time: float)[source]

Sets the exposure time.

Parameters:

exp_time – The exposure time, in seconds.

set_image_area(area: Tuple[int, int, int, int] | None = None)[source]

Sets the area of the image to exposure.

Parameters:

area (tuple) –

The area in the format \((ul_x, ul_y, lr_x, lr_y)\) where \(ul\) refers to the upper-left corner of the CCD, and \(lr\) to the lower right. The lower-right values to pass must take into account the horizontal and vertical binning factors. In practice one must pass \(lr_x^\prime\) and \(lr_y^\prime\) defined as

\[\begin{split}lr_x^\prime = ul_x + (lr_x - ul_x) / hbin \\ lr_y^\prime = ul_y + (lr_y - ul_y) / vbin\end{split}\]

If you pass the area, it is assumed that you are using the full image area as reference; the binning is automatically taken into account. Although the visible area does not necessary start at (0, 0), the area passed to this function should assume an origin at (0, 0). If area is None, the full area of the chip is used, using the current binning.

set_shutter(shutter_value: bool)[source]

Controls the shutter of the camera.

Parameters:

shutter_value – If True, opens the shutter, otherwise closes it.

set_temperature(temp: float)[source]

Sets the temperature of the CCD.

Parameters:

temp – Temperature in the range -55 to 45C.

start_exposure(frametype='normal')[source]

Starts and exposure and returns immediately.

property model

The model of the device.

property serial

The serial string of the device.

property temperature

Returns a dictionary of temperatures at different locations.

flicamera.lib.c_double_p

alias of LP_c_double

flicamera.lib.c_long_p

alias of LP_c_long

flicamera.lib.chk_err(err)[source]

Wraps a libFLI C function call with error checking code.