pylablib.devices.SiliconSoftware package

Submodules

pylablib.devices.SiliconSoftware.fgrab module

class pylablib.devices.SiliconSoftware.fgrab.TBoardInfo(name, full_name)

Bases: tuple

count()

Return number of occurrences of value.

full_name
index()

Return first index of value.

Raises ValueError if the value is not present.

name
pylablib.devices.SiliconSoftware.fgrab.get_board_info(board)[source]

Get board info for a given index (starting from 0)

pylablib.devices.SiliconSoftware.fgrab.list_boards()[source]

List all boards available through Silicon Software interface

pylablib.devices.SiliconSoftware.fgrab.get_boards_number()[source]

List number of connected Silicon Software boards

class pylablib.devices.SiliconSoftware.fgrab.TAppletInfo(name, file)

Bases: tuple

count()

Return number of occurrences of value.

file
index()

Return first index of value.

Raises ValueError if the value is not present.

name
class pylablib.devices.SiliconSoftware.fgrab.TFullAppletInfo(name, uid, desc, category, platform, tags, version, path, file, flags, info)

Bases: tuple

category
count()

Return number of occurrences of value.

desc
file
flags
index()

Return first index of value.

Raises ValueError if the value is not present.

info
name
path
platform
tags
uid
version
pylablib.devices.SiliconSoftware.fgrab.list_applets(board, full_desc=False, valid=True, on_board=False)[source]

List all applets available for this board.

board is the board index (starting from 0) given by its position in the list returned by list_boards(). If full_desc==True, return full description for each applet; otherwise, return only name and file name. If valid==True, list only valid and compatible applets; otherwise, list all applets. If on_board==True, list applets running on board; otherwise, list all applets contained in the system.

pylablib.devices.SiliconSoftware.fgrab.get_applet_info(board, **kwargs)[source]

Return full information for an applet with the given parameters (e.g., name, or full path)

class pylablib.devices.SiliconSoftware.fgrab.FGrabAttribute(fg, aid, port=0, system=False)[source]

Bases: object

Object representing an Silicon Software frame grabber parameter.

Allows to query and set values and get additional information. Usually created automatically by an :class:`` instance, but could be created manually.

Parameters:
  • fg – opened frame grabber handle
  • aid – attribute ID
  • port – camera port within the frame grabber
  • system – if True, this is a system attribute; otherwise, it is a camera attribute
name

attribute name

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
values

dictionary {i: name} of possible attribute values (if applicable)

update_limits()[source]

Update minimal and maximal attribute limits and return tuple (min, max, inc)

truncate_value(value)[source]

Truncate value to lie within attribute limits

get_value(enum_as_str=True)[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]

Get attribute value.

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

class pylablib.devices.SiliconSoftware.fgrab.TDeviceInfo(applet_info, system_info, software_version)

Bases: tuple

applet_info
count()

Return number of occurrences of value.

index()

Return first index of value.

Raises ValueError if the value is not present.

software_version
system_info
class pylablib.devices.SiliconSoftware.fgrab.TFrameInfo(frame_index, framestamp, timestamp, timestamp_long)

Bases: tuple

count()

Return number of occurrences of value.

frame_index
framestamp
index()

Return first index of value.

Raises ValueError if the value is not present.

timestamp
timestamp_long
class pylablib.devices.SiliconSoftware.fgrab.SiliconSoftwareFrameGrabber(siso_board=0, siso_applet='DualAreaGray16', siso_port=0, siso_detector_size=None, do_open=True, **kwargs)[source]

Bases: pylablib.devices.interface.camera.IGrabberAttributeCamera, pylablib.devices.interface.camera.IROICamera

Generic Silicon Software frame grabber interface.

Compared to SiliconSoftwareCamera, has more permissive initialization arguments, which simplifies its use as a base class for expanded cameras.

Parameters:
  • siso_board – board index, starting from 0; available boards can be learned by list_boards()
  • siso_applet – applet name, which can be learned by list_applets(); usually, a simple applet like "DualLineGray16" or "MediumLineGray16 are most appropriate; can be either an applet name, or a direct path to the applet DLL
  • siso_port – port number, if several ports are supported by the camera and the applet
  • siso_detector_size – if not None, can specify the maximal detector size; by default, use the maximal available for the frame grabber (usually, 16384x16384)
Error = <Mock name='mock.SiliconSoftwareError' id='140128550009232'>
TimeoutError = <Mock spec='str' id='140128515120784'>
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

is_opened()[source]

Check if the device is connected

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

Get values of all frame grabber attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

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

Set values of all frame grabber attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

get_system_info()[source]

Get the dictionary with all system information parameters

get_genicam_info_xml()[source]

Get description in Genicam-compatible XML format

get_device_info()[source]

Get camera model data.

Return tuple (applet_info, system_info, software_version) with the board serial number and an the interface type (e.g., "1430" for NI PCIe-1430)

set_frame_merge(frame_merge=1)[source]
get_detector_size()[source]

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

get_grabber_detector_size()

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).

get_grabber_roi()

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).

set_grabber_roi(hstart=0, hend=None, vstart=0, vend=None)

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.

get_grabber_roi_limits(hbin=1, vbin=1)

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.

Set up CameraLink pixel format.

If fmt is None, use supplied bits_per_pixel (8, 10, 12, 14, or 16) and taps (1 or 2) to figure out the format; otherwise, fmt should be a numerical (e.g., 210) or string (e.g., "FG_CL_MEDIUM_10_BIT") format. output_fmt specifies the result frame format; if None, use grayscale with the given bits_per_pixel if fmt is None, or 16 bit grayscale otherwise.

Get CamLink pixel format and the output pixel format as a tuple

Get all available CamLink pixel formats and the output pixel formats as a tuple of 2 lists

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 IMAQCamera.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 all acquisition details and free all buffers

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 pylablib.devices.interface.camera.DefaultFrameTransferError

class NoParameterCaller(device, kind)

Bases: object

Class to simplify calling functions without a parameter

apply_settings(settings)

Apply the settings.

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

get_acquisition_parameters()

Get acquisition parameters.

Return dictionary {name: value}

get_all_grabber_attributes(copy=False)

Return a dictionary of all available frame grabber grabber_attributes.

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

get_data_dimensions()

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

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, or 3D array for some fastbuff cameras), "array" (a single 3D array).

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 fastbuff readout supported by some cameras), 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_grabber_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

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

Get value of a frame grabber 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_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='none', 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.

pausing_acquisition(clear=None)

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 pausing (by default, use the class default specified as _clear_pausing_acquisition attribute). Yields tuple (acq_in_progress, acq_params), which indicates whether acquisition is currently in progress, and what are the current acquisition parameters.

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_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, or 3D array for some fastbuff cameras), "array" (a single 3D array). Note that if the format is set to "array", the frame info format is also automatically set to "array".

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 fastbuff readout supported by some cameras), 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.

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_grabber_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of a frame grabber 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_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_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.

read_multiple_images(rng=None, peek=False, missing_frame='skip', return_info=False, fastbuff=False)[source]

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 TFrameInfo instances describing frame index, framestamp, and two timestamps (lower and higher precision); if some frames are missing and missing_frame!="skip", the corresponding frame info is None. Note that obtaining frame info takes about 100us, so return_info="all" should be avoided fro rates above 5-10kFPS. If fastbuff==False, return a list of individual frames (2D numpy arrays). Otherwise, return a list of ‘chunks’, which are 3D numpy arrays containing several frames; in this case, if return_info is True, then frame_info will automatically be in an "array" format, with the rows corresponding to the frames within the chunks, and the columns corresponding to the frames. Using fastbuff results in faster operation at high frame rates (>~1kFPS), at the expense of a more complicated frame processing in the following code.

class pylablib.devices.SiliconSoftware.fgrab.SiliconSoftwareCamera(board, applet, port=0, detector_size=None)[source]

Bases: pylablib.devices.SiliconSoftware.fgrab.SiliconSoftwareFrameGrabber

Generic Silicon Software frame grabber interface.

Parameters:
  • board – board index, starting from 0; available boards can be learned by list_boards()
  • applet – applet name, which can be learned by list_applets(); usually, a simple applet like "DualLineGray16" or "MediumLineGray16 are most appropriate; can be either an applet name, or a direct path to the applet DLL
  • port – port number, if several ports are supported by the camera and the applet
  • detector_size – if not None, can specify the maximal detector size; by default, use the maximal available for the frame grabber (usually, 16384x16384)
Error = <Mock name='mock.SiliconSoftwareError' id='140128550009232'>
FrameTransferError

alias of pylablib.devices.interface.camera.DefaultFrameTransferError

class NoParameterCaller(device, kind)

Bases: object

Class to simplify calling functions without a parameter

TimeoutError = <Mock spec='str' id='140128515120784'>
acquisition_in_progress()

Check if acquisition is in progress

apply_settings(settings)

Apply the settings.

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

clear_acquisition()

Clear all acquisition details and free all buffers

close()

Close connection to the camera

get_acquisition_parameters()

Get acquisition parameters.

Return dictionary {name: value}

get_all_grabber_attribute_values(root='', **kwargs)

Get values of all frame grabber attributes with the given root.

Additional arguments are passed to get_value methods of individual attributes.

get_all_grabber_attributes(copy=False)

Return a dictionary of all available frame grabber grabber_attributes.

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

Get all available CamLink pixel formats and the output pixel formats as a tuple of 2 lists

Get CamLink pixel format and the output pixel format as a tuple

get_data_dimensions()

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

get_detector_size()

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

get_device_info()

Get camera model data.

Return tuple (applet_info, system_info, software_version) with the board serial number and an the interface type (e.g., "1430" for NI PCIe-1430)

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, or 3D array for some fastbuff cameras), "array" (a single 3D array).

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 fastbuff readout supported by some cameras), 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_genicam_info_xml()

Get description in Genicam-compatible XML format

get_grabber_attribute(name, error_on_missing=True)

Get the camera attribute with the given name

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

Get value of a frame grabber 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_grabber_detector_size()

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

get_grabber_roi()

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).

get_grabber_roi_limits(hbin=1, vbin=1)

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.

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_roi()

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).

get_roi_limits(hbin=1, vbin=1)

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.

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".

get_system_info()

Get the dictionary with all system information parameters

grab(nframes=1, frame_timeout=5.0, missing_frame='none', 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_opened()

Check if the device is connected

open()

Open connection to the camera

pausing_acquisition(clear=None)

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 pausing (by default, use the class default specified as _clear_pausing_acquisition attribute). 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, fastbuff=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 TFrameInfo instances describing frame index, framestamp, and two timestamps (lower and higher precision); if some frames are missing and missing_frame!="skip", the corresponding frame info is None. Note that obtaining frame info takes about 100us, so return_info="all" should be avoided fro rates above 5-10kFPS. If fastbuff==False, return a list of individual frames (2D numpy arrays). Otherwise, return a list of ‘chunks’, which are 3D numpy arrays containing several frames; in this case, if return_info is True, then frame_info will automatically be in an "array" format, with the rows corresponding to the frames within the chunks, and the columns corresponding to the frames. Using fastbuff results in faster operation at high frame rates (>~1kFPS), at the expense of a more complicated frame processing in the following code.

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_grabber_attribute_values(settings, root='', **kwargs)

Set values of all frame grabber attributes with the given root.

Additional arguments are passed to set_value methods of individual attributes.

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, or 3D array for some fastbuff cameras), "array" (a single 3D array). Note that if the format is set to "array", the frame info format is also automatically set to "array".

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 fastbuff readout supported by some cameras), 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.

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_frame_merge(frame_merge=1)
set_grabber_attribute_value(name, value, error_on_missing=True, **kwargs)

Set value of a frame grabber 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_grabber_roi(hstart=0, hend=None, vstart=0, vend=None)

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).

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)

set_roi(hstart=0, hend=None, vstart=0, vend=None)

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).

setup_acquisition(mode='sequence', nframes=100)

Setup acquisition mode.

mode can be either "snap" (single frame or a fixed number of frames) or "sequence" (continuous acquisition). (note that IMAQCamera.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.

Set up CameraLink pixel format.

If fmt is None, use supplied bits_per_pixel (8, 10, 12, 14, or 16) and taps (1 or 2) to figure out the format; otherwise, fmt should be a numerical (e.g., 210) or string (e.g., "FG_CL_MEDIUM_10_BIT") format. output_fmt specifies the result frame format; if None, use grayscale with the given bits_per_pixel if fmt is None, or 16 bit grayscale otherwise.

snap(timeout=5.0, return_info=False)

Snap a single frame

start_acquisition(*args, **kwargs)

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()

Stop acquisition

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.

Module contents