- PyVCAM Wrapper
To install the latest stable version, simply run from anywhere pip install PyVCAM.
Optionally, you can build and install the package from the sources.
Navigate to the directory that contains pyproject.toml file and run pip install ..
Please read the README.md
for more details.
To create a PyVCAM Wheel package, navigate to the directory that contains pyproject.toml file
and run python -m build.
When you are ready to uninstall the package, run from anywhere pip uninstall PyVCAM.
Where the source code of the pyvcam module is located. In addition to the code for the module,
any additional scripts that are used to help write the module are included as well.
These are the files installed when users install the module.
The camera.py module contains the Camera python class which is used to abstract the need to
manually maintain, alter, and remember camera settings through PVCAM.
This will create a camera object using the first camera found, that can then be used to interact with the camera.
from pyvcam import pvc
from pyvcam.camera import Camera
pvc.init_pvcam() # Initialize PVCAM
cam = next(Camera.detect_camera()) # Use generator to find the first camera
cam.open() # Open the camera
| Method | Description |
|---|---|
__init__ |
(Magic Method) The Camera's constructor. Note that this method should not be used in the construction of a Camera. Instead, use the detect_camera class method to generate Camera classes of the currently available cameras connected to the system. |
__repr__ |
(Magic Method) Returns the name of the camera. |
get_available_camera_names |
Return a list of camera names connected to the system. Use this method in conjunction with select_camera. Refer to multi_camera.py for a usage example. |
detect_camera |
(Class method) Generator that yields a Camera object for a camera connected to the system. For an example of how to call detect_camera, refer to the code samples for creating a camera. |
select_camera |
(Class method) Generator that yields a Camera object for the camera that matches the provided name. Use this method in conjunction with get_available_camera_names. Refer to multi_camera.py for a usage example. |
open |
Opens the camera. Will set __handle to the correct value and __is_open to True if a successful call to PVCAM's open camera function is made. A RuntimeError will be raised if the call to PVCAM fails. For more information about how Python interacts with the PVCAM library, refer to the pvcmodule.cpp section of these notes. |
close |
Closes the camera. Will set __handle to the default value for a closed camera (-1) and will set __is_open to False if a successful call to PVCAM's close camera function is made. A RuntimeError will be raised if the call to PVCAM fails. For more information about how Python interacts with the PVCAM library, refer to the pvcmodule.cpp section of these notes. |
| Method | Description |
|---|---|
get_frame |
Calls the pvc module's get_frame function with current camera settings to get a 2D numpy array of pixel data from a single snap image. This method can either be called with or without a given exposure time. If given, the method will use the given parameter. Otherwise, if left out, will use the internal exp_time property.Parameters:
|
get_sequence |
Calls the pvc module's get_frame function with cameras current settings in rapid-succession to get a 3D numpy array of pixel data from a single snap image. Multiple ROIs are not supported.Getting a sequence example: # Given that the camera is already opened as openCamstack = openCam.get_sequence(8) # Getting a sequence of 8 framesfirstFrame = stack[0] # Accessing 2D frames from 3D stacklastFrame = stack[7]Parameters:
|
get_vtm_sequence |
Modified get_sequence to be used for Variable Timed Mode. Before calling it, set the camera's exposure mode to 'Variable Timed'/const.VARIABLE_TIMED_MODE. If the camera doesn't support this mode or when the mode is not set, this function will emulate the same behavior as a sequence of single snaps with given exposure times. The timings will always start at the first given and keep looping around until it is captured the number of frames given. Multiple ROIs are not supported.Parameters:
|
| Method | Description |
|---|---|
start_live |
Calls pvc.start_live to setup a live mode acquisition. This must be called before poll_frame.Parameters:
|
start_seq |
Calls pvc.start_seq to setup a sequence mode acquisition. This must be called before poll_frame.Parameters:
|
check_frame_status |
Calls pvc.check_frame_status to report status of camera. This method can be called regardless of an acquisition being in progress.Parameters:
|
poll_frame |
Returns a single frame as a dictionary with optional metadata if available. This method must be called after either start_live or start_seq and before finish. Pixel data can be accessed via the 'pixel_data' key. Available metadata can be accessed via the 'meta_data' key.If multiple ROIs are set, pixel data will be a list of region pixel data of length number of ROIs. Metadata will also contain information for ech ROI. Use cam.set_param(constants.PARAM_METADATA_ENABLED, True) or cam.metadata_enabled = True to enable the metadata.Parameters:
|
finish |
Calls either pvc.abort or pvc.finish_seq to return the camera to its normal state after acquiring images.Parameters:
|
| Method | Description |
|---|---|
reset_rois |
Restores region of interest to default which is full frame with binning disabled (1x1). Parameters:
|
set_roi |
Appends a new ROI to the camera's list of regions of interest. If the default ROI is currently set, this method will over-write that ROI. Each camera has a pre-defined maximum number of ROIs, which is typically 15. New ROIs can not exceed the boundaries of the sensor and can not overlap with existing ROIs. Parameters:
|
shape |
Returns the reshape factor to be used when acquiring a ROI. This is equivalent to an acquired images shape. Parameters:
|
| Method | Description |
|---|---|
sw_trigger |
This method will issue a software trigger command to the camera. This command is only valid if the camera has been set use a software trigger. Refer to sw_trigger.py for an example. |
Each parameter is fully described by a set of values. These values are accessible via attributes and
get_param function. Some attributes provide a value with fixed type, some depend on parameter type.
Attributes with fixed type:
ATTR_AVAIL(bool): Theget_paramdoesn't fail even for unavailable and unknown parameter ID.ATTR_TYPE(int): Theget_paramdoesn't fail even for unavailable parameter. An actual type for parameter attributes min., max., increment, default and current.ATTR_ACCESS(int): Theget_paramdoesn't fail even for unavailable parameter. Defines whether the parameter is read-only, read-write, etc.ATTR_LIVE(bool): IfTrue, the parameter can be accessed also during acquisition.ATTR_COUNT(int): The meaning varies with parameter type. For example, it defines number of enumeration items ofTYPE_ENUMparameter (useread_enumfunction to get all items), number of characters in string forTYPE_CHAR_PTRparameters. For numeric parameters it reports number of valid values between min. and max. and given increment (e.g. if min=0, max=10, inc=2, the count will be 6), or zero if either all values for given types are supported or the number of valid values doesn't fit to 4-byteuns32C type.
Remaining attributes (ATTR_CURRENT, ATTR_MIN, ATTR_MAX, ATTR_INCREMENT, ATTR_DEFAULT)
provide a value with type according to parameter type:
TYPE_INT*,TYPE_UNS*,TYPE_ENUM: Returns anint.TYPE_FLT*: Returns afloat.TYPE_CHAR_PTR: Returns astr.TYPE_RGN_TYPE: Returns adictwith values under keys"s1","s2","sbin","p1","p2","pbin".TYPE_SMART_STREAM_TYPE_PTR: Returns alistofintvalues. The list can be empty, or in case ofATTR_MAXit contains all zeroes where th number of zeroes means the max. number of smart stream exposures.
Warning: It is known FW bug, the cameras actually supports max-1 values only.
| Method | Description |
|---|---|
get_param |
Gets the value of a specified attribute of given PVCAM parameter. The type of the value returned depends on parameter type and attribute as documented at the beginning of this chapter. Usually not called directly since the properties (see below) will handle most cases of getting camera parameters. However, not all cases may be covered by the properties and a direct call may need to be made to PVCAM's pl_get_param function.Parameters:
|
set_param |
Sets a specified camera parameter to a new value. Usually not called directly since the properties (see below) will handle most cases of setting camera parameters. However, not all cases may be covered by the properties and a direct call may need to be made to PVCAM's pl_set_param function.Parameters:
|
check_param |
Checks if a camera parameter is available. This method is useful for checking certain features are available (such as post-processing, expose out mode). Returns True if available, False if not. It basically a helper that internally calls get_param with ATTR_AVAIL attribute.Parameters:
|
read_enum |
Returns a dictionary with all enumeration names paired with their values. Parameters:
|
get_post_processing_param |
Gets the current value of a specified post-processing parameter. It is a helper that utilizes set_param to select given feature and it's parameter by their indexes and the uses get_param to read the current value. For other attributes have look at post_processing_table property.Parameters:
|
set_post_processing_param |
Sets the value of a specified post-processing parameter. It is a helper that utilizes set_param to select given feature and it's parameter by their indexes and the uses set_param to change the value.Parameters:
|
reset_pp |
If post-processing is available on the camera, the function will call pvc.reset_pp to reset all post-processing features back to their default state.Parameters:
|
All properties are accessed via getters and setters. This means that it will appear that we are
accessing instance variables from a camera, but in reality, these properties are making specially
formatted calls to the Camera methods get_param and set_param. These getters and setters make
use of the property decorator that is built into Python. The reasoning behind the usage of the
property decorator is that properties will change dynamically during a Camera's lifetime and in
order to abstract PVCAM as far away from the end user as possible, the property decorator allows for
users to intuitively view and change camera settings.
The downside to this approach is that when a new parameter is required, an associated getter/setter
needs to be written and tested. Another downside to this implementation is that property lookup
time is not instant; instead, a call must be made to the pvc module which will then call PVCAM,
which will then return a result to the wrapper, which will finally return the result to the user.
The time it takes is currently considered insignificant, but if this were to become an issue,
the code could be refactored such that all properties also have instance variables which are changed
only when set_param or their associated setter is called on them.
# Assume 'cam' is an already constructed 'Camera' instance
current_gain = cam.gain # To call getter, simply read the property value
cam.gain = current_gain # To call setter, simply assign new value to the property
Some properties are camera-specific - not all cameras support related PVCAM parameter.
If an unsupported camera attempts to access it, an AttributeError will be raised.
For each enumeration parameter there is a pair of properties - a plural form like exp_modes
that is a dictionary with enum item names and values, and single form like exp_mode.
PVCAM works with the second one via integer values. In Python, when called as a getter,
the integer value will be returned to the user. However, when changing the value, either
the integer value or the name can be specified.
Refer to PVCAM User Manual
and constants.py for the predefines constants.
| Property | Description |
|---|---|
adc_offset |
(read-only) Returns the camera's current ADC offset value. Only CCD camera's have ADCs (analog-to-digital converters). |
binning |
(read-write) Returns or changes the current serial and parallel binning values in a tuple. The setter can be either a tuple for the binning (x, y) or a single value and will set a square binning with the given number, i.e. cam.binning = x and cam.binning = (x, x) are equivalent.Binning cannot be changed directly on the camera; but is used for setting up acquisitions and returning correctly shaped images returned from get_frame. The setter has built in checking to see that the given binning it able to be used later. Binning settings for individual ROIs is not supported. |
binnings |
(read-only) Returns a list of supported combinations of serial and parallel binning factors if limited by the camera. If the camera supports arbitrary binning None is retuned. |
bit_depth |
(read-only) Returns the native bit depth of pixel data for images collected with this camera. Bit depth cannot be changed directly; instead, users must select a desired speed that has the desired bit depth. Note that a camera may have additional speed table entries for different readout ports. See Port and Speed Choices section inside the PVCAM User Manual for a visual representation of a speed table and to see which settings are controlled by which speed is currently selected. |
bit_depth_host |
(read-only) Returns the bit depth of pixel data outputted to the host. This parameter differs from the bit_depth in a way that it reports the bit depth of the output frame - a frame that is delivered to the host. Since PVCAM supports various host side post processing features, the host bit depth may differ from the native camera bit depth, depending on what host-side post processing features are active.As a general rule, the application should always rely on the host-specific parameters when identifying the output data format. The native parameters should be used only for informational purposes, e.g. to show the camera native format in the GUI. |
cam_fw |
(read-only) Returns the cameras current firmware version as a string. |
centroids_mode |
(read-write, enum) Returns or changes the current centroids mode. See centroid_modes for the full list of supported values. |
centroids_modes |
(read-only) Returns a dictionary containing centroid modes supported by the camera. |
chip_name |
(read-only) Returns the camera sensor's name as a string. |
clear_mode |
(read-write, enum): Returns or changes the current clear mode of the camera.See clear_modes for the full list of supported values. |
clear_modes |
(read-only) Returns a dictionary containing clear modes supported by the camera. |
clear_time |
(read-only): Returns the last acquisition's clearing time as reported by the camera in microseconds. |
driver_version |
(read-only) Returns a formatted string containing the major, minor, and build version. When get_param is called on the device driver version, it returns a highly formatted 16 bit integer. The first 8 bits correspond to the major version, bits 9-12 are the minor version, and the last nibble is the build number. |
exp_mode |
(read-write, enum): Returns or changes the current exposure mode of the camera.See exp_modes for the full list of supported values. |
exp_modes |
(read-only) Returns a dictionary containing exposure modes supported by the camera. |
exp_out_mode |
(read-write, enum): Returns or changes the current expose out mode of the camera.See exp_out_modes for the full list of supported values. |
exp_out_modes |
(read-only) Returns a dictionary containing exposure out modes supported by the camera. |
exp_res |
(read-write, enum) Returns or changes the current exposure resolution of a camera.See exp_resolutions for the full list of supported values. For some older cameras this parameter might not be available. In this case camera uses EXP_RES_ONE_MILLISEC resolution. |
exp_res_index |
(read-only): Returns the current exposure resolution index. For some older cameras this parameter might not be available. In this case camera uses EXP_RES_ONE_MILLISEC resolution. |
exp_resolutions |
(read-only) Returns a dictionary containing exposure resolutions supported by the camera. |
exp_time |
(read-write): Returns or changes the exposure time the camera will use if not given an exposure time. It is recommended to modify this value to modify your acquisitions for better abstraction. |
fan_speed |
(read-write, enum): Returns or changes the current fan speed setpoint of the camera.See fan_speeds for the full list of supported values. |
fan_speeds |
(read-only) Returns a dictionary containing fan speeds supported by the camera. |
gain |
(read-write) Returns or changes the current gain index for a camera. A ValueError will be raised if an invalid gain index is supplied to the setter. After changing readout_port it is strongly recommended to re-apply the settings of speed and gain exactly in that order. |
gain_name |
(read-only) Returns the name of currently selected gain via gain under selected port and speed. It is either hard-coded generic string or provided by the camera. |
handle |
(read-only) Returns the value currently stored inside the Camera's __handle instance variable. |
is_open |
(read-only) Returns the value currently stored inside the Camera's __is_open instance variable. |
last_exp_time |
(read-only) Returns the last exposure time the camera used for the last successful non-variable timed mode acquisition in what ever time resolution it was captured at. |
live_roi |
(read-write): Returns the region of interest used in last acquisition or changes an ROI for currently running acquisition. If supported by the camera, the related PVCAM parameter reports True for ATTR_LIVE and new value can be set during active acquisition only, otherwise an error is reported. It is because an ROI for new acquisition is set via set_roi function and passed to pvc.start_live or pvc.start_seq functions. If the camera doesn't support it, this property is read-only. |
metadata_enabled |
(read-write): Returns or changes the embedded frame metadata availability. |
name |
(read-only) Returns the value currently stored inside the Camera's __name instance variable. |
pix_time |
(read-only) Returns the camera's pixel time, which is the inverse of the speed of the camera. Pixel time cannot be changed directly; instead users must select a desired speed that has the desired pixel time. Note that a camera may have additional speed table entries for different readout ports. See Port and Speed Choices section inside the PVCAM User Manual for a visual representation of a speed table and to see which settings are controlled by which speed table entry is currently selected. |
port_speed_gain_table |
(read-only) Returns a dictionary containing the port, speed and gain table, which gives information such as bit depth and pixel time for each readout port, speed and gain. |
post_processing_table |
(read-only) Returns a dictionary containing post-processing features and parameters as well as the minimum and maximum value for each parameter. |
post_trigger_delay |
(read-only): Returns the last acquisition's post-trigger delay as reported by the camera in microseconds. |
pre_trigger_delay |
(read-only): Returns the last acquisition's pre-trigger delay as reported by the camera in microseconds |
prog_scan_mode |
(read-write, enum) Returns or changes the current programmable scan mode. See prog_scan_modes for the full list of supported values. |
prog_scan_modes |
(read-only) Returns a dictionary containing programmable scan modes supported by the camera. |
prog_scan_dir |
(read-write, enum) Returns or changes the current programmable scan direction. See prog_scan_dirs for the full list of supported values. |
prog_scan_dirs |
(read-only) Returns a dictionary containing programmable scan directions supported by the camera. |
prog_scan_dir_reset |
(read-write) Returns or changes scan direction reset state of camera. The parameter is used with alternate scan directions (down-up) to reset the direction with every acquisition. |
prog_scan_line_delay |
(read-write) Returns or changes the scan line delay. The parameter access mode depends on the prog_scan_mode selection. |
prog_scan_line_time |
(read-only) Returns the scan line time of camera in nano seconds. |
prog_scan_width |
(read-write) Returns or changes the scan width. The parameter access mode depends on the prog_scan_mode selection. |
readout_port |
(read-write, enum) Some cameras may have many readout ports, which are output nodes from which a pixel stream can be read from. After changing readout_port it is strongly recommended to re-apply the settings of speed and gain exactly in that order. For more information about readout ports, refer to the Port and Speed Choices section inside the PVCAM User Manual. See readout_ports for the full list of supported values. There are no predefined constants for this parameter. |
readout_ports |
(read-only) Returns a dictionary containing readout ports supported by the camera. |
readout_time |
(read-only): Returns the last acquisition's readout time as reported by the camera in microseconds. |
sensor_size |
(read-only) Returns the sensor size of the current camera in a tuple in the form (serial/x sensor size, parallel/y sensor size) |
serial_no |
(read-only) Returns the camera's serial number as a string. |
smart_stream_mode_enabled |
(read-write) Enables or disables the S.M.A.R.T. streaming feature. |
smart_stream_mode |
(read-write) Returns or changes the current S.M.A.R.T. streaming mode. This parameter is not an enumeration, but see PL_SMT_MODES enum for the full list of supported values (SMTMODE_*). |
smart_stream_exp_params |
(read-write) Returns or changes the current list of S.M.A.R.T. streaming exposures. Please refer to S.M.A.R.T. streaming section in PVCAM User Manual for more details and possible scenarios. |
speed |
(read-write) Returns or changes the current numerical index of the speed table of a camera. After changing readout_port it is strongly recommended to re-apply the settings of speed and gain exactly in that order. See the Port and Speed Choices section inside the PVCAM User Manual for a detailed explanation about PVCAM speed tables. |
speed_name |
(read-only) Returns the name of currently selected speed via speed under selected port. It is either hard-coded generic string or provided by the camera. |
temp |
(read-only): Returns the current temperature of a camera in Celsius. |
temp_setpoint |
(read-write): Returns or changes the camera's temperature setpoint. The temperature setpoint is the temperature that a camera will attempt to keep its temperature (in Celsius) at. |
trigger_table |
(read-only) Returns a dictionary containing a table consisting of information of the last acquisition such as exposure time, readout time, clear time, pre-trigger delay, and post-trigger delay. If any of the parameters are unavailable, the dictionary item will be set to 'N/A'. |
vtm_exp_time |
(read-write): Returns or changes the exposure time the camera uses for the 'Variable Timed' exposure mode. If the camera doesn't support VTM, this property is still available but the value is ignored.Warning: New sequence acquisition must be started after setting this property to apply the value to the camera. Reading the value right after it was written will return a value from last VTM acquisition. If unsure, use get_vtm_sequence function instead. |
The constants.py is a large data file that contains various camera settings and internal PVCAM
structures used to map meaningful variable names to predefined integer values that camera firmware
interprets as settings.
This file is not (and should never be) constructed by hand. Instead, it is generated with the most
recent version of pvcam.h and by running constants_generator.py.
The pvcmodule.cpp is a set of C++ functions that make use of and extend the Python C-API known as
a Python Extension Module pvc. The need for a Python extension module is two-fold: first to allow
communication between the static PVCAM library and Python scripts, and second for fast acquisition
and conversion from native C types (namely C arrays of pixel data) to Python data types.
The extension module needs to be compiled, so it will be necessary to have a C/C++ compiler to
successfully install PyVCAM. The module will be compiled into a shared-object library,
which can then be imported from Python.
Note: All functions will always have the PyObject* self and PyObject* args parameters.
When parameters are listed, they are the Python parameters that are passed into the module.
| Function Name | Description |
|---|---|
pvc_abort |
Given a camera handle, aborts any ongoing acquisition and de-registers the frame handler callback function. Parameters:
|
pvc_check_frame_status |
Given a camera handle, returns the current frame status as a string. Possible return values:
|
pvc_check_param |
Given a camera handle and parameter ID, returns True if the parameter is available on the camera.Parameters:
|
pvc_close_camera |
Given a camera handle, closes the camera. Returns True upon success. ValueError is raised if invalid parameter is supplied. RuntimeError raised otherwise.Parameters:
|
pvc_finish_seq |
Given a camera handle, finalizes sequence acquisition and cleans up resources. If a sequence is in progress, acquisition will be aborted. Parameters:
|
pvc_get_cam_fw_version |
Given a camera handle, returns camera firmware version as a string. Parameters:
|
pvc_get_cam_name |
Given a Python integer corresponding to a camera handle, returns the name of the camera with the associate handle. Parameters:
|
pvc_get_cam_total |
Returns the total number of cameras currently attached to the system as a Python integer. |
pvc_get_frame |
Given a camera and a region, returns a Python numpy array of the pixel values of the data. Numpy array returned on success. ValueError raised if invalid parameters are supplied. MemoryError raised if unable to allocate memory for the camera frame. RuntimeError raised otherwise.Parameters:
|
pvc_get_param |
Given a camera handle, a parameter ID, and the attribute ID of the parameter in question (AVAIL, CURRENT, etc.) returns the value of the parameter at the current attribute. Note: This setting will only return a Python int or a Python string. Currently no other types are supported, but it is possible to extend the function as needed. ValueError is raised if invalid parameters are supplied. AttributeError is raised if camera does not support the specified parameter. RuntimeError is raised otherwise.Parameters:
|
pvc_get_pvcam_version |
Returns a Python Unicode String of the current PVCAM version. |
pvc_init_pvcam |
Initializes the PVCAM library. Raises RuntimeError on failure. |
pvc_open_camera |
Given a Python string corresponding to a camera name, opens the camera. Returns True upon success. ValueError is raised if invalid parameter is supplied. RuntimeError raised otherwise.Parameters:
|
pvc_read_enum |
Function that when given a camera handle and a enumerated parameter will return a list mapping all valid setting names to their values for the camera. ValueError is raised if invalid parameters are supplied. AttributeError is raised if an invalid setting for the camera is supplied. RuntimeError is raised upon failure. A Python list of dictionaries is returned upon success.Parameters:
|
pvc_reset_frame_counter |
Given a camera handle, resets frame_count returned by pvc_poll_frame to zero.Parameters:
|
pvc_reset_pp |
Given a camera handle, resets all camera post-processing parameters back to their default state. Parameters:
|
pvc_set_exp_modes |
Given a camera, exposure mode, and an expose out mode, change the camera's exposure mode to be the bitwise OR of the exposure mode and expose out mode parameters. ValueError is raised if invalid parameters are supplied including invalid modes for either exposure mode or expose out mode. RuntimeError is raised upon failure.Parameters:
|
pvc_set_param |
Given a camera handle, a parameter ID, and a new value for the parameter, set the camera's parameter to the new value. ValueError is raised if invalid parameters are supplied. AttributeError is raised when attempting to set a parameter not supported by a camera. RuntimeError is raised upon failure.Parameters:
|
pvc_setup_live |
Given a camera handle, region of interest, binning factors, exposure time and exposure mode, sets up a live mode acquisition. Returns one frame size in bytes. Parameters:
|
pvc_setup_seq |
Given a camera handle, region of interest, binning factors, exposure time and exposure mode, sets up a sequence mode acquisition. Returns one frame size in bytes. Parameters:
|
pvc_start_set_live |
Given a camera handle, region of interest, binning factors, exposure time and exposure mode, starts already sets up live mode acquisition. Parameters:
|
pvc_start_set_seq |
Given a camera handle, region of interest, binning factors, exposure time and exposure mode, starts already sets up sequence mode acquisition. Parameters:
|
pvc_start_live |
Given a camera handle, region of interest, binning factors, exposure time and exposure mode, sets up and starts a live mode acquisition. Internally combines pvc_setup_live and pvc_start_set_live. Returns one frame size in bytes.Parameters:
|
pvc_start_seq |
Given a camera handle, region of interest, binning factors, exposure time and exposure mode, sets up and starts a sequence mode acquisition. Internally combines pvc_setup_seq and pvc_start_set_seq. Returns one frame size in bytes.Parameters:
|
pvc_sw_trigger |
Given a camera handle, performs a software trigger. Prior to using this function, the camera must be set to use either the EXT_TRIG_SOFTWARE_FIRST or EXT_TRIG_SOFTWARE_EDGE exposure mode.Parameters:
|
pvc_uninit_pvcam |
Uninitializes the PVCAM library. Raises RuntimeError on failure. |
Include some basic examples on how to perform basic operations on a camera.
The change_settings_test.py is used to show one way of keeping camera settings in one file and
importing them to update a camera's settings in another file.
This allows the user to quickly change the settings they wish to test on a camera without having to dig through a large testing script and manually changing the settings within it.
Note: camera_settings.py needs to be included in the same directory in order to run this test.
The check_frame_status.py is used to demonstrate how to query frame status for both live and
sequence acquisition modes.
The live_in_subprocess.py is very similar to live_mode.py example and is used to demonstrate how
to perform live frame acquisition with PyVCAM isolated in a subprocess.
The live_mode.py is used to demonstrate how to perform live frame acquisition using the advanced
frame acquisition features of PyVCAM.
The multi_camera.py is used to demonstrate how control acquire from multiple cameras simultaneously.
The multi_rois.py is used to demonstrate how control acquire multiple regions of interest.
The newest_frame.py is used to demonstrate how to acquire both the newest frame using the optional
parameter to poll_frame.
The seq_mode.py is used to demonstrate how to perform sequence frame acquisition using the
advanced frame acquisition features of PyVCAM.
The single_image_polling.py is used to demonstrate how to collect single frames from a camera,
starting from the detection and opening of an available camera to calling the get_frame function.
Note that this test does not display the frame; only saves it locally to a variable and prints a few
pixel points from it.
If you want an example of how to quickly display a frame, see single_image_polling_show.py.
The single_image_polling_show.py is used to demonstrate how to collect a single frame from
a camera and use matplotlib's pyplot subpackage in order to display the captured frame.
Note: The test reverses the camera's sensor size when reshaping the array. This is because the camera sensor size tuple is row x column, and the shape of a numpy array is specified by column x row.
The stream_to_disk.py is used to demonstrate how to stream frames directly to disk from
a PVCAM C++ callback.
The sw_trigger.py is used to demonstrate how to perform a software trigger using two Python
threads, one to configure acquisition and one to perform the trigger.
The tests directory contains unit tests to ensure the quality of the code of the module.
The test_camera.py contains the unit tests for this module.
It tests the getting and setting properties and edge cases of all available settings.
There are unit tests running the acquisition yet.
All unit tests can be run from the command line using the command python -m unittest discover.