slmsuite.hardware.cameras.xenics.Cheetah640
- class Cheetah640(virtual=False, temperature=None, verbose=True, **kwargs)[source]
Bases:
Camera
Xeneth’s Cheetah640 camera.
- xeneth
Object to talk with the Xeneth SDK.
- Type
windll
- cam
Object to talk with the desired camera.
- Type
ptr
- profile
Current pre-configured operation mode.
'triggered'
- Captures on external trigger'free'
- Continuous capture- Type
{‘triggered’, ‘free’}
- frame_size
Size of the frame in bytes for use in grabbing data for the buffer.
- Type
int
- frame_buffer
Buffer used to grab data from the camera and sdk interface.
- Type
c_ushort array
- last_capture
Previous capture by get_image()
- Type
numpy.ndarray
- last_tag
Frame tag of last capture
- Type
numpy.uint16
- last_process_time
Time to process last frame
- Type
float
- filters
Dictionary with enabled filters. See Xeneth documentation for more information.
- Type
dict
Methods
Cancels any long, live frame captures
Adds Xenics autogain and offset filters to current filter stack.
Sets the exposure of the camera such that the maximum value is at
set_fraction
of the dynamic range.Uses an FFT contrast metric to find optimal focus when scanning over some variable
z
.Adds autogain and offset to current filter stack.
See
Camera.close()
.Deletes all current tracked filters in the stack.
Loads pre-stored imaging profile from XC_SaveSettings XCF file
Enables/disables TEC and high fan speed.
Adds captured frame number to first two pixels of an image.
See
Camera.flush()
Get the length of software frame tags.
Get number of captured frames since
start_capture()
.Main grabbing function; captures latest image into single frame buffer.
Grab
image_count
images in succession.List and get status of all addressable properties on camera.
Get the camera temperature setpoint.
Abstract method to load display information.
Checks if currently capturing
See
Camera.reset()
.Set the number of API-facing buffer frames.
Set the camera framerate.
Enables or disables low gain mode.
Sets direction of pixel readout from focal plane.
Set the camera temperature setpoint.
Set the get_frame time allowed before issuing E_NOFRAME error.
See
Camera.set_woi()
Sample pre-configured imaging profiles.
Setup frame grabber capture mode.
Configure capture control via triggering.
Configures output trigger.
Start capture, grab image, stop capture.
Initiates the current capture run
Terminates the current capture run
- __init__(virtual=False, temperature=None, verbose=True, **kwargs)[source]
Initialize camera. Default
profile
is'free'
.- Parameters
virtual (bool) – Whether or not the camera is virtual.
temperature (float or None) – Temperature in degrees celcius to set on startup.
None
defaults to no cooling.verbose (bool) – Whether or not to print camera initialization information.
kwargs – See
Camera.__init__()
for permissible options.
- Raises
RuntimeError – If the camera is not reachable.
- close()[source]
See
Camera.close()
.
- reset()[source]
See
Camera.reset()
.
- get_property_status(save_file_path=None, verbose=True)[source]
List and get status of all addressable properties on camera.
- Parameters
save_file_path (str or None) – If not
None
, the property status results will be saved to this path.verbose (True) – Prints property results if
True
.
- configure(format_file)[source]
Loads pre-stored imaging profile from XC_SaveSettings XCF file
- Parameters
format_file (str) – Path to XCF file containing format information
- set_exposure(exposure_s, verbose=True)[source]
-
- Parameters
verbose (bool) – Whether or not to print extra information.
- set_framerate(framerate)[source]
Set the camera framerate.
- Parameters
frame (int) – The framerate in fps.
Get the length of software frame tags.
- Return type
int
- set_buffer_api(frames=64)[source]
Set the number of API-facing buffer frames.
- Parameters
frames (int) – Number of buffer frames to allocate.
- set_timeout_api(timeout_ms=10000)[source]
Set the get_frame time allowed before issuing E_NOFRAME error.
Warning
Implementation unfinished and untested.
- Parameters
timeout_ms (int) – Time in ms to wait for blocking frame capture.
- set_temperature(temp_c)[source]
Set the camera temperature setpoint.
- Parameters
temp_c (float) – Temperature in degrees celcius to set on startup.
- get_temperature()[source]
Get the camera temperature setpoint.
- Returns
Temperature in degrees celcius to set on startup. -1 if the temperature could not be read.
- Return type
float
- set_readout_orientation(flip_x=True, flip_y=True)[source]
Sets direction of pixel readout from focal plane.
- Parameters
flip_x (tuple(bool)) – Whether a flip will be applied in the X or Y directions.
flip_y (tuple(bool)) – Whether a flip will be applied in the X or Y directions.
- enable_frametags(enable=False)[source]
Adds captured frame number to first two pixels of an image. Disabled by default to prevent issues with autoexposure.
- Parameters
enable (bool) – Whether to enable or disable.
- setup_input_trigger(mode=0, delay=0, source=0, skip=0, fpt=1, verbose=False)[source]
Configure capture control via triggering.
- Parameters
mode (int) –
Trigger properties.
0 means free running.
1 means level.
2 means rising edge.
3 means falling edge.
delay (float) – Trigger delay in microseconds.
source (int) –
Source of the input trigger.
0 means trigger in.
1 means software.
2 means CameraLink CC1.
skip (int) – Number of frames to skip after trigger.
fpt (int) – Frames per trigger.
verbose (bool) – Enable debug printout.
- setup_output_trigger(enable=1, mode=1, source=2, delay=0, width=10, verbose=False)[source]
Configures output trigger.
- Parameters
enable (bool) – Whether to enable the output trigger.
mode (int) –
Trigger properties.
0 means active low.
1 means active high.
source (int) –
Source of the input trigger.
0 means integration start.
1 means trigger input.
2 means integration period.
delay (float) – Trigger delay in microseconds.
width (float) – Number of frames to skip after trigger.
verbose (bool) – Enable debug printout.
- setup_grabber(mode=0, frames=4000)[source]
Setup frame grabber capture mode.
- Parameters
mode (int) –
Capture mode.
0 means circular buffer.
1 means waits till all frames grabbed before restarting capture.
2 means non-circular (Stops grabbing when buffer filled).
frames (int) – Number of frames to capture.
- set_woi(woi=None, verbose=False)[source]
See
Camera.set_woi()
- Parameters
verbose (bool) – Enable debug printout.
- set_low_gain(enable=True)[source]
Enables or disables low gain mode.
- Parameters
enable (bool) – Whether to enable or disable.
- enable_cooling(enable=True)[source]
Enables/disables TEC and high fan speed.
- Parameters
enable (bool) – Whether to enable or disable.
- setup(profile, fpt=1)[source]
Sample pre-configured imaging profiles.
Likely to be reconfigured by end-user for various imaging tasks.
- Parameters
profile – See
profile
.fpt (int) – Frames per trigger for intput trigger.
- snap(conversion=False)[source]
Start capture, grab image, stop capture.
- Parameters
conversion (bool) – Makes an internal 8 bit buffer for
xeneth.SaveData()
andxeneth.Blit()
- get_image(timeout_s=10, frame_type=0, block=True, convert=True)[source]
Main grabbing function; captures latest image into single frame buffer.
Warning
timeout_s
parameter is currently untested; setting it may lead to unintended behavior.- Parameters
timeout_s (float) – The time in seconds to wait for frames to catch up with triggers.
frame_type (FT_NATIVE, 0) – Sets type of frame conversion.
block (bool) – Blocking read; waits up to
timeout_s
for frame.convert (bool) – Makes internal 8 bit buffer, set false for max performance.
- Returns
Error code in the event of an error, otherwise the current frame.
- Return type
int, numpy.ndarray
- get_frame_number()[source]
Get number of captured frames since
start_capture()
.- Returns
Number of frames.
- Return type
int
- flush()[source]
See
Camera.flush()
- is_capturing()[source]
Checks if currently capturing
- Returns
True
if capturing,False
otherwise.- Return type
bool
- autogain(enable=True)[source]
Adds autogain and offset to current filter stack. Makes use of full dynamic range.
- Parameters
enable (bool) – Enables autogain if True.
- autoexpose_xenics(enable=True, t_settle=0)[source]
Adds Xenics autogain and offset filters to current filter stack.
Makes use of the camera’s full dynamic range.
- Parameters
enable (bool) – Enables autogain if True.
t_settle (float) – Time to allow autoexposure to settle.
- autoexposure(set_fraction=0.5, tol=0.05, exposure_bounds_s=None, window=None, average_count=5, timeout_s=5, verbose=True)[source]
Sets the exposure of the camera such that the maximum value is at
set_fraction
of the dynamic range. Useful for mitigating deleterious over- or under- exposure.- Parameters
set_fraction (float) – Fraction of camera dynamic range to target image maximum.
tol (float) – Fractional tolerance for exposure adjustment.
exposure_bounds_s ((float, float) OR None) – Shortest and longest allowable integration in seconds. If
None
, defaults toexposure_bounds_s
. If this attribute was not set (or not availible on a particular camera), thenNone
instead defaults to unbounded.window (array_like or None) – See
window
. IfNone
, the full camera frame will be used.average_count (int) – Number of frames to average intensity over for noise reduction.
timeout_s (float) – Stop attempting to autoexpose after
timeout_s
seconds.verbose (bool) – Whether to print exposure updates.
- Returns
Resulting exposure in seconds.
- Return type
float
- autofocus(z_get, z_set, z_list=None, plot=False)[source]
Uses an FFT contrast metric to find optimal focus when scanning over some variable
z
. Thisz
often takes the form of a vertical stage to position a sample precisely at the plane of imaging of a lens or objective. The contrast metric works particularly well when combined with a projected spot array hologram.- Parameters
z_get (lambda) – Gets the current position of the focusing stage. Should return a
float
.z_set (lambda) – Sets the position of the focusing stage to a given
float
.z_list (array_like or None) –
z
values to sweep over during search. Defaults (whenNone
) tonumpy.linspace(-4,4,16)
.plot (bool) – Whether to provide illustrative plots.
- get_images(image_count, flush=False)[source]
Grab
image_count
images in succession. Overwrite this implementation if a camera supports faster batch acquisition.- Parameters
image_count (int) – Number of images to grab.
flush (bool) – Whether to flush before grabbing.
- Returns
Array of shape
(image_count, height, width)
.- Return type
numpy.ndarray