pylablib.devices.IDS package

Submodules

pylablib.devices.IDS.peak module

class pylablib.devices.IDS.peak.LibraryController(lib)[source]

Bases: LibraryController

close(opid)[source]

Mark device closing.

Return tuple (close_result, uninit_result) with the results of the closing and the shutdown. If library does not need to be shut down yet, set uninit_result=None

get_opened_num()[source]

Get number of opened devices

open()[source]

Mark device opening.

Return tuple (init_result, open_result, opid) with the results of the initialization and the opening, and the opening ID which should afterwards be used for closing. If library is already initialized, set init_result=None

preinit()[source]

Pre-initialize the library, if it hasn’t been done already

shutdown()[source]

Close all opened connections and shutdown the library

temp_open()[source]

Context for temporarily opening a new device connection

class pylablib.devices.IDS.peak.GenericIDSPeakAttribute(handle)[source]

Bases: object

Object representing an IDS peak attribute (node).

Parameters:

handle – node handle

name

attribute name

kind

attribute kind; can be "u32", "i64", "f64", "str", "enum", "bool", "command", or "blob"

display_name

attribute display name (short description name)

tooltip

longer attribute description

description

full attribute description (usually, same as tooltip)

units

attribute units (if applicable)

visibility

attribute visibility ("simple", "intermediate", or "advanced")

readable

whether attribute is readable

Type:

bool

writable

whether attribute is writable

Type:

bool

min

minimal attribute value (if applicable)

Type:

float or int

max

maximal attribute value (if applicable)

Type:

float or int

inc

minimal attribute increment value (if applicable)

Type:

float or int

ivalues

list of possible integer values for enum attributes

values

list of possible text values for enum attributes

labels

dict {label: index} which shows all possible values of an enumerated attribute and their corresponding numerical values

ilabels

dict {index: label} which shows labels corresponding to numerical values of an enumerated attribute

update_limits()[source]

Update limits for value attributes

truncate_value(value)[source]

Truncate value to lie within attribute limits

get_value(enum_as_str=True, use_cache=True, ignore_errors=False)[source]

Get attribute value.

If enum_as_str==True, return enum-style values as strings; otherwise, return corresponding integer values.

set_value(value, truncate=True)[source]

Set attribute value.

If truncate==True, automatically truncate value to lie within allowed range.

call_command(wait=False, wait_timeout=None)[source]

Execute the given command

wait_command_done(timeout=None)[source]

Wait until the command is done or the given timeout is elapsed (by default, infinite timeout)

is_command_done()[source]

Check if the command is done

pylablib.devices.IDS.peak.get_library_version()[source]

Get peak library version

pylablib.devices.IDS.peak.get_cti_paths(update=True)[source]

Return all found CTI paths

class pylablib.devices.IDS.peak.TIDSPeakSystemDescriptorInfo(key, display_name, vendor, model, version, tl_type, tl_version, cti_name, cti_path)

Bases: tuple

cti_name
cti_path
display_name
key
model
tl_type
tl_version
vendor
version
class pylablib.devices.IDS.peak.TIDSPeakSystemInfo(key, id, display_name, vendor, model, version, tl_type, tl_version, cti_name, cti_path)

Bases: tuple

cti_name
cti_path
display_name
id
key
model
tl_type
tl_version
vendor
version
class pylablib.devices.IDS.peak.TIDSPeakInterfaceDescriptorInfo(key, display_name, tl_type)

Bases: tuple

display_name
key
tl_type
class pylablib.devices.IDS.peak.TIDSPeakInterfaceInfo(key, id, display_name, tl_type)

Bases: tuple

display_name
id
key
tl_type
class pylablib.devices.IDS.peak.TIDSPeakDeviceDescriptorInfo(key, display_name, user_name, vendor, model, serial, version, tl_type)

Bases: tuple

display_name
key
model
serial
tl_type
user_name
vendor
version
class pylablib.devices.IDS.peak.TIDSPeakDeviceInfo(key, id, display_name, user_name, vendor, model, serial, version, tl_type)

Bases: tuple

display_name
id
key
model
serial
tl_type
user_name
vendor
version
class pylablib.devices.IDS.peak.TIDSPeakStreamDescriptorInfo(key)

Bases: tuple

key
class pylablib.devices.IDS.peak.TIDSPeakStreamInfo(key, id, tl_type)

Bases: tuple

id
key
tl_type
class pylablib.devices.IDS.peak.IIDSPeakDevice(handle=None)[source]

Bases: IDevice

Generic IDS peak object

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

close()

Close the connection

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_opened()

Check if the device is connected

open()

Open the connection

set_device_variable(key, value)

Set the value of a settings parameter

class pylablib.devices.IDS.peak.IDSPeakAttributeManager[source]

Bases: object

Generic IDS peak attribute manager

update_attributes(module, replace=False)[source]

Update attributes dictionary; if replace==True, replace it entirely, otherwise, simply update it

get_attribute(name, error_on_missing=True)[source]

Get the camera attribute with the given name

get_all_attributes(copy=False)[source]

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)[source]

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

set_attribute_value(name, value, error_on_missing=True, **kwargs)[source]

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)[source]

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

is_command_done(name, error_on_missing=True)[source]

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

wait_command_done(name, error_on_missing=True, timeout=None)[source]

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

get_all_attribute_values(root='', **kwargs)[source]

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

set_all_attribute_values(settings, root='', **kwargs)[source]

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

class pylablib.devices.IDS.peak.IIDSPeakAttributeDevice(handle=None)[source]

Bases: IIDSPeakDevice

Generic IDS peak device with attributes.

get_attribute(name, error_on_missing=True)[source]

Get the camera attribute with the given name

get_all_attributes(copy=False)[source]

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)[source]

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

set_attribute_value(name, value, error_on_missing=True, **kwargs)[source]

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)[source]

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

is_command_done(name, error_on_missing=True)[source]

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

wait_command_done(name, error_on_missing=True, timeout=None)[source]

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

get_all_attribute_values(root='', **kwargs)[source]

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

set_all_attribute_values(settings, root='', **kwargs)[source]

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

close()

Close the connection

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_opened()

Check if the device is connected

open()

Open the connection

set_device_variable(key, value)

Set the value of a settings parameter

class pylablib.devices.IDS.peak.IDSPeakProducerLibrary(cti_path)[source]

Bases: IIDSPeakDevice

IDS peak producer library.

Used to create an IDS peak system.

Parameters:

cti_path – path to the CTI file (use get_cti_paths() to get all paths)

open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

get_system_info()[source]

Get an IDS peak system descriptor info

get_system()[source]

Get an IDS peak system instance

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

set_device_variable(key, value)

Set the value of a settings parameter

class pylablib.devices.IDS.peak.IDSPeakSystem(producer)[source]

Bases: IIDSPeakAttributeDevice

IDS peak system.

Used list and open interfaces. Has attributes (.a and .av) describing some properties (number of interfaces, GenTL version and properties, etc.) Typically created by an IDSPeakProducerLibrary instance, does not need to be created explicitly.

Parameters:

producerIDSPeakProducerLibrary instance used to create the system

open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

get_system_info()[source]

Get system info as a TIDSPeakSystemInfo tuple

list_interfaces(update=False, update_timeout=1.0)[source]

List all interfaces available at this system.

If update==True, update the interfaces list with the given timeout before listing.

get_interface(idx=0, update=False, update_timeout=1.0)[source]

Get the interface with the given index (0-based, order given by list_interfaces() method).

If update==True, update the interfaces list with the given timeout before listing and opening.

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

get_all_attribute_values(root='', **kwargs)

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

get_all_attributes(copy=False)

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_command_done(name, error_on_missing=True)

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

set_all_attribute_values(settings, root='', **kwargs)

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

set_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

set_device_variable(key, value)

Set the value of a settings parameter

wait_command_done(name, error_on_missing=True, timeout=None)

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

class pylablib.devices.IDS.peak.IDSPeakInterface(system, idx=0)[source]

Bases: IIDSPeakAttributeDevice

IDS peak interface.

Used to list and open devices. Has attributes (.a and .av) describing some properties (number of devices, TL version and properties, etc.) Typically created by an IDSPeakSystem instance, does not need to be created explicitly.

Parameters:
  • systemIDSPeakSystem instance used to create the interface

  • idx – index of the interface within the system

open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

get_interface_info()[source]

Get interface info as a TIDSPeakInterfaceInfo tuple

list_devices(update=False, update_timeout=1.0)[source]

List all devices available at this system.

If update==True, update the devices list with the given timeout before listing.

get_device(idx=0, update=False, update_timeout=1.0)[source]

Get the device with the given index (0-based, order given by list_devices() method).

If update==True, update the devices list with the given timeout before listing and opening.

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

get_all_attribute_values(root='', **kwargs)

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

get_all_attributes(copy=False)

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_command_done(name, error_on_missing=True)

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

set_all_attribute_values(settings, root='', **kwargs)

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

set_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

set_device_variable(key, value)

Set the value of a settings parameter

wait_command_done(name, error_on_missing=True, timeout=None)

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

class pylablib.devices.IDS.peak.IDSPeakDevice(interface, idx=0, access_type='control')[source]

Bases: IIDSPeakAttributeDevice

Generic IDS peak device.

Used to control the camera. Has attributes (.ca and .cav) describing camera properties. In addition, it also gives access to GenTL (i.e., transport layer) properties via gentl_attributes attribute. Typically created by an IDSPeakInterface instance, does not need to be created explicitly.

Parameters:
  • interfaceIDSPeakInterface instance used to create the device

  • idx – index of the device within the interface

open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

get_device_info()[source]

Get device info as a TIDSPeakDeviceInfo tuple

list_streams()[source]

List the data streams of the device

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

get_all_attribute_values(root='', **kwargs)

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

get_all_attributes(copy=False)

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_command_done(name, error_on_missing=True)

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

set_all_attribute_values(settings, root='', **kwargs)

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

set_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

set_device_variable(key, value)

Set the value of a settings parameter

wait_command_done(name, error_on_missing=True, timeout=None)

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

class pylablib.devices.IDS.peak.TIDSPeakStreamBufferStat(announced, queued, awaiting, delivered, underruns, min_required, started)

Bases: tuple

announced
awaiting
delivered
min_required
queued
started
underruns
class pylablib.devices.IDS.peak.IDSPeakStream(device, idx=0)[source]

Bases: IIDSPeakAttributeDevice

IDS peak stream.

Used to control the camera readout. Has attributes (.a and .av) describing camera properties. In addition, it also gives access to GenTL (i.e., transport layer) properties via gentl_attributes attribute. Typically created by an IDSPeakInterface instance, does not need to be created explicitly.

Parameters:
  • deviceIDSPeakDevice instance used to create the stream

  • idx – index of the stream within the device

open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

get_stream_info()[source]

Get stream info as a TIDSPeakStreamInfo tuple

get_buffer_status()[source]

Get buffer statistics.

Return tuple (announced, queued, awaiting, delivered, under-runs, min_required, started) with the number of buffers which have been announced (scheduled), queued (waiting for reception), waiting to be read in the schedule loop, delivered (read in the scheduled loop), under-run (not delivered because the schedule loop is too slow), minimal number to be scheduled, and started (could be None if not supported).

is_grabbing()[source]

Check if grabbing is in progress

allocate_buffers(nbuff)[source]

Allocate the given number of buffers (deallocate currently allocated if necessary)

schedule_buffers()[source]

Schedule the allocated buffers (unschedule currently scheduled if necessary).

Return True if could schedule, and False if no buffers are allocated.

start_acquisition(nacq=None)[source]

Start the acquisition of the given number of frames (None means infinite).

Return True if could start, and False if no buffers are scheduled.

stop_acquisition()[source]

Stop acquisition and scheduling loop

unschedule_buffers()[source]

Unschedule currently scheduled buffers

deallocate_buffers()[source]

Deallocate currently allocated buffers

get_buffers(start, end)[source]

Get buffers located between the given indices as a list of 2D numpy array chunks

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

get_all_attribute_values(root='', **kwargs)

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

get_all_attributes(copy=False)

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

is_command_done(name, error_on_missing=True)

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

set_all_attribute_values(settings, root='', **kwargs)

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

set_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

set_device_variable(key, value)

Set the value of a settings parameter

wait_command_done(name, error_on_missing=True, timeout=None)

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

class pylablib.devices.IDS.peak.TIDSPeakCameraEnumeratorSystem(producer, system, interfaces)

Bases: tuple

interfaces
producer
system
class pylablib.devices.IDS.peak.TIDSPeakCameraEnumeratorInterface(interface, devices)

Bases: tuple

devices
interface
class pylablib.devices.IDS.peak.IDSPeakCameraEnumerator[source]

Bases: object

IDS peak camera enumerator.

Iterates over all connected systems, interfaces within systems, and cameras within interfaces.

open()[source]
close()[source]
iterate_cameras(cti_paths=None, cleanup=True)[source]

Iterate over all cameras.

Yield tuple (cti_path, interface_id, camera_id, camera_desc), where the first 3 elements identify system, interface and camera, and the last provides the camera description. cti_paths can specify a custom list of IDS peak CTI files. If cleanup==True, close all unused systems upon completion.

list_all_cameras(cti_paths=None)[source]

List all cameras and return their descriptors

open_camera(cti_path, interface_idx, camera_idx)[source]

Open a camera with the given full CTI path, interface id and camera id.

Return tuple (interface, uid) used to identify and control the camera.

close_camera(cid, cleanup=True)[source]

Close the camera with the given ID.

If cleanup==True and that was the last opened camera in the system, close the system as well.

pylablib.devices.IDS.peak.list_cameras()[source]

List all connected cameras.

Return a list of camera information tuples (key, id, display_name, user_name, vendor, model, serial, version, tl_type).

class pylablib.devices.IDS.peak.IDSPeakCamera(idx=0, key=None, serial=None)[source]

Bases: IDSPeakDevice, IROICamera, IExposureCamera

Generic IDS peak camera interface.

Parameters:
  • idx – camera index among the cameras listed using list_cameras()

  • name – camera key (unique identifier withing the system); if specified, then idx is ignored and the camera is determined based on the provided key

  • serial – camera serial number; if specified, then idx and key are ignored and the camera is determined based on the provided serial number

Error = <Mock name='mock.IDSPeakError' id='133159209578192'>
TimeoutError = <Mock spec='str' id='133159209574416'>
open()[source]

Open the connection

close()[source]

Close the connection

select_stream(idx=0)[source]

Select stream out of the ones available, as listed by list_streams()

get_exposure()[source]

Get current exposure

set_exposure(exposure)[source]

Set camera exposure

get_frame_period()[source]

Get frame period (time between two consecutive frames in the internal trigger mode)

set_frame_period(frame_period)[source]

Set frame period (time between two consecutive frames in the internal trigger mode)

get_frame_timings()[source]

Get acquisition timing.

Return tuple (exposure, frame_period).

get_detector_size()[source]

Get camera detector size (in pixels) as a tuple (width, height)

get_roi()[source]

Get current ROI.

Return tuple (hstart, hend, vstart, vend). hstart and hend specify horizontal image extent, vstart and vend specify vertical image extent (start is inclusive, stop is exclusive, starting from 0).

set_roi(hstart=0, hend=None, vstart=0, vend=None)[source]

Setup camera ROI.

hstart and hend specify horizontal image extent, vstart and vend specify vertical image extent (start is inclusive, stop is exclusive, starting from 0). By default, all non-supplied parameters take extreme values (0 for start, maximal for end).

get_roi_limits(hbin=1, vbin=1)[source]

Get the minimal and maximal ROI parameters.

Return tuple (hlim, vlim), where each element is in turn a limit 5-tuple (min, max, pstep, sstep, maxbin) with, correspondingly, minimal and maximal size, position and size step, and the maximal binning (fixed to 1 if not binning is allowed). In some cameras, the step and the minimal size depend on the binning, which can be supplied.

setup_acquisition(mode='sequence', nframes=100)[source]

Setup acquisition mode.

mode can be either "snap" (single frame or a fixed number of frames) or "sequence" (continuous acquisition). (note that IDSPeakCamera.acquisition_in_progress() would still return True in this case, even though new frames are no longer acquired). nframes sets up number of frame buffers.

clear_acquisition()[source]

Clear acquisition settings

start_acquisition(*args, **kwargs)[source]

Start acquisition.

Can take the same keyword parameters as :meth:``setup_acquisition. If the acquisition is not set up yet, set it up using the supplied parameters (use default of setup_acquisition(),if the parameter is None). Otherwise, if any supplied parameters are different from the current ones, change them and reset the acquisition.

stop_acquisition()[source]

Stop acquisition

acquisition_in_progress()[source]

Check if acquisition is in progress

FrameTransferError

alias of DefaultFrameTransferError

apply_settings(settings)

Apply the settings.

settings is the dict {name: value} of the device available settings. Non-applicable settings are ignored.

call_command(name, error_on_missing=True, wait=False, wait_timeout=None)

Call a command with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If wait==True, wait until it is done for the given wait_timeout (None means infinite timeout).

get_acquisition_parameters()

Get acquisition parameters.

Return dictionary {name: value}

get_all_attribute_values(root='', **kwargs)

Get values of all attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

get_all_attributes(copy=False)

Return a dictionary of all available attributes.

If copy==True, copy the dictionary; otherwise, return the internal dictionary structure (should not be modified).

get_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

get_attribute_value(name, error_on_missing=True, default=None, **kwargs)

Get value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, return default. If default is not None, automatically assume that error_on_missing==False. If name points at a dictionary branch, return a dictionary with all values in this branch. Additional arguments are passed to get_value methods of the individual attribute.

get_data_dimensions()

Get readout data dimensions (in pixels) as a tuple (width, height); take indexing mode into account

get_device_info()

Get device info as a TIDSPeakDeviceInfo tuple

get_device_variable(key)

Get the value of a settings, status, or full info parameter

get_frame_format()

Get format for the returned images.

Can be "list" (list of 2D arrays), "array" (a single 3D array), or "chunks" (list of 3D “chunk” arrays; supported for some cameras and provides the best performance).

get_frame_info_fields()

Get the names of frame info fields.

Applicable when frame info format (set by set_frame_info_format()) is "list" or "array".

get_frame_info_format()

Get format of the frame info.

Can be "namedtuple" (potentially nested named tuples; convenient to get particular values), "list" (flat list of values, with field names are given by get_frame_info_fields(); convenient for building a table), "array" (same as "list", but with a numpy array, which is easier to use for "chunks" frame format), or "dict" (flat dictionary with the same fields as the "list" format; more resilient to future format changes)

get_frame_info_period()

Get period of frame info acquisition.

Frame info might be skipped (set to None) except for frames which indices are divisible by period. Useful for certain cameras where acquiring frame info takes a lot of time and can reduce performance at higher frame rates. Note that this parameter can still be ignored (i.e., always set to 1) if the performance is not an issue for a given camera class.

get_frames_status()

Get acquisition and buffer status.

Return tuple (acquired, unread, skipped, size), where acquired is the total number of acquired frames, unread is the number of acquired but not read frames, skipped is the number of skipped (not read and then written over) frames, and buffer_size is the total buffer size (in frames).

get_full_info(include=0)

Get dict {name: value} containing full device information (including status and settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_full_status(include=0)

Get dict {name: value} containing the device status (including settings).

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

get_image_indexing()

Get indexing for the returned images.

Can be "rct" (first index row, second index column, rows counted from the top), "rcb" (same as "rc", rows counted from the bottom), "xyt" (first index column, second index row, rows counted from the top), or "xyb" (same as "xyt", rows counted from the bottom)

get_new_images_range()

Get the range of the new images.

Return tuple (first, last) with images range (first inclusive). If no images are available, return None. If some images were in the buffer were overwritten, exclude them from the range.

get_settings(include=0)

Get dict {name: value} containing all the device settings.

include specifies either a list of variables (only these variables are returned), a priority threshold (only values with the priority equal or higher are returned), or "all" (all available variables). Since the lowest priority is -10, setting include=-10 queries all available variables, which is equivalent to include="all".

grab(nframes=1, frame_timeout=5.0, missing_frame='skip', return_info=False, buff_size=None)

Snap nframes images (with preset image read mode parameters)

buff_size determines buffer size (if None, use the default size). Timeout is specified for a single-frame acquisition, not for the whole acquisition time. missing_frame determines what to do with frames which have been lost: can be "none" (replacing them with None), "zero" (replacing them with zero-filled frame), or "skip" (skipping them, while still keeping total returned frames number to n). If return_info==True, return tuple (frames, infos), where infos is a list of frame info tuples (camera-dependent); if some frames are missing and missing_frame!="skip", the corresponding frame info is None.

is_acquisition_setup()

Check if acquisition is set up.

If the camera does not support separate acquisition setup, always return True.

is_command_done(name, error_on_missing=True)

Check if the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

is_opened()

Check if the device is connected

list_streams()

List the data streams of the device

pausing_acquisition(clear=None, stop=True, setup_after=None, start_after=True, combine_nested=True)

Context manager which temporarily pauses acquisition during execution of with block.

Useful for applying certain settings which can’t be changed during the acquisition. If clear==True, clear acquisition in addition to stopping (by default, use the class default specified as _clear_pausing_acquisition attribute). If stop==True, stop the acquisition (if clear==True, stop regardless). If setup_after==True, setup the acquisition after pause if necessary (None means setup only if clearing was required). If start_after==True, start the acquisition after pause if necessary (None means start only if stopping was required). If combine_nested==True, then any nested pausing_acquisition calls will stop/clear acquisition as necessary, but won’t setup/start it again until this pausing_acquisition call is complete.

Yields tuple (acq_in_progress, acq_params), which indicates whether acquisition is currently in progress, and what are the current acquisition parameters.

read_multiple_images(rng=None, peek=False, missing_frame='skip', return_info=False, return_rng=False)

Read multiple images specified by rng (by default, all un-read images).

If rng is specified, it is a tuple (first, last) with images range (first inclusive). If no new frames are available, return an empty list; if no acquisition is running, return None. If peek==True, return images but not mark them as read. missing_frame determines what to do with frames which are out of range (missing or lost): can be "none" (replacing them with None), "zero" (replacing them with zero-filled frame), or "skip" (skipping them). If return_info==True, return tuple (frames, infos), where infos is a list of frame info tuples (camera-dependent, by default, only the frame index); if some frames are missing and missing_frame!="skip", the corresponding frame info is None. if return_rng==True, return the range covered resulting frames; if missing_frame=="skip", the range can be smaller than the supplied rng if some frames are skipped.

read_newest_image(peek=False, return_info=False)

Read the newest un-read image.

If no un-read frames are available, return None. If peek==True, return the image but not mark it as read. If return_info==True, return tuple (frame, info), where info is an info tuples (camera-dependent, see read_multiple_images()).

read_oldest_image(peek=False, return_info=False)

Read the oldest un-read image.

If no un-read frames are available, return None. If peek==True, return the image but not mark it as read. If return_info==True, return tuple (frame, info), where info is an info tuples (camera-dependent, see read_multiple_images()).

set_all_attribute_values(settings, root='', **kwargs)

Set values of all attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

set_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of an attribute with the given name.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing. If name points at a dictionary branch, set all values in this branch (in this case value must be a dictionary). Additional arguments are passed to set_value methods of the individual attribute.

set_device_variable(key, value)

Set the value of a settings parameter

set_frame_format(fmt)

Set format for the returned images.

Can be "list" (list of 2D arrays), "array" (a single 3D array), "chunks" (list of 3D “chunk” arrays; supported for some cameras and provides the best performance), or "try_chunks" (same as "chunks", but if chunks are not supported, set to "list" instead). If format is "chunks" and chunks are not supported by the camera, it results in one frame per chunk. Note that if the format is set to "array" or "chunks", the frame info format is also automatically set to "array". If the format is set to "chunks", then the image info is also returned in chunks form (list of 2D info arrays with the same length as the corresponding frame chunks).

set_frame_info_format(fmt, include_fields=None)

Set format of the frame info.

Can be "namedtuple" (potentially nested named tuples; convenient to get particular values), "list" (flat list of values, with field names are given by get_frame_info_fields(); convenient for building a table), "array" (same as "list", but with a numpy array, which is easier to use for "chunks" frame format), or "dict" (flat dictionary with the same fields as the "list" format; more resilient to future format changes) If include_fields is not None, it specifies the fields included for non-"tuple" formats; note that order or include_fields is ignored, and the resulting fields are always ordered same as in the original.

set_frame_info_period(period=1)

Set period of frame info acquisition.

Frame info might be skipped (set to None) except for frames which indices are divisible by period. Useful for certain cameras where acquiring frame info takes a lot of time and can reduce performance at higher frame rates. Note that this parameter can still be ignored (i.e., always set to 1) if the performance is not an issue for a given camera class.

set_image_indexing(indexing)

Set up indexing for the returned images.

Can be "rct" (first index row, second index column, rows counted from the top), "rcb" (same as "rc", rows counted from the bottom), "xyt" (first index column, second index row, rows counted from the top), or "xyb" (same as "xyt", rows counted from the bottom)

snap(timeout=5.0, return_info=False)

Snap a single frame

wait_command_done(name, error_on_missing=True, timeout=None)

Wait until the command with the given name is done.

If the value doesn’t exist and error_on_missing==True, raise error; otherwise, do nothing.

wait_for_frame(since='lastread', nframes=1, timeout=20.0, error_on_stopped=False)

Wait for one or several new camera frames.

since specifies the reference point for waiting to acquire nframes frames; can be “lastread”`` (from the last read frame), "lastwait" (wait for the last successful wait_for_frame() call), "now" (from the start of the current call), or "start" (from the acquisition start, i.e., wait until nframes frames have been acquired). timeout can be either a number, None (infinite timeout), or a tuple (timeout, frame_timeout), in which case the call times out if the total time exceeds timeout, or a single frame wait exceeds frame_timeout. If the call times out, raise TimeoutError. If error_on_stopped==True and the acquisition is not running, raise Error; otherwise, simply return False without waiting.

get_buffer_status()[source]
enable_raw_readout(enable='rows')[source]

Enable raw frame transfer.

Should be used if the camera uses unsupported pixel format. Can be "frame" (return the whole frame as a 1D "u1" numpy array), "rows" (return a 2D array, where each row corresponds to a single image row), or False (convert to image data, or raise an error if the format is not supported; default). In addition, for cameras which incorrectly implement "PayloadSize" parameter, one can explicitly specify the number of bytes per pixel (possibly fractional) which will be used to calculate the total byte size of the frame, or the total number of bytes per image (if specified, takes priority over bytes_per_pixel). Both bytes_per_pixel and bytes_per_image only apply if enable is set to "frame" or "rows".

Module contents