pylablib.aux_libs.devices package

Submodules

pylablib.aux_libs.devices.AgilentElectronics module

class pylablib.aux_libs.devices.AgilentElectronics.AWG33220A(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Agilent AWG33220A Arbitrary Wave Generator.

Also partially works with compatible AWGs such as Agilent 33500, Rigol D1000, etc.

get_output()[source]

Check if the output is enabled

set_output(enabled=True)[source]

Turn the output on or off

get_output_polarity()[source]

Get output polarity.

Can be either "norm" or "inv".

set_output_polarity(polarity='norm')[source]

Set output polarity.

Can be either "norm" or "inv".

is_sync_output_enabled()[source]

Check if SYNC output is enabled

enable_sync_output(enabled=True)[source]

Enable or disable SYNC output

get_load()[source]

Get the output load

set_load(load=None)[source]

Set the output load (None means High-Z)

get_function()[source]

Get output function.

Can be one of the following: "sine", "square", "ramp", "pulse", "noise", "prbs", "DC", "user", "arb". Not all functions can be available, depending on the particular model of the generator.

set_function(func)[source]

Set output function.

Can be one of the following: "sine", "square", "ramp", "pulse", "noise", "prbs", "DC", "user", "arb". Not all functions can be available, depending on the particular model of the generator.

get_amplitude()[source]

Get output amplitude

set_amplitude(amplitude)[source]

Set output amplitude

get_offset()[source]

Get output offset

set_offset(offset)[source]

Set output offset

get_range()[source]

Get output voltage range.

Return tuple (vmin, vmax) with the low and high voltage values (i.e., offset-amplitude and offset+amplitude).

set_range(rng)[source]

Set output voltage range.

If span is less than 1E-4, automatically switch to DC mode.

get_frequency()[source]

Get output frequency

set_frequency(frequency)[source]

Set output frequency

get_phase()[source]

Get output phase (in degrees)

set_phase(phase)[source]

Set output phase (in degrees)

get_duty_cycle()[source]

Get output duty cycle (in percent).

Only applies to "square" output function.

set_duty_cycle(dcycle)[source]

Set output duty cycle (in percent).

Only applies to "square" output function.

get_ramp_symmetry()[source]

Get output ramp symmetry (in percent).

Only applies to "ramp" output function.

set_ramp_symmetry(rsymm)[source]

Set output ramp symmetry (in percent).

Only applies to "ramp" output function.

is_burst_enabled()[source]

Check if the burst mode is enabled

enable_burst(enabled=True)[source]

Enable burst mode

get_burst_mode()[source]

Get burst mode.

Can be either "trig" or "gate".

set_burst_mode(mode)[source]

Set burst mode.

Can be either "trig" or "gate".

get_burst_ncycles()[source]

Get burst mode ncycles.

Infinite corresponds to a large value (>1E37).

set_burst_ncycles(ncycles=1)[source]

Set burst mode ncycles.

Infinite corresponds to None

get_gate_polarity()[source]

Get burst gate polarity.

Can be either "norm" or "inv".

set_gate_polarity(polarity='norm')[source]

Set burst gate polarity.

Can be either "norm" or "inv".

get_trigger_source()[source]

Get trigger source.

Can be either "imm", "ext", or "bus".

set_trigger_source(src)[source]

Set trigger source.

Can be either "imm", "ext", or "bus".

get_trigger_slope()[source]

Get trigger slope.

Can be either "pos", or "neg".

set_trigger_slope(slope)[source]

Set trigger slope.

Can be either "pos", or "neg".

is_trigger_output_enabled()[source]

Check if the trigger output is enabled

enable_trigger_output(enabled=True)[source]

Enable trigger output

get_output_trigger_slope()[source]

Get output trigger slope.

Can be either "pos", or "neg".

set_output_trigger_slope(slope)[source]

Set output trigger slope.

Can be either "pos", or "neg".

apply_settings(settings)[source]

Apply the settings.

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

class pylablib.aux_libs.devices.AgilentElectronics.AMP33502A(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Agilent AMP3350A amplifier.

get_output(channel=None)[source]
set_output(channel, enabled=True)[source]
get_path(channel)[source]
set_path(channel, path)[source]
get_coupling(channel)[source]
set_coupling(channel, coupling)[source]
get_impedance(channel)[source]
set_impedance(channel, impedance)[source]
get_settings()[source]

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

nodes specifies nodes to acquire.

apply_settings(settings)[source]

Apply the settings.

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

class pylablib.aux_libs.devices.AgilentElectronics.N9310A(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Agilent N9310A microwave generator.

get_output()[source]
set_output(enabled=True)[source]
get_output_level()[source]
set_output_level(level)[source]
get_frequency()[source]
set_frequency(frequency)[source]
apply_settings(settings)[source]

Apply the settings.

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

class pylablib.aux_libs.devices.AgilentElectronics.HP8712B(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

HP8712B Vector Network Analyzer.

select_channel(channel)[source]
current_channel()[source]
sweep_single(wait_type='sync', count=1)[source]
sweep_reset(wait_type='sync')[source]
sweep_continuous(enable=True)[source]
is_continuous()[source]
get_output()[source]
set_output(enabled=True)[source]
get_output_level()[source]
set_output_level(level)[source]
get_avg()[source]
restart_avg()[source]
set_avg(avg=None)[source]
get_frequency_range()[source]
set_frequency_range(frequency)[source]
get_sweep_points()[source]
set_sweep_points(pts)[source]
get_bandwidth()[source]
set_bandwidth(bwidth)[source]
get_channel_format()[source]
set_channel_format(chan_fmt)[source]
get_phase_offset()[source]
set_phase_offset(offset)[source]
get_electrical_delay()[source]
set_electrical_delay(delay)[source]
set_data_format(fmt=None)[source]
get_data_format()[source]
request_data(source='data', fmt=None)[source]
read_sweep(transfer_fmt='xy')[source]
grab_single_sweep(transfer_fmt='xy', count=None)[source]
apply_settings(settings)[source]

Apply the settings.

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

class pylablib.aux_libs.devices.AgilentElectronics.HP8722D(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

HP8722D Vector Network Analyzer.

select_channel(channel)[source]
current_channel()[source]
wait_dev()[source]

Pause execution of the device commands until device overlapped commands (e.g., taking sweeps) are complete.

sweep_single(wait_type='sync', count=1)[source]
sweep_continuous(enable=True)[source]
is_continuous()[source]
get_output()[source]
set_output(enabled=True)[source]
get_output_level()[source]
set_output_level(level)[source]
set_measurement(meas)[source]
get_measurement()[source]
get_avg()[source]
restart_avg()[source]
set_avg(avg=None)[source]
get_frequency_range()[source]
set_frequency_range(frequency)[source]
get_sweep_points()[source]
set_sweep_points(pts)[source]
get_bandwidth()[source]
set_bandwidth(bwidth)[source]
get_channel_format()[source]
set_channel_format(chan_fmt)[source]
get_phase_offset()[source]
set_phase_offset(offset)[source]
get_electrical_delay()[source]
set_electrical_delay(delay)[source]
set_data_format(fmt=None)[source]
static parse_trace_data(data, fmt)[source]

Parse the data returned by the device. fmt is DataFormat description.

The data is assumed to be in a (somewhat) standard SCPI format: b'#', then a single digit s denoting length of the size block, then s digits denoting length of the data (in bytes) followed by the actual data.

request_data(fmt=None)[source]
read_sweep()[source]
grab_single_sweep(count=None)[source]
apply_settings(settings)[source]

Apply the settings.

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

pylablib.aux_libs.devices.AgilentLasers module

class pylablib.aux_libs.devices.AgilentLasers.HP8168F(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

HP8168F tunable laser.

get_output()[source]
set_output(enabled=True, force=False)[source]
get_output_level()[source]
set_output_level(level, force=False)[source]
get_wavelength()[source]
set_wavelength(wavelength, force=False)[source]
step_wavelength(step)[source]
sweep_wavelength(start, step_size, steps_number, delay, print_period=None)[source]
cycle_wavelength(step)[source]
apply_settings(settings)[source]

Apply the settings.

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

pylablib.aux_libs.devices.Altera module

Home-built Altera NIOS soft-core device.

pylablib.aux_libs.devices.Altera.float_to_sfixed(val, high, low)[source]
pylablib.aux_libs.devices.Altera.float_to_ufixed(val, high, low)[source]
pylablib.aux_libs.devices.Altera.sfixed_to_float(ival, high, low)[source]
pylablib.aux_libs.devices.Altera.ufixed_to_float(ival, high, low)[source]
class pylablib.aux_libs.devices.Altera.NIOSDevice(port_addr, timeout=3.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

comm(op, addr=0, p1=0, p2=0, timeout=1.0)[source]
query(op, addr=0, p1=0, p2=0, timeout=1.0)[source]
upstream(data, timeout=1.0)[source]
downstream(length, timeout=1.0)[source]
peripheral_comm(dev, write_data='', read_length=0, timeout=1.0)[source]
restart(full=False)[source]
write_ram(addr, value, mask=4294967295)[source]
read_ram(addr)[source]
write_ram_sfixed(addr, value, high, low, shift=0, mask=None)[source]
read_ram_sfixed(addr, high, low, shift=0, mask=None)[source]
upstream_ram_bank(bank, data, start=0)[source]
zero_ram_bank(bank, size, start=0)[source]
downstream_ram_bank(bank, size, start=0)[source]
class pylablib.aux_libs.devices.Altera.FPGAController(port_addr, timeout=3.0)[source]

Bases: pylablib.aux_libs.devices.Altera.NIOSDevice

set_reg(reg, value)[source]
get_reg(reg, translate_enum=True)[source]
set_pulses(period, w1, d, w2=None)[source]
set_feedback_setpoint(setpoint)[source]
enable_feedback(enabled=True, base_level=3.0)[source]
teach_feedback(delay=10.0, reset=True)[source]
W5500_read(block, addr, l)[source]
W5500_write(block, addr, data, readback=True)[source]

pylablib.aux_libs.devices.Andor module

exception pylablib.aux_libs.devices.Andor.AndorError[source]

Bases: RuntimeError

Generic Andor camera error.

exception pylablib.aux_libs.devices.Andor.AndorTimeoutError[source]

Bases: pylablib.aux_libs.devices.Andor.AndorError

Timeout while waiting.

exception pylablib.aux_libs.devices.Andor.AndorNotSupportedError[source]

Bases: pylablib.aux_libs.devices.Andor.AndorError

Option not supported.

pylablib.aux_libs.devices.Andor.get_cameras_number()[source]

Get number of connected Andor cameras

class pylablib.aux_libs.devices.Andor.AndorCamera(idx=0, ini_path='')[source]

Bases: pylablib.core.devio.interface.IDevice

Andor camera.

Caution: the manufacturer DLL is designed such that if the camera is not closed on the program termination, the allocated resources are never released. If this happens, these resources are blocked until the complete OS restart.

Parameters:
  • idx (int) – camera index (use get_cameras_number() to get the total number of connected cameras)
  • ini_path (str) – path to .ini file, if required by the camera
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

is_opened()[source]

Check if the device is connected

class ModelData(controller_model, head_model, serial_number)

Bases: tuple

controller_model
head_model
serial_number
get_model_data()[source]

Get camera model data.

Return tuple (controller_mode, head_model, serial_number).

get_status()[source]

Get camera status.

Return either "idle" (no acquisition), "acquiring" (acquisition in progress) or "temp_cycle" (temperature cycle in progress).

get_capabilities()[source]

Get camera capabilities.

For description of the structure, see Andor SDK manual.

get_pixel_size()[source]

Get camera pixel size (in m)

is_cooler_on()[source]

Check if the cooler is on

set_cooler(on=True)[source]

Set the cooler on or off

get_temperature_status()[source]

Get temperature status.

Can return "off" (cooler off), "not_reached" (cooling in progress), "not_stabilized" (reached but not stabilized yet), "stabilized" (completely stabilized) or "drifted".

get_temperature()[source]

Get the current camera temperature

set_temperature(temperature, enable_cooler=True)[source]

Change the temperature setpoint.

If enable_cooler==True, turn the cooler on automatically.

get_temperature_setpoint()[source]
get_all_amp_modes()[source]

Get all available pream modes.

Each preamp mode is characterized by an AD channel index, amplifier index, channel speed (horizontal scan speed) index and preamp gain index. Return list of tuples (channel, channel_bitdepth, oamp, oamp_kind, hsspeed, hsspeed_MHz, preamp, preamp_gain), where channel, oamp, hsspeed and preamp are indices, while channel_bitdepth, oamp_kind, hsspeed_MHz and preamp_gain are descriptions.

get_max_vsspeed()[source]

Get maximal recommended vertical scan speed

set_amp_mode(channel=None, oamp=None, hsspeed=None, preamp=None)[source]

Setup preamp mode.

Can specify AD channel index, amplifier index, channel speed (horizontal scan speed) index and preamp gain index. None (default) means leaving the current value.

set_vsspeed(vsspeed)[source]

Set vertical scan speed index

get_channel_bitdepth(channel=None)[source]

Get channel bit depth corresponding to the given channel index (current by default)

get_oamp_desc(oamp=None)[source]

Get output amplifier kind corresponding to the given oamp index (current by default)

get_hsspeed_frequency(hsspeed=None)[source]

Get horizontal scan frequency (in Hz) corresponding to the given hsspeed index (current by default)

get_preamp_gain(preamp=None)[source]

Get preamp gain corresponding to the given preamp index (current by default)

get_vsspeed_period(vsspeed=None)[source]

Get vertical scan period corresponding to the given vsspeed index (current by default)

get_EMCCD_gain()[source]

Get current EMCCD gain.

Return tuple (gain, advanced).

set_EMCCD_gain(gain, advanced=None)[source]

Set EMCCD gain.

Gain goes up to 300 if advanced==False or higher if advanced==True (in this mode the sensor can be permanently damaged by strong light).

init_speeds()[source]

Initialize the camera channel, frequencies and amp settings to some default mode

get_min_shutter_times()[source]

Get minimal shutter opening and closing times

set_shutter(mode, ttl_mode=0, open_time=None, close_time=None)[source]

Setup shutter.

mode can be "auto", "open" or "close", ttl_mode can be 0 (low is open) or 1 (high is open), open_time and close_time specify opening and closing times (required to calculate the minimal exposure times). By default, these time are minimal allowed times.

set_fan_mode(mode)[source]

Set fan mode.

Can be "full", "low" or "off".

read_in_aux_port(port)[source]

Get state at a given auxiliary port

set_out_aux_port(port, state)[source]

Set state at a given auxiliary port

set_trigger_mode(mode)[source]

Set trigger mode.

Can be "int" (internal), "ext" (external), "ext_start" (external start), "ext_exp" (external exposure), "ext_fvb_em" (external FVB EM), "software" (software trigger) or "ext_charge_shift" (external charge shifting).

For description, see Andor SDK manual.

get_trigger_level_limits()[source]

Get limits on the trigger level

setup_ext_trigger(level, invert, term_highZ=True)[source]

Setup external trigger (level, inversion, and high-Z termination)

send_software_trigger()[source]

Send software trigger signal

set_acquisition_mode(mode)[source]

Set acquisition mode.

Can be "single", "accum", "kinetics", "fast_kinetics" or "cont" (continuous). For description of each mode, see Andor SDK manual and corresponding setup_*_mode functions.

setup_accum_mode(num, cycle_time=0)[source]

Setup accum acquisition mode.

num is the number of accumulated frames, cycle_time is the acquisition period (by default the minimal possible based on exposure and transfer time).

setup_kinetic_mode(num, cycle_time=0.0, num_acc=1, cycle_time_acc=0, num_prescan=0)[source]

Setup kinetic acquisition mode.

num is the number of kinetic cycles frames, cycle_time is the acquisition period between accum frames, num_accum is the number of accumulated frames, cycle_time_acc is the accum acquisition period, num_prescan is the number of prescans.

setup_fast_kinetic_mode(num, cycle_time_acc=0.0)[source]

Setup fast kinetic acquisition mode.

num is the number of accumulated frames, cycle_time is the acquisition period (by default the minimal possible based on exposure and transfer time).

setup_cont_mode(cycle_time=0)[source]

Setup continuous acquisition mode.

cycle_time is the acquisition period (by default the minimal possible based on exposure and transfer time).

set_exposure(exposure)[source]

Set camera exposure

get_exposure()[source]

Get current exposure

enable_frame_transfer_mode(enable=True)[source]

Enable frame transfer mode.

For description, see Andor SDK manual.

class AcqTimes(exposure, accum_cycle_time, kinetic_cycle_time)

Bases: tuple

accum_cycle_time
exposure
kinetic_cycle_time
get_timings()[source]

Get acquisition timing.

Return tuple (exposure, accum_cycle_time, kinetic_cycle_time). In continuous mode, the relevant cycle time is kinetic_cycle_time.

get_readout_time()[source]

Get frame readout time

get_keepclean_time()[source]

Get sensor keep-clean time

prepare_acquisition()[source]

Prepare acquisition.

Isn’t required (called automatically on acquisition start), but decreases time required for starting acquisition later.

start_acquisition(setup=True)[source]

Start acquisition.

If setup==True, setup the acquisition parameters before the start (they don’t apply automatically when the mode is changed).

stop_acquisition()[source]

Stop acquisition

class AcqProgress(frames_done, cycles_done)

Bases: tuple

cycles_done
frames_done
get_progress()[source]

Get acquisition progress.

Return tuple (frames_done, cycles_done) (these are different in accum or kinetic mode).

wait_for_frame(since='lastwait', timeout=20.0)[source]

Wait for a new camera frame.

since specifies what constitutes a new frame. Can be "lastread" (wait for a new frame after the last read frame), "lastwait" (wait for a new frame after last wait_for_frame() call), or "now" (wait for a new frame acquired after this function call). If timeout is exceeded, raise AndorTimeoutError.

cancel_wait()[source]

Cancel wait

pausing_acquisition()[source]

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

Useful for applying certain settings which can’t be changed during the acquisition.

get_detector_size()[source]

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

set_read_mode(mode)[source]

Set camera read mode.

Can be "fvb" (average all image vertically and return it as one row), "single_track" (read a single row or several rows averaged together), "multi_track" (read multiple rows or averaged sets of rows), "random_track" (read several arbitrary lines), or "image" (read a whole image or its rectangular part).

setup_single_track_mode(center=0, width=1)[source]

Setup singe-track read mode.

center and width specify selection of the rows to be averaged together.

setup_multi_track_mode(number=1, height=1, offset=1)[source]

Setup multi-track read mode.

number is the number of rows (or row sets) to read, height is number of one row set (1 for a single row), offset is the distance between the row sets.

setup_random_track_mode(tracks=None)[source]

Setup random track read mode.

tracks is a list of tuples (start, stop) specifying track span (start are inclusive, stop are exclusive, starting from 0)

setup_image_mode(hstart=0, hend=None, vstart=0, vend=None, hbin=1, vbin=1)[source]

Setup image read mode.

hstart and hend specify horizontal image extent, vstart and vend specify vertical image extent (start are inclusive, stop are exclusive, starting from 0), hbin and vbin specify binning.

get_roi()[source]

Get current ROI.

Return tuple (hstart, hend, vstart, vend, hbin, vbin).

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

Setup camera ROI.

hstart and hend specify horizontal image extent, vstart and vend specify vertical image extent (start are inclusive, stop are exclusive, starting from 0), hbin and vbin specify binning. By default, all non-supplied parameters take extreme values.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 6-tuple describing the ROI.

get_data_dimensions(mode=None, params=None)[source]

Get readout data dimensions for given read mode and read parameters (current by default)

read_newest_image(peek=False)[source]

Read the newest image.

If peek==True, return the image but not mark it as read.

read_oldest_image()[source]

Read the oldest un-read image in the buffer.

dim specifies image dimensions (by default use dimensions corresponding to the current camera settings).

get_buffer_size()[source]

Get the size of the image ring buffer

get_new_images_range()[source]

Get the range of the new images.

Return tuple (first, last) with images range (inclusive). If no images are available, return None.

read_multiple_images(rng=None)[source]

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

dim specifies images dimensions (by default use dimensions corresponding to the current camera settings).

flush_buffer()[source]

Flush the camera buffer (restart the acquisition)

snap()[source]

Snap a single image (with preset image read mode parameters)

pylablib.aux_libs.devices.Andor.get_cameras_number_SDK3()[source]

Get number of connected Andor cameras

class pylablib.aux_libs.devices.Andor.AndorSDK3Camera(idx=0)[source]

Bases: pylablib.core.devio.interface.IDevice

Andor SDK3 camera.

Parameters:idx (int) – camera index (use get_cameras_number_SDK3() to get the total number of connected cameras)
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

is_opened()[source]

Check if the device is connected

is_feature_available(name)[source]

Check if given feature is available

is_feature_readable(name)[source]

Check if given feature is available

is_feature_writable(name)[source]

Check if given feature is available

get_value(name, kind='auto', enum_str=True, default='error')[source]

Get current value of the given feature.

kind determines feature kind, can be "int", "float", "str", "bool" or "enum”; by default ("auto"), auto-determine value kind (might not work for newer features). If enum_str==True, return enum values as strings; otherwise, return as indices. If default=="error", raise AndorError if the feature is not implemented; otherwise, return default if it is not implemented.

set_value(name, value, kind='auto', not_implemented_error=True)[source]

Set current value of the given feature.

kind determines feature kind, can be "int", "float", "str", "bool" or "enum”; by default ("auto"), auto-determine value kind (might not work for newer features).

If not_implemented_error==True and the feature is not implemented, raise AndorError; otherwise, do nothing.

command(name)[source]

Execute given command

get_value_range(name, kind='auto', enum_str=True)[source]

Get allowed rande of the given value.

kind determines feature kind, can be "int", "float", "str", "bool" or "enum”; by default ("auto"), auto-determine value kind (might not work for newer features).

For "int" or "float" values return tuple (min, max) (inclusive); for "enum" return list of possible values (if enum_str==True, return list of string values, otherwise return list of indices). For all other value kinds return None.

limit_value(name, value)[source]

Limit value to lie within the allowed range

get_all_values(enum_str=True)[source]

Get all readable values.

If enum_str==True, return enum values as strings; otherwise, return as indices.

class ModelData(camera_model, serial_number, firmware_version, software_version)

Bases: tuple

camera_model
firmware_version
serial_number
software_version
get_model_data(enum_str=True)[source]

Get camera model data.

Return tuple (camera_model, serial_number, firmware_version, software_version).

get_trigger_mode()[source]

Get trigger mode.

Can be "int" (internal), "ext" (external), "software" (software trigger),
"ext_start" (external start), or "ext_exp" (external exposure).
set_trigger_mode(mode)[source]

Set trigger mode.

Can be "int" (internal), "ext" (external), or "software" (software trigger).

get_shutter()[source]

Get current shutter mode

set_shutter(mode)[source]

Set trigger mode.

Can be "open", "closed", or "auto".

is_cooler_on()[source]

Check if the cooler is on

set_cooler(on=True)[source]

Set the cooler on or off

get_temperature()[source]

Get the current camera temperature

get_temperature_setpoint()[source]

Get current temperature setpoint.

set_temperature(temperature, enable_cooler=True)[source]

Change the temperature setpoint.

If enable_cooler==True, turn the cooler on automatically.

get_exposure()[source]

Get current exposure

set_exposure(exposure, set_min_readout_time=True)[source]

Set camera exposure

get_readout_time()[source]
set_readout_time(readout_time)[source]
class AcqTimes(exposure, accum_cycle_time, kinetic_cycle_time)

Bases: tuple

accum_cycle_time
exposure
kinetic_cycle_time
get_timings()[source]

Get acquisition timing.

Return tuple (exposure, accum_cycle_time, kinetic_cycle_time). In continuous mode, the relevant cycle time is kinetic_cycle_time.

class BufferManager(cam)[source]

Bases: object

Buffer manager: stores, constantly reads and re-schedules buffers, keeps track of acquired and read frames, and of buffer overflow events

allocate_buffers(nbuff, size, queued_buffers=None)[source]

Allocate and queue buffers.

queued_buffers` specifies number of allocated buffers to keep queued at aagiven time (by default, all of them)

deallocate_buffers()[source]

Deallocated buffers (flushing should be done manually)

reset(buffer_overflows=0)[source]

Reset counter (on frame acquisition)

read(skip=False)[source]

Return the oldest available acuqired but not read buffer, and mark it as read

start_loop()[source]

Start buffer scheduling loop

stop_loop()[source]

Stop buffer scheduling loop

overflow()[source]

Process buffer overflow event

new_overflow()[source]

Check if acquisition restart is needed (buffer overflowed)

get_status()[source]

Get counter status: tuple (acquired, read, missed, buffer_size, buffer_overflows)

start_acquisition(mode='sequence', nframes=None)[source]

Start acquisition.

mode can be either "snap" (since frame or sequency acquisition) or "sequence" (continuous acquisition). nframes determines number of frames to acquire in "snap" mode, or size of the ring buffer in the "sequence" mode (by default, 100).

stop_acquisition()[source]

Stop acquisition

is_acquiring()[source]

Check if acquisition is in progress

pausing_acquisition()[source]

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

Useful for applying certain settings which can’t be changed during the acquisition.

wait_for_frame(since='lastread', timeout=20.0, period=0.001)[source]

Wait for a new camera frame.

since specifies what constitutes a new frame. Can be "lastread" (wait for a new frame after the last read frame), "lastwait" (wait for a new frame after last wait_for_frame() call), or "now" (wait for a new frame acquired after this function call). If timeout is exceeded, raise AndorTimeoutError. period specifies camera polling period.

create_ring_buffer(nframes=None)[source]

Create and set up a new ring buffer.

If a ring buffer is already allocated, remove it and create a new one. Called automatically on acquisition start, doesn’t usually need to be called explicitly.

remove_ring_buffer()[source]

Remove the ring buffer and clean up the memory.

Called automatically on acquisition stop, doesn’t usually need to be called explicitly.

get_buffer_size()[source]

Get ring buffer size

get_frame_counter_status()[source]

Get frame counter status.

Return tuple (acquired, read, missed, buffer_size, buffer_overflows) with number of acquired frames, read (or skipped) frames, missed frame, and number of buffer overflows.

get_data_dimensions()[source]

Get readout data dimensions

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, hbin, vbin).

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

Set current ROI.

By default, all non-supplied parameters take extreme values. Binning is the same for both axes.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 6-tuple describing the ROI.

get_new_images_range()[source]

Get the range of the new images.

Return tuple (first, last) with images range (inclusive). If no images are available, return None.

read_multiple_images(rng=None, return_metadata=False)[source]

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

If return_metadata==True, return raw metadata along with images. Metadata is a dictionary {section: data}, where section is the section number (usually 1 or 7), and data is the corresponding binary data string.

snap()[source]

Snap a single image (with preset image read mode parameters)

pylablib.aux_libs.devices.AndorSDK3_lib module

Used by autodoc_mock_imports.

pylablib.aux_libs.devices.AndorShamrock module

exception pylablib.aux_libs.devices.AndorShamrock.ShamrockError[source]

Bases: RuntimeError

Generic Andor Shamrock error.

exception pylablib.aux_libs.devices.AndorShamrock.ShamrockNotSupportedError[source]

Bases: pylablib.aux_libs.devices.AndorShamrock.ShamrockError

Option not supported.

pylablib.aux_libs.devices.AndorShamrock.get_spectrographs_number()[source]

Get number of connected Andor cameras

class pylablib.aux_libs.devices.AndorShamrock.ShamrockSpectrograph(idx=0)[source]

Bases: pylablib.core.devio.interface.IDevice

Shaprock spectrograph.

Parameters:idx (int) – spectrograph index (starting from 0; use get_spectrographs_number() to get the total number of connected spectrogaphs)
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

is_opened()[source]

Check if the device is connected

class ModelData(serial_number)

Bases: tuple

serial_number
get_model_data()[source]

Get camera model data.

Return tuple (serial_number).

class OpticalParameters(focal_length, angular_deviation, focal_tilt)

Bases: tuple

angular_deviation
focal_length
focal_tilt
get_optical_parameters()[source]

Get device optical parameters.

Return tuple (focal_length, angular_deviation, focal_tilt).

get_gratings_number()[source]

Get number of gratings

get_grating()[source]

Get current grating index (counting from 1)

set_grating(grating, force=False)[source]

Set current grating (counting from 1)

Call blocks until the grating is exchanged (up to 10-20 seconds). If force==False and the current grating index is the same as requested, skip the call; otherwise, call the grating set command regardless (takes about a second in the grating is unchaged).

class GratingInfo(lines, blaze_wavelength, home, offset)

Bases: tuple

blaze_wavelength
home
lines
offset
get_grating_info(grating=None)[source]

Get info of a given grating (by default, current grating).

Return tuple (lines, blaze_wavelength, home, offset) (blazing wavelength is in nm).

get_grating_offset(grating=None)[source]

Get grating offset (in steps) for a given grating (by default, current grating)

set_grating_offset(offset, grating=None)[source]

Set grating offset (in steps) for a given grating (by default, current grating)

get_detector_offset()[source]

Get detector offset (in steps)

set_detector_offset(offset)[source]

Set detector offset (in steps)

get_turret()[source]

Get turrent

set_turret(turret)[source]

Set turret

is_wavelength_control_present()[source]

Check if wavelength control is present

get_wavelength()[source]

Get current central wavelength (in m)

set_wavelength(wavelength)[source]

Get current central wavelength (in m)

get_wavelength_limits(grating=None)[source]

Get wavelength limits (in m) for a given grating (by default, current grating)

reset_wavelength()[source]

Reset current wavelength to 0 nm

is_at_zero_order()[source]

Check if current grating is at zero order

goto_zero_order()[source]

Set current grating to zero order

is_slit_present(slit)[source]

Check if the slit is present.

slit cen be either a slit index (starting from 1), or one of the following: "input_side", "input_direct", "output_side", or "output_direct".

get_slit_width(slit)[source]

Get slit width (in m).

slit cen be either a slit index (starting from 1), or one of the following: "input_side", "input_direct", "output_side", or "output_direct".

set_slit_width(slit, width)[source]

Set slit width (in m).

slit cen be either a slit index (starting from 1), or one of the following: "input_side", "input_direct", "output_side", or "output_direct".

reset_slit(slit)[source]

Reset slit to the default width (10 um).

slit cen be either a slit index (starting from 1), or one of the following: "input_side", "input_direct", "output_side", or "output_direct".

is_shutter_present()[source]

Check if the shutter is present

get_shutter()[source]

Get shutter mode.

Can return "closed", "opened", or "not_set".

set_shutter(mode)[source]

Set shutter mode

is_filter_present()[source]

Check if the filter is present

get_filter()[source]

Get current filter

set_filter(filter)[source]

Set current flilter

get_filter_info(filter)[source]

Get info of the given filter

reset_filter()[source]

Reset flilter to default position

is_flipper_present(flipper)[source]

Check if the flipper is present.

flipper cen be either a flipper index (starting from 1), or one of the following: "input", or “output”`.

get_flipper_port(flipper)[source]

Get flipper port.

flipper cen be either a flipper index (starting from 1), or one of the following: "input", or “output”`. Return either "direct" or "side".

set_flipper_port(flipper, port)[source]

Set flipper port.

flipper cen be either a flipper index (starting from 1), or one of the following: "input", or “output”`. Port can be a numerical value (0 or 1), "direct", or "side".

reset_flipper(flipper)[source]

Reset flipper to the default state.

flipper cen be either a flipper index (starting from 1), or one of the following: "input", or “output”`.

is_accessory_present()[source]

Check if the accessory is present

get_accessory_state(line)[source]

Get current accessory state on a given line (1 or 2)

set_accessory_state(line, state)[source]

Set current accessory state (0 or 1) on a given line (1 or 2)

get_pixel_width()[source]

Get current set detector pixel width (in m)

set_pixel_width(width)[source]

Set current detector pixel width (in m)

get_number_pixels()[source]

Get current set detector number of pixels

set_number_pixels(number)[source]

Set current detector number of pixels

setup_from_camera(cam)[source]

Setup detector parameters (number of pixels, pixel width) from the camera

get_calibration()[source]

Get wavelength calibration.

Return numpy array with number equal preset number of detector pixels, which specifies wavelength (in m) corresponding to each pixel.

pylablib.aux_libs.devices.AndorShamrock_lib module

exception pylablib.aux_libs.devices.AndorShamrock_lib.ShamrockLibError(func, code)[source]

Bases: RuntimeError

Generic Andor Shamrock library error

pylablib.aux_libs.devices.AndorShamrock_lib.errcheck(passing=None)[source]

Build an error checking function.

Return a function which checks return codes of Andor Shamrock library functions. passing is a list specifying which return codes are acceptable (by default only 20002, which is success code, is acceptable).

class pylablib.aux_libs.devices.AndorShamrock_lib.ShamrockLib[source]

Bases: object

initlib()[source]
open_handle(path='')[source]
close_handle()[source]
using_handle()[source]

pylablib.aux_libs.devices.Andor_lib module

Used by autodoc_mock_imports.

pylablib.aux_libs.devices.Arcus module

exception pylablib.aux_libs.devices.Arcus.ArcusError[source]

Bases: RuntimeError

Generic Arcus error.

class pylablib.aux_libs.devices.Arcus.GenericPerformaxStage(lib_path=None, idx=0)[source]

Bases: pylablib.core.devio.interface.IDevice

Generic Arcus Performax translation stage.

Parameters:
  • lib_path (str) – path to the PerformaxCom.dll (default is to use the library supplied with the package)
  • idx (int) – stage index
static get_devices_num(lib_path=None)[source]

Get number of connected Arcus devices

open()[source]

Open the connection to the stage

close()[source]

Close the connection to the stage

is_opened()[source]

Check if the device is connected

get_device_id()[source]

Get the device ID

query(comm)[source]

Send a query to the stage and return the reply

class pylablib.aux_libs.devices.Arcus.Performax4EXStage(lib_path=None, idx=0)[source]

Bases: pylablib.aux_libs.devices.Arcus.GenericPerformaxStage

Arcus Performax 4EX translation stage.

Parameters:
  • lib_path (str) – path to the PerformaxCom.dll (default is to use the library supplied with the package)
  • idx (int) – stage index
set_absolute_mode()[source]

Set absolute motion mode

ignore_limit_errors(do_ignore=True)[source]

Switch ignoring limit errors on or off.

If on, limit error on one axis doesn’t stop other axes.

is_ignoring_limit_errors()[source]

Check if ignoring limit errors is on.

If on, limit error on one axis doesn’t stop other axes.

enable_output(axis, enable=True)[source]

Enable axis output.

If the output is disabled, the steps are generated by the controller, but not sent to the motors.

enable_all_outputs(enable=True)[source]

Enable output on all axes

get_position(axis)[source]

Get the current axis position

set_position_reference(axis, position=0)[source]

Set the current axis position as a reference.

Re-calibrate the position encoder so that the current position is set as position (0 by default).

move_to(axis, position)[source]

Move a given axis to a given position

move(axis, steps=1)[source]

Move a given axis for a given number of steps

jog(axis, direction)[source]

Jog a given axis in a given direction.

direction can be either "-" (negative) or "+" (positive). The motion continues until it is explicitly stopped, or unitl a limit is hit.

stop(axis)[source]

Stop motion of a given axis

stop_all()[source]

Stop motion of all axes

get_speed()[source]

Get the global speed setting (in Hz)

get_axis_speed(axis)[source]

Get the individual axis speed setting (in Hz)

set_speed(speed)[source]

Set the global speed setting (in Hz)

set_axis_speed(axis, speed)[source]

Set the individual axis speed setting (in Hz)

get_status_n(axis)[source]

Get the axis status as an integer

get_status(axis)[source]

Get the axis status as a set of string descriptors

is_moving(axis)[source]

Check if a given axis is moving

check_limit_error(axis)[source]

Check if the axis hit limit errors.

Return "" (not errors), "+" (positive limit error) or "-" (negative limit error).

clear_limit_error(axis)[source]

Clear axis limit errors

pylablib.aux_libs.devices.Arcus.PerformaxStage

alias of pylablib.aux_libs.devices.Arcus.Performax4EXStage

pylablib.aux_libs.devices.Arduino module

Home-built Arduino devices.

class pylablib.aux_libs.devices.Arduino.IArduinoDevice(port_addr, rate=9600, timeout=10.0, term_write='n', term_read='n')[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Generic Arduino device.

ctrl_reset()[source]
comm(comm, timeout=None, flush=False, flush_delay=0.02)[source]
query(query, timeout=None, flush=False, flush_delay=0.02)[source]
class pylablib.aux_libs.devices.Arduino.FilterCavityLock(port_addr)[source]

Bases: pylablib.aux_libs.devices.Arduino.IArduinoDevice

get_mode()[source]
wait_for_mode(mode, delay=0.5)[source]
reset(sync=False)[source]
lock(sync=False)[source]

Lock the access to the device from other threads/processes (isn’t necessarily implemented).

sweep()[source]
idle()[source]
reset_stat()[source]
class LevelStat(cal_min, cal_max, meas_min, meas_max)

Bases: tuple

cal_max
cal_min
meas_max
meas_min
get_stat()[source]
get_deviations()[source]
class pylablib.aux_libs.devices.Arduino.DAQDevice(port_addr)[source]

Bases: pylablib.aux_libs.devices.Arduino.IArduinoDevice

get_rate()[source]
get_binning()[source]
set_binning(binning)[source]
set_binning_time(binning_time, repeat=True)[source]
get_active_channels()[source]
set_active_channels(channels)[source]
get_input(channel)[source]
get_all_inputs()[source]
get_output(channel)[source]
get_all_outputs()[source]
set_output(channel, value)[source]
class pylablib.aux_libs.devices.Arduino.OpticalSwitchController(port_addr)[source]

Bases: pylablib.aux_libs.devices.Arduino.IArduinoDevice

get_state()[source]
switch(state)[source]
class pylablib.aux_libs.devices.Arduino.RelaylSwitchController(port_addr)[source]

Bases: pylablib.aux_libs.devices.Arduino.IArduinoDevice

Arduino controller for the remote-controlled BNC inverter board.

get_state()[source]

Get relay switch state

switch(state)[source]

Set relay switch state

pylablib.aux_libs.devices.Attocube module

exception pylablib.aux_libs.devices.Attocube.AttocubeError[source]

Bases: RuntimeError

Generic Attocube error

class pylablib.aux_libs.devices.Attocube.ANC300(conn, backend='auto', pwd='123456')[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Attocube ANC300 controller.

Parameters:
  • conn – connection parameters; for Ethernet connection is a tuple (addr, port) or a string "addr:port"
  • backend (str) – communication backend; by default, try to determine from the communication parameters
  • pwd (str) – connection password for Ethernet connection (default is "123456")
open()[source]

Open the connection to the stage

query(msg)[source]

Send a query to the stage and return the reply

update_available_axes()[source]

Update the list of available axes.

Need to call only if the hardware configuration of the ANC module has changed.

set_mode(axis='all', mode='stp')[source]

Set axis mode.

axis is either an axis index (starting from 1), or "all" (all axes). mode is "gnd" (ground) or "stp" (step).

get_mode(axis='all')[source]

Get axis mode

axis is either an axis index (starting from 1), or "all" (all axes).

enable_axis(axis, mode='stp')[source]

Enable specific axis (set to step mode)

disable_axis(axis)[source]

Disable specific axis (set to ground mode)

enable_all(mode='stp')[source]

Enable all axes (set to step mode)

disable_all()[source]

Disable all axes (set to ground mode)

measure_capacitance(axis='all', wait=True)[source]

Measure axis capacitance; finish in the GND mode.

If wait==True, wait until the capacitance measurement is finished (takes about a second per axis).

get_voltage(axis)[source]

Get axis step voltage in Volts

set_voltage(axis, voltage)[source]

Set axis step voltage in Volts

get_offset(axis)[source]

Get axis offset voltage in Volts

set_offset(axis, voltage)[source]

Set axis offset voltage in Volts

get_output(axis)[source]

Get axis current output voltage in Volts

get_frequency(axis)[source]

Get axis step frequency in Hz

set_frequency(axis, freq)[source]

Set axis step frequency in Hz

get_capacitance(axis, measure=False)[source]

Get capacitance measurement on the axis.

If measure==True, re-measure axis capacitance (takes about a second); otherwise, get the last measurement value.

get_all_voltages()[source]

Get the list of all axes step voltages

get_all_offsets()[source]

Get the list of all axes offset voltages

get_all_outputs()[source]

Get the list of all axes offset voltages

get_all_frequencies()[source]

Get the list of all axes step frequencies

get_all_capacitances(measure=False)[source]

Get the list of all axes capacitances

If measure==True, re-measure axes capacitances (takes about a secon0d per axis); otherwise, get the last measurement values.

set_all_voltages(voltages)[source]

Get all axes step voltages.

voltages is a list of step voltage, whose length is equal to the number of active (connected) axes.

set_all_offsets(offsets)[source]

Get all axes offset voltages

offsets is a list of offset voltags, whose length is equal to the number of active (connected) axes.

set_all_frequencies(frequencies)[source]

Get all axes step frequencies

frequencies is a list of step frequencies, whose length is equal to the number of active (connected) axes.

set_axis_correction(axis, factor=1.0)[source]

Set axis correction factor.

The factor is automatically applied when the motion is in the negative direction.

move(axis, steps=1)[source]

Move a given axis for a given number of steps

wait_for_axis(axis, timeout=30.0)[source]

Wait for a given axis to stop moving.

If the motion is not finished after timeout seconds, raise a backend error.

is_moving(axis)[source]

Check if a given axis is moving

stop(axis)[source]

Stop motion of a given axis

stop_all()[source]

Stop motion of all axes

pylablib.aux_libs.devices.Attocube.ANCDevice

alias of pylablib.aux_libs.devices.Attocube.ANC300

class pylablib.aux_libs.devices.Attocube.ANC350(conn=0, timeout=5.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Attocube ANC350 controller.

Parameters:
  • conn – connection parameters - index of the Attocube ANC350 in the system (for a single controller leave 0)
  • timeout (float) – default operation timeout
class Telegram(opcode, address, index, data, corr_number)

Bases: tuple

address
corr_number
data
index
opcode
class Reply(address, index, reason, data)

Bases: tuple

address
data
index
reason
check_tell(timeout=0.01)[source]

Check for queued TELL (periodic value update) commands

set_value(address, index, value, ack=False, return_reason=False)[source]

Set device value at the given address and index.

If ack==True, request ACK responds and return its value; otherwise, return immediately after set. If return_reason==True, return tuple (result, reason); otherwise, simply return result.

get_value(address, index, as_int=True, return_reason=False)[source]

Get device value at the given address and index.

If as_int==True, convert the result into a signed integer; otherwise return raw byte string. If return_reason==True, return tuple (result, reason); otherwise, simply return result.

enable_updates(enabled=True)[source]

Enable or disable periodic TELL updates

get_hardware_id()[source]

Return device HWID (by default -1)

is_axis_connected(axis)[source]

Check if axis is connected

enable_axis(axis)[source]

Enable specific axis

disable_axis(axis)[source]
enable_all()[source]

Enable all axes (set to step mode)

disable_all()[source]

Disable all axes (set to ground mode)

get_voltage(axis)[source]

Get axis step voltage in Volts

set_voltage(axis, voltage)[source]

Set axis step voltage in Volts

get_offset(axis)[source]

Get axis offset voltage in Volts

set_offset(axis, voltage)[source]

Set axis offset voltage in Volts

get_frequency(axis)[source]

Get axis step frequency in Hz

set_frequency(axis, freq)[source]

Set axis step frequency in Hz

get_all_voltages()[source]

Get the list of all axes step voltages

get_all_offsets()[source]

Get the list of all axes offset voltages

get_all_frequencies()[source]

Get the list of all axes step frequencies

get_all_positions()[source]

Get the list of all axes positions

get_all_target_positions()[source]

Get the list of all axes target positions

set_all_voltages(voltages)[source]

Get all axes step voltages.

voltages is a list of step voltage, whose length is equal to the number of active (connected) axes.

set_all_offsets(offsets)[source]

Get all axes offset voltages

offsets is a list of offset voltags, whose length is equal to the number of active (connected) axes.

set_all_frequencies(frequencies)[source]

Get all axes step frequencies

frequencies is a list of step frequencies, whose length is equal to the number of active (connected) axes.

get_position(axis)[source]

Get axis position (in m)

move_to(axis, position)[source]

Move to target position (in m)

move(axis, steps=1)[source]

Move a given axis for a given number of steps

is_moving(axis)[source]

Move a given axis for a given number of steps

get_target_position(axis)[source]

Get the target position for the given axis

is_target_reached(axis, precision=1e-09)[source]

Check if the target position is reached.

Precision sets the final positioning precision (in m).

wait_for_axis(axis, precision=1e-09, timeout=10.0, period=0.01)[source]

Wait for a given axis to stop moving or to reach target position.

If the motion is not finished after timeout seconds, raise a backend error. Precision sets the final positioning precision (in m).

stop(axis)[source]

Stop motion of a given axis

stop_all()[source]

Stop motion of all axes

jog(axis, direction)[source]

Jog a given axis in a given direction.

direction can be either "-" (negative) or "+" (positive). The motion continues until it is explicitly stopped, or unitl a limit is hit.

pylablib.aux_libs.devices.Cryomagnetics module

class pylablib.aux_libs.devices.Cryomagnetics.LM500(conn)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Cryomagnetics LM500/510 level monitor.

Channels are enumerated from 1. To abort filling or reset a timeout, call SCPIDevice.reset() method.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
close()[source]

Close connection to the device

get_channel()[source]

Get current measurement channel

set_channel(channel=1)[source]

Set current measurement channel

get_type(channel=1)[source]

Get channel type ("LHe" or "LN")

get_mode()[source]

Get measurement mode at the current channel ("S" for sample/hold, "C" for continuous)

set_mode(mode)[source]

Set measurement mode at the current channel ("S" for sample/hold, "C" for continuous)

get_interval()[source]

Get measurement interval in sample/hold mode (in seconds)

set_interval(intvl)[source]

Set measurement interval in sample/hold mode (in seconds)

start_meas(channel=1)[source]

Initialize measurement on a given channel

wait_meas(channel=1)[source]

Wait for a measurement on a given channel to finish

get_level(channel=1)[source]

Get level reading on a given channel

measure_level(channel=1)[source]

Measure the level (initialize a measurement and return the result) on a given channel

start_fill(channel=1)[source]

Initialize filling at a given channels

get_fill_status(channel=1)[source]

Get filling status at a given channels.

Return either "off" (filling is off), "timeout" (filling timed out) or a float (time since filling started, in seconds)

get_low_level(channel=1)[source]

Get low level setting on a given channel

set_low_level(level, channel=1)[source]

Set low level setting on a given channel

get_high_level(channel=1)[source]

Get high level setting on a given channel

set_high_level(level, channel=1)[source]

Set high level setting on a given channel

pylablib.aux_libs.devices.DCAM module

exception pylablib.aux_libs.devices.DCAM.DCAMError[source]

Bases: RuntimeError

Generic Hamamatsu camera error.

exception pylablib.aux_libs.devices.DCAM.DCAMTimeoutError[source]

Bases: pylablib.aux_libs.devices.DCAM.DCAMError

Timeout while waiting.

pylablib.aux_libs.devices.DCAM.get_cameras_number()[source]

Get number of connected Hamamatsu cameras

pylablib.aux_libs.devices.DCAM.restart_lib()[source]
class pylablib.aux_libs.devices.DCAM.DCAMCamera(idx=0)[source]

Bases: pylablib.core.devio.interface.IDevice

open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

is_opened()[source]

Check if the device is connected

class ModelData(vendor, model, serial_number, camera_version)

Bases: tuple

camera_version
model
serial_number
vendor
get_model_data()[source]

Get camera model data.

Return tuple (vendor, model, serial_number, camera_version).

class Property(cam_handle, name, id, min, max, step, default, unit)[source]

Bases: object

as_text(value=None)[source]

Get property value as text (by default, current value)

get_value()[source]

Get current property value

set_value(value)[source]

Set property value

list_properties()[source]

Return list of all available properties

get_all_properties()[source]
get_value(name, error_on_missing=True, default=None)[source]

Get value of a property with the given name.

If the value doesn’t exist and error_on_missing==True, raise DCAMError; otherwise, return default.

set_value(name, value, error_on_missing=True)[source]

Set value of a property with the given name.

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

set_trigger_mode(mode)[source]

Set trigger mode.

Can be "int" (internal), "ext" (external), or "software" (software trigger).

get_trigger_mode()[source]

Get trigger mode.

Can be "int" (internal), "ext" (external), or "software" (software trigger).

setup_ext_trigger(invert=False, delay=0.0)[source]

Setup external trigger (inversion and delay)

get_ext_trigger_parameters()[source]

Return external trigger parameters (inversion and delay)

send_software_trigger()[source]

Send software trigger signal

set_exposure(exposure)[source]

Set camera exposure

get_exposure()[source]

Set current exposure

set_readout_speed(speed='fast')[source]

Set readout speed (can be "fast" or "slow")

get_readout_speed()[source]

Set current readout speed

get_readout_time()[source]

Set current readout time

get_defect_correct_mode()[source]

Check if the defect pixel correction mode is on

set_defect_correct_mode(enabled=True)[source]

Enable or disable the defect pixel correction mode

get_buffer_size()[source]

Get the size of the allocated ring buffer (0 if no buffer is allocated)

class FrameInfo(framestamp, timestamp_us, camerastamp, left, top, pixeltype)

Bases: tuple

camerastamp
framestamp
left
pixeltype
timestamp_us
top
get_frame(buffer, return_info=False)[source]

Get a frame at the given buffer index.

If return_info==True, return tuple (data, info), where info is the FrameInfo instance describing frame index and timestamp, camera stamp, frame location on the sensor, and pixel type. Does not advance the read frames counter.

get_data_dimensions()[source]

Get the current data dimension (taking ROI and binning into account)

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, bin) (binning is the same for both axes).

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

Set current ROI.

By default, all non-supplied parameters take extreme values. Binning is the same for both axes.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 5-tuple describing the ROI.

start_acquisition(mode='sequence', nframes=None)[source]

Start acquisition.

mode can be either "snap" (since frame or sequency acquisition) or "sequence" (continuous acquisition). nframes determines number of frames to acquire in "snap" mode, or size of the ring buffer in the "sequence" mode (by default, 100).

stop_acquisition()[source]

Stop acquisition

pausing_acquisition()[source]

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

Useful for applying certain settings which can’t be changed during the acquisition.

get_status()[source]

Get acquisition status.

Can be "busy" (capturing in progress), "ready" (ready for capturing), "stable" (not prepared for capturing), "unstable" (can’t be prepared for capturing), or "error" (some other error).

get_transfer_info()[source]

Get frame transfer info.

Return tuple (last_buff, frame_count), where last_buff is the index of the last filled buffer, and frame_count is the total number of acquired frames.

get_new_images_range()[source]

Get the range of the new images.

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

read_multiple_images(rng=None, return_info=False, peek=False)[source]

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

If return_info==True, return tuple (data, info), where info is the FrameInfo instance describing frame index and timestamp, camera stamp, frame location on the sensor, and pixel type. If peek==True, return images but not mark them as read.

wait_for_frame(since='lastread', timeout=20.0, period=0.001)[source]

Wait for a new camera frame.

since specifies what constitutes a new frame. Can be "lastread" (wait for a new frame after the last read frame), "lastwait" (wait for a new frame after last wait_for_frame() call), or "now" (wait for a new frame acquired after this function call). If timeout is exceeded, raise DCAMTimeoutError.

snap(nframes=None, return_info=False)[source]

Snap a single image (with preset image read mode parameters)

pylablib.aux_libs.devices.DCAM_lib module

Used by autodoc_mock_imports.

pylablib.aux_libs.devices.DCAM_lib_const module

pylablib.aux_libs.devices.HighFinesse module

exception pylablib.aux_libs.devices.HighFinesse.HFError[source]

Bases: RuntimeError

Generic HighFinesse wavemeter error

class pylablib.aux_libs.devices.HighFinesse.WS(lib_path=None, idx=1, serv_path=None, version=None, hide_app=False, timeout=10.0)[source]

Bases: pylablib.core.devio.interface.IDevice

HighFinesse WS6/7 precision wavemeter.

Parameters:
  • lib_path (str) – path to the wlmData6.dll or wlmData7.dll (default is to use the library supplied with the package)
  • idx (int) – wavemeter input index (starts from 1)
  • serv_path – path to server executable (last executed by default)
  • version – wavemeter version (3-4 digit id number)
  • hide_app – if True, start the wavemeter application hidden; otherwise, start it on top
open()[source]

Open the connection

get_frequency(return_exp_error=True)[source]

Get the wavemeter readings (in Hz).

If return_exp_error==True, return "under" if the meter is underexposed or "over" is it is overexposed. Otherwise, raise an error.

get_wavelength(return_exp_error=True)[source]

Get the wavemeter readings (in m, and in vacuum).

If return_exp_error==True, return "under" if the meter is underexposed or "over" is it is overexposed. Otherwise, raise an error.

start_measurement()[source]
stop_measurement()[source]
get_exposure_mode()[source]

Get the exposure mode (0 for manual, 1 for auto)

set_exposure_mode(auto_exposure=True)[source]

Get the exposure mode (manual or auto)

get_exposure(sensor=1)[source]

Get the exposure for a given sensor (starting from 1)

set_exposure(exposure, sensor=1)[source]

Manually set the exposure for a given sensor (starting from 1)

get_switcher_mode()[source]

Get the switcher mode (0 for off, 1 for on)

set_switcher_mode(switching=True)[source]

Set the switcher mode (True or False)

pylablib.aux_libs.devices.IMAQ module

exception pylablib.aux_libs.devices.IMAQ.IMAQGenericError[source]

Bases: RuntimeError

Generic IMAQ camera error.

exception pylablib.aux_libs.devices.IMAQ.IMAQTimeoutError[source]

Bases: pylablib.aux_libs.devices.IMAQ.IMAQGenericError

Timeout while waiting.

pylablib.aux_libs.devices.IMAQ.list_cameras()[source]

List all cameras available through IMAQ interface

class pylablib.aux_libs.devices.IMAQ.IMAQCamera(name='img0')[source]

Bases: pylablib.core.devio.interface.IDevice

Generic IMAQ camera interface.

Parameters:name – interface name (can be learned by list_cameras(); usually, but not always, starts with "cam")
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

reset()[source]

Reset connection to the camera

is_opened()[source]

Check if the device is connected

post_open()[source]

Action to automatically call on opening

get_int_value(attr, default=None)[source]

Get value of an integer attribute with a given name

set_int_value(attr, value)[source]

Set value of an integer attribute with a given name

get_float_value(attr, default=None)[source]

Get value of a floating point attribute with a given name

set_float_value(attr, value)[source]

Set value of a floating point attribute with a given name

class ModelData(serial)

Bases: tuple

serial
get_model_data()[source]

Get camera model data.

Return tuple (serial,).

get_data_dimensions()[source]

Get the current data dimension (taking ROI and binning into account)

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

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

Setup camera ROI.

By default, all non-supplied parameters take extreme values.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 4-tuple describing the ROI.

configure_trigger_in(trig_type, trig_line=0, trig_pol='high', action='none', timeout=None)[source]

Configure input trigger.

Parameters:
  • trig_type (str) – trigger source type; can be "ext", "rtsi", "iso_in", or "software"
  • trig_line (int) – trigger line number
  • trig_pol (str) – trigger polarity; can be "high" or "low"
  • action (str) – trigger action; can be "none" (disable trigger), "capture" (start capturing), "stop" (stop capturing), "buffer" (capture a single frame), or "bufflist" (capture the whole buffer list once)
  • timeout (float) – timeout in seconds; None means not timeout.
configure_trigger_out(trig_type, trig_line=0, trig_pol='high', trig_drive='disable')[source]

Configure trigger output.

Parameters:
  • trig_type (str) – trigger drive destination type; can be "ext", "rtsi", or "iso_out"
  • trig_line (int) – trigger line number
  • trig_pol (str) – trigger polarity; can be "high" or "low"
  • trig_drive (str) – trigger output signal; can be "disable" (disable drive), "acq_in_progress" (asserted when acquisition is started),``”acq_done”`` (asserted when acquisition is done), "unasserted" (force unasserted level), "asserted" (force asserted level), "hsync" (asserted on start of a single line start), "vsync" (asserted on start of a frame scan), "frame_start" (asserted when a single frame is captured), or "frame_done" (asserted when a single frame is done)
read_trigger(trig_type, trig_line=0, trig_pol='high')[source]

Read current value of a trigger (input or output).

Parameters:
  • trig_type (str) – trigger drive destination type; can be "ext", "rtsi", "iso_in", or "iso_out"
  • trig_line (int) – trigger line number
  • trig_pol (str) – trigger polarity; can be "high" or "low"
clear_all_triggers()[source]

Disable all triggers of the session

setup_serial_params(write_term='', datatype='bytes')[source]

Setup default serial communication parameters.

Parameters:
  • write_term – default termintor character to be added to the sent messages
  • datatype – type of the result of read commands; can be "bytes" (return raw bytes), or "str" (convert into UTF-8 string)
serial_write(msg, timeout=3.0, term=None)[source]

Write message into CameraLink serial port.

Parameters:
  • timeout – operation timeout (in seconds)
  • term – additional write terminator character to add to the message; if None, use the value set up using setup_serial_params() (by default, no additional terminator)
serial_read(n, timeout=3.0, datatype=None)[source]

Read specified number of bytes from CameraLink serial port.

Parameters:
  • n – number of bytes to read
  • timeout – operation timeout (in seconds)
  • datatype – return datatype; can be "bytes" (return raw bytes), or "str" (convert into UTF-8 string) if None, use the value set up using setup_serial_params() (by default, "bytes")
serial_readline(timeout=3.0, datatype=None)[source]

Read bytes from CameraLink serial port until the termination character (defined in camera file) is encountered.

Parameters:
  • timeout – operation timeout (in seconds)
  • datatype – return datatype; can be "bytes" (return raw bytes), or "str" (convert into UTF-8 string) if None, use the value set up using setup_serial_params() (by default, "bytes")
serial_flush()[source]

Flush CameraLink serial port

setup_acquisition(continuous, frames)[source]

Setup acquisition mode.

continuous determines whether acquisition runs continuously, or stops after the given number of frames (note that IMAQCamera.acquisition_in_progress() would still return True in this case, even though new frames are no longer acquired). frames sets up number of frame buffers. If start==True, start acquisition directly after setup.

clear_acquisition()[source]

Clear all acquisition details and free all buffers

get_acquisition_parameters()[source]

Return acquisition parameters (continuous, frames_buffer).

start_acquisition()[source]

Start acquisition

stop_acquisition()[source]

Stop acquisition

acquisition_in_progress()[source]

Check if acquisition is in progress

pausing_acquisition()[source]

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

Useful for applying certain settings which can’t be changed during the acquisition (e.g., ROI or bit depth).

class TBufferStatus(unread, lost, size)

Bases: tuple

lost
size
unread
get_buffer_status()[source]

Get buffer fill status.

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

get_new_images_range()[source]

Get the range of the new images.

Return tuple (first, last) with images range (inclusive). If no images are available, return None.

wait_for_frame(since='lastread', timeout=20.0)[source]

Wait for a new camera frame.

since specifies what constitutes a new frame. Can be "lastread" (wait for a new frame after the last read frame), "lastwait" (wait for a new frame after last wait_for_frame() call), or "now" (wait for a new frame acquired after this function call). If timeout is exceeded, raise IMAQLibError. period specifies camera polling period.

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

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

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

read_multiple_images_fastbuff(rng=None)[source]

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

Some frames in the result are “stuck together” in a single buffer, if their memory locations are continuous. Return list [(number_of_frames, raw_data)], where number_of_frames specifies number of frames in a given array element, and raw_data is the binary string corresponding to these frames (of the size self._frame_size*number_returned). Compared to read_multiple_images(), always assumes peek==False and missing_frame="skip" (default values). Also, always return frames in "rct" format (row-first indexing, going from the top).

Function exists only to speed up reading of large number of small frames.

snap(timeout=20.0)[source]

Snap a single image (with preset image read mode parameters)

grab(n, buff_frames=5000, frame_timeout=20.0, missing_frame='none', return_buffer_status=False)[source]

Snap n images (with preset image read mode parameters)

buff_frames determines buffer 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 frames number to n).

pylablib.aux_libs.devices.IMAQ_lib module

Used by autodoc_mock_imports.

pylablib.aux_libs.devices.IMAQ_lib_const module

pylablib.aux_libs.devices.IMAQdx module

class pylablib.aux_libs.devices.IMAQdx.IMAQdxAttribute(sid, name)[source]

Bases: object

Object representing an IMAQdx camera parameter.

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

name

attribute name

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)

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
values

list of possible attribute values (if applicable)

update_minmax()[source]

Update minimal and maximal attribute limits

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.

pylablib.aux_libs.devices.IMAQdx.list_cameras(connected=True)[source]

List all cameras available through IMAQdx interface

class pylablib.aux_libs.devices.IMAQdx.IMAQdxCamera(name='cam0', mode='controller', default_visibility='simple')[source]

Bases: pylablib.core.devio.interface.IDevice

Generic IMAQdx camera interface.

Parameters:
  • name – interface name (can be learned by list_cameras(); usually, but not always, starts with "cam")
  • mode – connection mode; can be "controller" (full control) or "listener" (only reading)
  • default_visibility – default attribute visibility when listing attributes; can be "simple", "intermediate" or "advanced" (higher mode exposes more attributes).
open(mode=None)[source]

Open connection to the camera

close()[source]

Close connection to the camera

reset()[source]

Reset connection to the camera

is_opened()[source]

Check if the device is connected

post_open()[source]

Action to automatically call on opening

list_attributes(root='', visibility=None, add_builtin=True)[source]

List all attributes at a given root.

Return list of IMAQdxAttribute objects, which allow querying and settings values and getting additional information (description, limits, increment).

get_value(name, default=None)[source]

Get value of the attribute with a given name

set_value(name, value, ignore_missing=False, truncate=True)[source]

Set value of the attribute with a given name.

If truncate==True, truncate value to lie within attribute range.

get_all_attributes(root='', as_dict=False)[source]

Get values of all attributes with the given root.

If as_dict==True, return dict object; otherwise, return Dictionary object.

set_all_attributes(settings, root='', truncate=True)[source]

Set values of all attributes with the given root.

If truncate==True, truncate value to lie within attribute range.

class ModelData(vendor, model, serial_number, bus_type)

Bases: tuple

bus_type
model
serial_number
vendor
get_model_data()[source]

Get camera model data.

Return tuple (vendor, model, serial_number, bus_type).

get_data_dimensions()[source]

Get the current data dimension (taking ROI and binning into account)

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

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

Setup camera ROI.

By default, all non-supplied parameters take extreme values.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 4-tuple describing the ROI.

setup_acquisition(continuous, frames)[source]

Setup acquisition mode.

continuous determines whether acquisition runs continuously, or stops after the given number of frames (note that IMAQdxCamera.acquisition_in_progress() would still return True in this case, even though new frames are no longer acquired). frames sets up number of frame buffers.

clear_acquisition()[source]
start_acquisition()[source]
stop_acquisition()[source]
acquisition_in_progress()[source]

Check if acquisition is in progress

refresh_acquisition(delay=0.005)[source]

Stop and restart the acquisition, waiting delay seconds in between

pausing_acquisition()[source]

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

Useful for applying certain settings which can’t be changed during the acquisition.

get_new_images_range()[source]

Get the range of the new images.

Return tuple (first, last) with images range (inclusive). If no images are available, return None.

wait_for_frame(since='lastread', timeout=20.0, period=0.001)[source]

Wait for a new camera frame.

since specifies what constitutes a new frame. Can be "lastread" (wait for a new frame after the last read frame), "lastwait" (wait for a new frame after last wait_for_frame() call), or "now" (wait for a new frame acquired after this function call). If timeout is exceeded, raise IMAQdxGenericError. period specifies camera polling period.

read_data_raw(size_bytes, mode, buffer_num=0)[source]

Return raw bytes string from the given buffer number

buffer_valid(buffer_num)[source]
class pylablib.aux_libs.devices.IMAQdx.IMAQdxPhotonFocusCamera(name, mode='controller', default_visibility='simple', small_packet_size=True)[source]

Bases: pylablib.aux_libs.devices.IMAQdx.IMAQdxCamera

IMAQdx interface to a PhotonFocus camera.

Parameters:
  • name – interface name (can be learned by list_cameras(); usually, but not always, starts with "cam")
  • mode – connection mode; can be "controller" (full control) or "listener" (only reading)
  • default_visibility – default attribute visibility when listing attributes; can be "simple", "intermediate" or "advanced" (higher mode exposes more attributes).
  • small_packet_size – if True, automatically set up Ethernet packet size to 1500 bytes.
post_open()[source]

Action to automatically call on opening

get_exposure()[source]

Get current exposure

set_exposure(exposure)[source]

Set current exposure

setup_acquisition(continuous, frames)[source]

Setup acquisition mode.

continuous determines whether acquisition runs continuously, or stops after the given number of frames (note that IMAQdxCamera.acquisition_in_progress() would still return True in this case, even though new frames are no longer acquired). frames sets up number of frame buffers.

peek_frame(mode='last', buffer_num=0)[source]

Read a frame without marking it as read

mode specifies frame selection mode: can be "first" (first available), "last" (last read), or "number" (index determined by buffer_num).

Return tuple (frame, buffer_num).

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

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

If peek==True, return images but not mark them as read. If skip==True, mark frames as read but don’t read them (i.e., reading with peek==True and skip==True does nothing). 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).

snap(timeout=20.0)[source]

Snap a single image (with preset image read mode parameters)

pylablib.aux_libs.devices.IMAQdx_lib module

Used by autodoc_mock_imports.

pylablib.aux_libs.devices.Janis module

Janis Jacob controller (custom hardware, probably not applicable to other devices).

class pylablib.aux_libs.devices.Janis.JacobServer(addr='10.10.1.17', port=5557, single_use_socket=False)[source]

Bases: object

close()[source]
comm(comm)[source]
query(query)[source]
flush(timeout=0.1)[source]
class StatusSimple(ain, aout, dout)

Bases: tuple

ain
aout
dout
get_status_simple()[source]
class StatusDecoded(pressures, flow, valves, V5, pumps, pump_status)

Bases: tuple

V5
flow
pressures
pump_status
pumps
valves
get_status_decoded()[source]
s()
setDO(channel, state)[source]
setDO_multiple(state, mask)[source]
setAO(channel, value)[source]
switch_pump(pump, state)[source]
switch_valve(valve, state)[source]
switch_multiple_valves(valves_on=None, valves_off=None, V5=None)[source]

pylablib.aux_libs.devices.Lakeshore module

class pylablib.aux_libs.devices.Lakeshore.Lakeshore218(conn)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Lakeshore 218 temperature controller.

All channels are enumerated from 0.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
is_enabled(channel)[source]

Check if a given channel is enabled

set_enabled(channel, enabled=True)[source]

Enable or disable a given channel

get_sensor_type(group)[source]

Get sensort type for a given group ("A" or "B").

For type descriptions, see Lakeshore 218 programming manual.

set_sensor_type(group, type)[source]

Set sensort type for a given group ("A" or "B").

For type descriptions, see Lakeshore 218 programming manual.

get_temperature(channel)[source]

Get readings (in Kelvin) on a given channel

get_all_temperatures()[source]

Get readings (in Kelvin) on all channels

class pylablib.aux_libs.devices.Lakeshore.Lakeshore370(conn)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Lakeshore 370 temperature controller.

All channels are enumerated from 0.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
get_resistance(channel)[source]

Get resistance readings (in Ohm) on a given channel

get_sensor_power(channel)[source]

Get dissipated power (in W) on a given channel

select_channel(channel)[source]

Select measurement channel

get_channel()[source]

Get current measurement channel

setup_channel(channel=None, mode='V', exc_range=1, res_range=22, autorange=True)[source]

Setup a measurement channel (current channel by default).

mode is the excitation mode ("I" or "V"), exc_range is the excitation range, res_range is the resistance range. For range descriptions, see Lakeshore 370 programming manual.

setup_heater_openloop(heater_range, heater_percent, heater_res=100.0)[source]

Setup a heater in the open loop mode.

heater_range is the heating range, heater_percent is the excitation percentage within the range, heater_res is the heater resistance (in Ohm). For range descriptions, see Lakeshore 370 programming manual.

get_heater_settings_openloop()[source]

Get heater settings in the open loop mode.

Return tuple (heater_range, heater_percent, heater_res), where heater_range is the heating range, heater_percent is the excitation percentage within the range, heater_res is the heater resistance (in Ohm). For range descriptions, see Lakeshore 370 programming manual.

set_analog_output(channel, value)[source]

Set analog output value at a given channel

get_analog_output(channel)[source]

Get analog output value at a given channel

pylablib.aux_libs.devices.LaserQuantum module

class pylablib.aux_libs.devices.LaserQuantum.Finesse(conn)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Laser Quantum Finesse pump laser

Parameters:conn – serial connection parameters (usually port)
query(comm)[source]

Send a query to the device and parse the reply

get_device_info()[source]

Get device information (serial number, software version, calibration date)

get_device_status()[source]

Get device status, head and PSU temperature

get_work_hours()[source]

Get the PSU run time, the Above Threshold and the Enabled time in minutes

get_interlock_status()[source]

Get manual interlock status

get_shutter_status()[source]

Get manual shutter status

get_output_mode()[source]

Get output mode.

Can be "enabled", "disabled"

get_output()[source]

Check if the output is enabled.

set_output_mode(mode='on')[source]

Set output mode.

mode can be "on" or "off"

set_output(enabled=True)[source]

Turn the output on or off

get_output_level()[source]

Get the output power (in Watts)

get_output_setpoint()[source]

Get the output setpoint power (in Watts)

set_output_level(level)[source]

Get the output power setpoint (in Watts)

pylablib.aux_libs.devices.LighthousePhotonics module

class pylablib.aux_libs.devices.LighthousePhotonics.SproutG(conn)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Lighthouse Photonics Sprout G laser.

Parameters:conn – serial connection parameters (usually port)
query(comm, allowed_resp=None)[source]

Send a query to the device and parse the reply.

allowed_resp is a list of valid responses (by default, only "0").

get_device_info()[source]

Get device information (product name, product version, serial number)

get_device_config()[source]

Get laser configuration (color and maximal power)

get_warning_status()[source]

Get device warnings

get_interlock_status()[source]

Get manual interlock status

get_shutter_status()[source]

Get manual shutter status

get_work_hours()[source]

Return device operation hours (controller on) and run hours (laser on)

get_output_mode()[source]

Get output mode.

Can be "on", "off", "idle" (power standby mode), "calibrate", "interlock" (manual interlock is off), "warmup" (warmup mode), or "calibration" (calibration mode).

get_output()[source]

Check if the output is on.

set_output_mode(mode='on')[source]

Set output mode.

mode can be "on", "off", "idle" (power standby mode), or "calibrate" (calibration mode).

set_output(enabled=True)[source]

Turn the output on or off

get_output_level()[source]

Set the actual output power (in Watts)

get_output_setpoint()[source]

Get the output setpoint power (in Watts)

set_output_level(level)[source]

Get the output power setpoint (in Watts)

pylablib.aux_libs.devices.M2 module

exception pylablib.aux_libs.devices.M2.M2Error[source]

Bases: RuntimeError

M2 communication error.

class pylablib.aux_libs.devices.M2.M2ICE(addr, port, timeout=5.0, start_link=True, use_websocket=True, only_websocket=False)[source]

Bases: pylablib.core.devio.interface.IDevice

M2 ICE device.

Parameters:
  • addr (str) – IP address of the ICE device.
  • port (int) – port of the ICE device.
  • timeout (float) – default timeout of synchronous operations.
  • start_link (bool) – if True, initialize device link on creation.
  • use_websocket (bool) – if True, use websocket interface (same as used by the web interface) for additional functionality (wavemeter connection, etalon value, improved operation stopping)
  • only_websocket (bool) – if True, only use websocket operations (raises error on most standard methods, mostly used to monitor status).
open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

set_timeout(timeout)[source]

Set timeout for connecting or sending/receiving.

flush()[source]

Flush read buffer

query(op, params, reply_op='auto', report=False)[source]

Send a query using the standard device interface.

reply_op is the name of the reply operation (by default, its the operation name plus "_reply"). If report==True, request completion report (doesn’t apply to all operation).

update_reports(timeout=0.0)[source]

Check for fresh operation reports.

get_last_report(op)[source]

Get the latest report for the given operation

check_report(op)[source]

Check and return the latest report for the given operation

wait_for_report(op, error_msg=None, timeout=None)[source]

Wait for a report for the given operation

error_msg specifies the exception message if the report results in an error.

Initialize device link (called automatically on creation).

connect_wavemeter(sync=True)[source]

Connect to the wavemeter (if sync==True, wait until the connection is established)

disconnect_wavemeter(sync=True)[source]

Disconnect from the wavemeter (if sync==True, wait until the connection is broken)

is_wavelemeter_connected()[source]

Check if the wavemeter is connected

get_system_status()[source]

Get the device system status

get_full_web_status()[source]

Get full websocket status.

Return a large dictionary containing all the information available in the web interface.

get_full_tuning_status()[source]

Get full fine-tuning status (see M2 ICE manual for "poll_wave_m" command)

lock_wavemeter(lock=True, sync=True, error_on_fail=True)[source]

Lock or unlock the laser to the wavemeter (if sync==True, wait until the operation is complete)

is_wavelemeter_lock_on()[source]

Check if the laser is locked to the wavemeter

tune_wavelength(wavelength, sync=True, timeout=None)[source]

Fine-tune the wavelength.

Only works if the wavemeter is connected. If sync==True, wait until the operation is complete (might take from several seconds up to several minutes).

check_tuning_report()[source]

Check wavelength fine-tuning report

Return "success" or "fail" if the operation is complete, or None if it is still in progress.

wait_for_tuning(timeout=None)[source]

Wait until wavelength fine-tuning is complete

get_tuning_status()[source]

Get fine-tuning status.

Return either "idle" (no tuning or locking), "nolink" (no wavemeter link), "tuning" (tuning in progress), or "locked" (tuned and locked to the wavemeter).

get_wavelength()[source]

Get fine-tuned wavelength.

Only works if the wavemeter is connected.

stop_tuning()[source]

Stop fine wavelength tuning.

tune_wavelength_table(wavelength, sync=True)[source]

Coarse-tune the wavelength.

Only works if the wavemeter is disconnected. If sync==True, wait until the operation is complete.

get_full_tuning_status_table()[source]

Get full coarse-tuning status (see M2 ICE manual for "poll_move_wave_t" command)

get_tuning_status_table()[source]

Get coarse-tuning status.

Return either "done" (tuning is done), "tuning" (tuning in progress), or "fail" (tuning failed).

get_wavelength_table()[source]

Get course-tuned wavelength.

Only works if the wavemeter is disconnected.

stop_tuning_table()[source]

Stop coarse wavelength tuning.

tune_etalon(perc, sync=True)[source]

Tune the etalon to perc percent.

Only works if the wavemeter is disconnected. If sync==True, wait until the operation is complete.

lock_etalon(sync=True)[source]

Lock the etalon (if sync==True, wait until the operation is complete).

unlock_etalon(sync=True)[source]

Lock the etalon (if sync==True, wait until the operation is complete).

get_etalon_lock_status()[source]

Get etalon lock status.

Return either "off" (lock is off), "on" (lock is on), "debug" (lock in debug condition), "errorr" (lock had an error), "search" (lock is searching), or "low" (lock is off due to low output).

tune_reference_cavity(perc, fine=False, sync=True)[source]

Tune the reference cavity to perc percent.

If fine==True, adjust fine tuning; otherwise, adjust coarse tuning. Only works if the wavemeter is disconnected. If sync==True, wait until the operation is complete.

lock_reference_cavity(sync=True)[source]

Lock the laser to the reference cavity.

If sync==True, wait until the operation is complete.

unlock_reference_cavity(sync=True)[source]

Unlock the laser from the reference cavity.

If sync==True, wait until the operation is complete.

get_reference_cavity_lock_status()[source]

Get the reference cavity lock status.

Return either "off" (lock is off), "on" (lock is on), "debug" (lock in debug condition), "errorr" (lock had an error), "search" (lock is searching), or "low" (lock is off due to low output).

tune_laser_resonator(perc, fine=False, sync=True)[source]

Tune the laser cavity to perc percent.

If fine==True, adjust fine tuning; otherwise, adjust coarse tuning. Only works if the wavemeter is disconnected. If sync==True, wait until the operation is complete.

setup_terascan(scan_type, scan_range, rate, trunc_rate=True)[source]

Setup terascan.

Parameters:
  • scan_type (str) – scan type. Can be "medium" (BRF+etalon, rate from 100 GHz/s to 1 GHz/s), "fine" (all elements, rate from 20 GHz/s to 1 MHz/s), or "line" (all elements, rate from 20 GHz/s to 50 kHz/s).
  • scan_range (tuple) – tuple (start,stop) with the scan range (in Hz).
  • rate (float) – scan rate (in Hz/s).
  • trunc_rate (bool) – if True, truncate the scan rate to the nearest available rate (otherwise, incorrect rate would raise an error).
start_terascan(scan_type, sync=False, sync_done=False)[source]

Start terascan.

Scan type can be "medium" (BRF+etalon, rate from 100 GHz/s to 1 GHz/s), "fine" (all elements, rate from 20 GHz/s to 1 MHz/s), or "line" (all elements, rate from 20 GHz/s to 50 kHz/s). If sync==True, wait until the scan is set up (not until the whole scan is complete). If sync_done==True, wait until the whole scan is complete.

enable_terascan_updates(enable=True, update_period=0)[source]

Enable sending periodic terascan updates.

If enabled, laser will send updates in the beginning and in the end of every terascan segment. If update_period!=0, it will also send updates every update_period percents of the segment (this option doesn’t seem to be working currently).

check_terascan_update()[source]

Check the latest terascan update.

Return None if none are available, or a dictionary {"wavelength":current_wavelength, "operation":op}, where op is "scanning" (scanning in progress), "stitching" (stitching in progress), "finished" (scan is finished), or "repeat" (segment is repeated).

wait_for_terascan_update()[source]

Wait until a new terascan update is available

check_terascan_report()[source]

Check report on terascan start.

Return "success" or "fail" if the operation is complete, or None if it is still in progress.

stop_terascan(scan_type, sync=False)[source]

Stop terascan of the given type.

If sync==True, wait until the operation is complete.

get_terascan_status(scan_type, web_status='auto')[source]

Get status of a terascan of a given type.

Return dictionary with 4 items:
"current": current laser frequency "range": tuple with the fill scan range "status": can be "stopped" (scan is not in progress), "scanning" (scan is in progress), or "stitching" (scan is in progress, but currently stitching) "web": where scan is running in web interface (some failure modes still report "scanning" through the usual interface); only available if the laser web connection is on.
start_fast_scan(scan_type, width, time, sync=False, setup_locks=True)[source]

Setup and start fast scan.

Parameters:
  • scan_type (str) – scan type. Can be "cavity_continuous", "cavity_single", "cavity_triangular", "etalon_continuous", "etalon_single", "resonator_continuous", "resonator_single", "resonator_ramp", "resonator_triangular", "ecd_continuous", "ecd_ramp", or "fringe_test" (see ICE manual for details)
  • width (float) – scan width (in Hz).
  • time (float) – scan time/period (in s).
  • sync (bool) – if True, wait until the scan is set up (not until the whole scan is complete).
  • setup_locks (bool) – if True, automatically setup etalon and reference cavity locks in the appropriate states.
check_fast_scan_report()[source]

Check fast scan report.

Return "success" or "fail" if the operation is complete, or None if it is still in progress.

stop_fast_scan(scan_type, return_to_start=True, sync=False)[source]

Stop fast scan of the given type.

If return_to_start==True, return to the center frequency after stopping; otherwise, stay at the current instantaneous frequency. If sync==True, wait until the operation is complete.

get_fast_scan_status(scan_type)[source]

Get status of a fast scan of a given type.

Return dictionary with 4 items:
"status": can be "stopped" (scan is not in progress), "scanning" (scan is in progress). "value": current tuner value (in percent).
stop_scan_web(scan_type)[source]

Stop scan of the current type (terascan or fine scan) using web interface.

More reliable than native programming interface, but requires activated web interface.

stop_all_operation(repeated=True, attempt=0)[source]

Stop all laser operations (tuning and scanning).

More reliable than native programming interface, but requires activated web interface. If repeated==True, repeat trying to stop the operations until succeeded (more reliable, but takes more time). Return True if the operation is success otherwise False.

pylablib.aux_libs.devices.MKS module

class pylablib.aux_libs.devices.MKS.MKS9xx(conn, dev_addr=254, timeout=10.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

MKS 9xx series pressure gauge.

Parameters:
  • conn – serial connection parameters (usually port or a tuple containing port and baudrate)
  • dev_addr (int) – device address within a given controller (by default, communicate with all devices)
  • timeout (float) – communication operations timeout
query(reg)[source]

Send a query to the device and return the reply

comm(reg, value)[source]

Send a command to the device

get_pressure(chan=3)[source]

Get pressure at a given channel

pylablib.aux_libs.devices.NI module

class pylablib.aux_libs.devices.NI.NIGPIBSerialDevice(port_addr, timeout=10.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

National Instruments Serial<->GPIB converter.

get_id()[source]
init_GPIB(addr=0)[source]
get_stat()[source]
write(addr, data)[source]
read(addr, size=256)[source]
class pylablib.aux_libs.devices.NI.NIGPIBSerialBackend(bridge_conn, dev_addr, timeout=10.0, term_write=None, term_read=None)[source]

Bases: pylablib.core.devio.backend.IDeviceBackend

Device backend for the National Instruments Serial<->GPIB converter.

Error

alias of builtins.object

open()[source]

Open the connection.

close()[source]

Close the connection.

set_timeout(timeout)[source]

Set operations timeout (in seconds).

get_timeout()[source]

Get operations timeout (in seconds).

cooldown()[source]

Cooldown between the operations (usually, some short time delay).

read_cooldown()[source]
readline(remove_term=True, timeout=None)[source]

Read a single line from the device.

Parameters:
  • remove_term (bool) – If True, remove terminal characters from the result.
  • timeout – Operation timeout. If None, use the default device timeout.
  • skip_empty (bool) – If True, ignore empty lines (works only for remove_term==True).
read(size=None)[source]

Read data from the device.

If size is not None, read size bytes (the standard timeout applies); otherwise, read all available data (return immediately).

flush_read()[source]

Flush the device output (read all the available data; return the number of bytes read).

write(data, flush=True, read_echo=False)[source]

Write data to the device.

If flush==True, flush the write buffer. If read_echo==True, wait for read_echo_delay seconds and then perform readline() (read_echo_lines times).

class pylablib.aux_libs.devices.NI.NIDAQ(dev_name='dev0', rate=100.0, buffer_size=100000.0, reset=False)[source]

Bases: pylablib.core.devio.interface.IDevice

National Instruments DAQ device interface (wrapper around nidaqmx library).

Simplified interface to NI DAQ devices. Supports voltage, digital, and counter inputs (all synchronized to the same clock), and digital and voltage outputs (asynchronous).

Parameters:
  • dev_name (str) – root device name.
  • rate (float) – analog input sampling rate (can be adjusted later).
  • buffer_size (int) – size of the input buffer.
  • reset (int) – if True, reset the device upon connection.
open()[source]

Open the connection

close()[source]

Close the connection

is_opened()[source]

Check if the device is connected

reset()[source]

Reset the device. All channels will be removed.

setup_clock(rate, src=None)[source]

Setup analog input clock (which is the main system clock).

If src==None, use internal clock with the given rate; otherwise use src terminal as a clock source (in this case, rate should be higher than the expected source rate).

get_clock_cfg()[source]

Get analog input clock configuration.

Return tuple (rate, src).

export_clock(terminal)[source]

Export system clock to the given terminal (None to disconnect all terminals)

Only terminal one can be active at a time.

get_export_clock_terminal()[source]

Return terminal which outputs system clock (None if none is connected).

add_voltage_input(name, channel, rng=(-10, 10), term_config='default')[source]

Add analog voltage input.

Readout is synchronized to the system clock.

Parameters:
  • name (str) – channel name.
  • channel (str) – terminal name (e.g., "ai0").
  • rng – voltage range
  • term_config – terminal configuration. Can be "default", "rse" (single-ended, referenced to AI SENSE input), "nrse" (single-ended, referenced to AI GND), "diff" (differential) and "pseudodiff" (see NIDAQ manual for details).
add_counter_input(name, counter, terminal, clk_src='ai/SampleClock', output_format='rate')[source]

Add counter input (value is related to the number of counts).

Readout is synchronized to the system clock.

Parameters:
  • name (str) – channel name.
  • counter (str) – on-board counter name (e.g., "ctr0").
  • terminal (str) – terminal name (e.g., "pfi0").
  • clk_src (str) – source of the counter sampling clock. By default it is the analog input clock, which requires at least one voltage input channel (could be dummy channel) to operate.
  • output_format (str) – output format. Can be "acc" (return accumulated number of counts since the sampling start), "diff" (return number of counts passed between the two consecutive sampling points; essentially, a derivative of "acc"), or "rate" (return count rate based on the "diff" samples).
add_clock_period_input(counter, clk_src='ai/SampleClock')[source]

Add clock period counter.

Useful when using external sample clock with unknown period. The clock input can be returned during read() operation, and it is used to calculate counter inputs in "rate" mode. Readout is synchronized to the system clock.

Parameters:
  • counter (str) – on-board counter name (e.g., "ctr0") to be used for clock measure.
  • clk_src (str) – source of the counter sampling clock. By default it is the analog input clock, which requires at least one voltage input channel (could be dummy channel) to operate.
add_digital_input(name, channel)[source]

Add digital input.

Readout is synchronized to the system clock. :param name: channel name. :type name: str :param channel: terminal name (e.g., "port0/line12"). :type channel: str

get_input_channels(include=('ai', 'ci', 'di'))[source]

Get names of all input channels (voltage input and counter input).

include specifies which channel types to include into the list ("ai" for voltage inputs, "ci" for counter inputs, "di" for digital inputs, "cpi" for clock period channel). The channels order is always fixed: first voltage inputs, then counter inputs, then digital inputs.

get_voltage_input_parameters()[source]

Get parameters (names, channels, output ranges, and terminal configurations) of all analog voltage input channels.

get_counter_input_parameters()[source]

Get parameters (names, counters, terminals, clock sources, and output formats) of all counter input channels.

get_digital_input_parameters()[source]

Get parameters (names and channels) of all digital input channels.

get_clock_period_input_parameters()[source]

Get parameters (counter input) of the clock period input channel

read(n=1, flush_read=1, timeout=10.0, include=('ai', 'ci', 'di'))[source]

Read n samples. If the task is not running, automatically start before reading and stop after.

Parameters:
  • n (int) – number of samples to read. If n==-1, read all available samples.
  • flush_read (int) – number of initial samples to skip if the task starts on read. If counter channels are used, the first sample is usually unreliable, so flush_read=1 is recommended; however, if exactly n pulses are required at the clock export channel, flush_read=0 is needed.
  • include (tuple) – specifies which channel types to include into the list ("ai" for voltage inputs, "ci" for counter inputs, "di" for digital inputs, "cpi" for clock period channel).
Returns:

numpy array of values arranged according to get_input_channels() order with the given include parameter.

start(flush_read=0, finite=None)[source]

Start the sampling task.

flush_read specifies number of samples to read and discard after start. If finite is not None, it specifies finite number of sample to acquire before stopping.

If counter channels are used, the first sample is usually unreliable, so flush_read=1 is recommended; however, if exactly finite pulses are required at the clock export channel, flush_read=0 is needed (the total number of pulses is flush_read+finite).

stop()[source]

Stop the sampling task

is_running()[source]

Check if the task is running

available_samples()[source]

Get number of available samples (return 0 if the task is not running)

get_buffer_size()[source]

Get the sampling buffer size

wait_for_sample(num=1, timeout=10.0, wait_time=0.001)[source]

Wait until at least num samples are available.

If they are not available immediately, loop while checking every wait_time interval until enough samples are accumulated. Return the number of available samples if successful, or 0 if the execution timed out.

add_digital_output(name, channel)[source]

Add digital output.

Parameters:
  • name (str) – channel name.
  • channel (str) – terminal name (e.g., "do0").
get_digital_output_channels()[source]

Get names of all digital output channels.

get_digital_output_parameters()[source]

Get parameters (names and channels) of all digital output channels.

set_digital_outputs(names, values)[source]

Set values of one or several digital outputs.

Parameters:
  • names (str or [str]) – name or list of names of outputs.
  • values – output value or list values.
get_digital_outputs(names=None)[source]

Get values of one or several digital outputs.

Parameters:names (str or [str] or None) – name or list of names of outputs (None means all outputs).

Return list of values ordered by names (or by get_digital_output_channels() if names==None).

add_voltage_output(name, channel, rng=(-10, 10), initial_value=0.0)[source]

Add analog voltage output.

Parameters:
  • name (str) – channel name.
  • channel (str) – terminal name (e.g., "ao0").
  • rng – voltage range.
  • initial_value (float) – initial output value (has to be initialized).
get_voltage_output_channels()[source]

Get names of all analog voltage output channels.

get_voltage_output_parameters()[source]

Get parameters (names, channels and output ranges) of all analog voltage output channels.

set_voltage_outputs(names, values)[source]

Set values of one or several analog voltage outputs.

Parameters:
  • names (str or [str]) – name or list of names of outputs.
  • values – output value or list values. These can be single numbers, or arrays if the output clock is setup (see setup_voltage_output_clock()). In the latter case it sets up the output waveforms; not that waveforms for all channels must have the same length (a single number signifying a constant output is also allowed) If the analog output is set up to the finite mode (continuous==False), the finite waveform output happens right away, with the number of samples determined by samps_per_channel parameter of setup_voltage_output_clock(). In this case, if the supplied waveform is shorter than the number of samples, it gets repeated; if it’s longer, it gets cut off.
get_voltage_outputs(names=None)[source]

Get values of one or several analog voltage outputs.

Parameters:names (str or [str] or None) – name or list of names of outputs (None means all outputs).

Return list of values ordered by names (or by get_voltage_output_channels() if names==None). For continuous waveforms, return the array containing a single repetition of the waveform. For finite waveforms, repeat the array containing the last outputted waveform.

setup_voltage_output_clock(rate=0, sync_with_ai=False, continuous=True, samps_per_chan=1000)[source]

Setup analog output clock configuration.

Parameters:
  • rate – clock rate; if 0, assume constant voltage output (default)
  • sync_with_ai – if True, the clock is synchronized to the analog input clock (the main clock); note that in this case output changes only when the analog read task is running
  • continuous – if True, any written waveform gets repeated continuously; otherwise, it outputs written waveform only once, and then latches the output on the last value
  • samps_per_chan – if continuous==False, it determines number of samples to output before stopping
get_voltage_output_clock_cfg()[source]

Get analog output clock configuration.

Return tuple (rate, sync_with_ai, samps_per_chan, continuous).

pylablib.aux_libs.devices.NuPhoton module

class pylablib.aux_libs.devices.NuPhoton.EDFA_NP2000(port_addr, timeout=5.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

NuPhoton NP2000 EDFA (optical amplifier).

query(comm)[source]
set_output(output=True)[source]
get_status_string()[source]
get_status()[source]

pylablib.aux_libs.devices.OZOptics module

class pylablib.aux_libs.devices.OZOptics.OZOpticsDevice(port_addr, timeout=20.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Generic OZOptics device.

query(comm, timeout=None)[source]
restart()[source]
get_config()[source]
class pylablib.aux_libs.devices.OZOptics.TF100(port_addr, timeout=20.0)[source]

Bases: pylablib.aux_libs.devices.OZOptics.OZOpticsDevice

OZOptics TF100 tunable filter.

get_wavelength_correction()[source]
set_wavelength_correction(shift=0.0, scale=1.0)[source]
home()[source]
get_wavelength()[source]
set_wavelength(wavelength)[source]
class pylablib.aux_libs.devices.OZOptics.DD100(port_addr, timeout=20.0)[source]

Bases: pylablib.aux_libs.devices.OZOptics.OZOpticsDevice

OZOptics DD100 variable attenuator.

home()[source]
get_min_attenuation()[source]
get_max_attenuation()[source]
get_attenuation()[source]
set_attenuation(att_dB)[source]
class pylablib.aux_libs.devices.OZOptics.EPC04(port_addr, timeout=20.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

OZOptics EPC04 polarization controller.

query(comm)[source]
get_voltages()[source]
set_voltage(channel, value)[source]
set_all_voltages(value)[source]
step_voltage(channel, step)[source]
get_mode()[source]
set_mode(mode='DC')[source]
save_preset()[source]

pylablib.aux_libs.devices.Olimex module

class pylablib.aux_libs.devices.Olimex.IMCDevice(port_addr, timeout=20.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Generic Olimex ATMega device.

comm(comm, timeout=None)[source]
query(query, timeout=None)[source]
class pylablib.aux_libs.devices.Olimex.AVR_IO_M16(port_addr, timeout=20.0)[source]

Bases: pylablib.aux_libs.devices.Olimex.IMCDevice

Olimex AVR-IO-M16 4x relay board.

get_relays()[source]
set_relays(relays)[source]
open_relay(n)[source]
close_relay(n)[source]

pylablib.aux_libs.devices.Ophir module

class pylablib.aux_libs.devices.Ophir.OphirDevice(conn)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Generic Ophir device.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
query(comm)[source]

Send a query to the device and parse the reply

class pylablib.aux_libs.devices.Ophir.VegaPowerMeter(conn)[source]

Bases: pylablib.aux_libs.devices.Ophir.OphirDevice

Ophir Vega power meter.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
get_power()[source]

Get the current power readings

class WavelengthInfo(mode, rng, curr_idx, presets, curr_wavelength)

Bases: tuple

curr_idx
curr_wavelength
mode
presets
rng
get_wavelength_info()[source]

Get wavelength setting info.

Return tuple (mode, rng, curr_idx, presets, curr_wavelength), where mode is the measurement mode ("CONTINUOUS" or "HOLD"), rng is full wavelength range (in m), curr_idx is the current wavelength preset index, presets is the list of all preset wavelengths (in m), and curr_wavelength is the current measurement wavelength (in m).

get_wavelength()[source]

Get current calibration wavelength

set_wavelength(wavelength)[source]

Set current calibration wavelength

class RangeInfo(curr_idx, ranges, curr_range)

Bases: tuple

curr_idx
curr_range
ranges
get_range_info()[source]

Get power range info.

Return tuple (curr_idx, ranges, curr_range), where curr_idx is the current power range index, ranges is the list of ranges (in W) for all indices and curr_range is the current range (in W).

get_range()[source]

Get current power range (maximal power in W)

get_range_idx()[source]

Get current power range index

Index goes from 0 (highest) to maximal (lowest); auto-ranging is -1.

set_range_idx(rng_idx)[source]

Set current range index.

rng_idx is the range index from 0 (highest) to maximal (lowest); auto-ranging is -1.

is_filter_in()[source]

Check if the filter is set to be on at the power meter

set_filter(filter_in=True)[source]

Change the filter setting at the power meter (on or off)

pylablib.aux_libs.devices.PCO_SC2 module

exception pylablib.aux_libs.devices.PCO_SC2.PCOSC2Error[source]

Bases: RuntimeError

Generic PCO SC2 camera error.

exception pylablib.aux_libs.devices.PCO_SC2.PCOSC2TimeoutError[source]

Bases: pylablib.aux_libs.devices.PCO_SC2.PCOSC2Error

Timeout while waiting.

exception pylablib.aux_libs.devices.PCO_SC2.PCOSC2NotSupportedError[source]

Bases: pylablib.aux_libs.devices.PCO_SC2.PCOSC2Error

Option not supported.

pylablib.aux_libs.devices.PCO_SC2.get_cameras_number()[source]

Get number of connected PCOSC2 cameras

pylablib.aux_libs.devices.PCO_SC2.reset_api()[source]

Reset API.

All cameras must be closed; otherwise, the prompt to reboot will appear.

class pylablib.aux_libs.devices.PCO_SC2.PCOSC2Camera(idx=0, reboot_on_fail=True)[source]

Bases: pylablib.core.devio.interface.IDevice

PCO SC2 camera.

Parameters:
  • idx (int) – camera index (use get_cameras_number() to get the total number of connected cameras)
  • reboot_on_fail (bool) – if True and the camera raised an error during initialization (but after opening), reboot the camera and try to connect again useful when the camera is in a broken state (e.g., wrong ROI or pixel clock settings)
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

is_opened()[source]

Check if the device is connected

reboot(wait=True)[source]

Reboot the camera.

If wait==True, wait for the recommended time (10 seconds) after reboot for the camera to fully restart; attempt to open the camera before that can lead to an error.

get_full_camera_data()[source]

Get a dictionary the all camera data available through the SDK.

update_full_data()[source]

Update internal full camera data settings.

Takes some time (about 50ms), so more specific function are preferrables for specific parameters.

class ModelData(model, interface, sensor, serial_number)

Bases: tuple

interface
model
sensor
serial_number
get_model_data()[source]

Get camera model data.

Return tuple (model, interface, sensor, serial_number).

get_capabilities()[source]

Get camera capabilities.

For description of the capabilities, see PCO SC2 manual.

class CameraStatus(status, warnings, errors)

Bases: tuple

errors
status
warnings
get_status(full=False)[source]

Get camera status.

If full==True, return current camera status as a set of enabled status states; otherwise, return tuple (status, warnings, errors) with additional information about warnings and error.

get_temperature()[source]

Get the current camera temperature

Return tuple (CCD, cam, power) with temperatures of the sensor, camera, and power supply respectively.

get_conversion_factor()[source]

Get camera conversion factor (electrons per pixel value)

get_trigger_mode()[source]

Get current trigger mode (see set_trigger_mode() for description)

set_trigger_mode(mode)[source]

Set trigger mode.

Can be "int" (internal), "soft" (software), "ext" (external+software), "ext_exp" (external exposure), "ext_sync" (external PLL sync), "ext_exp_fast" (fast external exposure), "ext_cds" (external CDS control), "ext_exp_slow" (slow external exposure)`, or "ext_sync_hdsdi" (external synchronized SD/HDI).

For description, see PCO SDK manual.

send_software_trigger()[source]

Send software trigger signal

class Buffer(size, metadata_size=0)[source]

Bases: object

Single frame buffer object, which controls setup, cleanup, and synchronization

wait(timeout)[source]
reset()[source]
release()[source]
class AcqTimes(exposure, frame_delay, frame_time)

Bases: tuple

exposure
frame_delay
frame_time
get_timings()[source]

Get acquisition timing.

Return tuple (exposure, frame_delay, frame_time).

set_exposure(exposure)[source]

Set camera exposure

get_exposure()[source]

Get current exposure

set_frame_delay(frame_delay)[source]

Set camera frame delay

get_frame_delay()[source]

Get current frame delay

set_frame_time(frame_time=0, adjust_exposure=False)[source]

Set frame time (frame acquisition period).

If the time can’t be achieved even with zero frame delay and adjust_exposure==True, try to reduce the exposure to get the desired frame time; otherwise, keep the exposure the same.

get_frame_time()[source]

Get current frame time (frame acquisition period)

get_pixel_rate()[source]

Get camera pixel rate (in Hz)

get_available_pixel_rates()[source]

Get all available pixel rates

set_pixel_rate(rate=None)[source]

Set camera pixel rate (in Hz)

The rate is always rounded to the closest available. If rate is None, set the maximal possible rate.

start_acquisition(buffn=None)[source]

Start camera acquisition.

buffn specifies number of frames in the ring buffer (automatically capped at 32, which is the SDK limit)

stop_acquisition()[source]

Stop acquisition.

Clears buffers as well, so any readout after acquisition stop is impossible.

acquisition_in_progress()[source]

Check if the acquisition is in progress

wait_for_frame(since='lastread', timeout=20.0, period=0.001)[source]

Wait for a new camera frame.

since specifies what constitutes a new frame. Can be "lastread" (wait for a new frame after the last read frame), "lastwait" (wait for a new frame after last wait_for_frame() call), or "now" (wait for a new frame acquired after this function call). If timeout is exceeded, raise PCOSC2TimeoutError. period specifies camera polling period.

pausing_acquisition()[source]

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

Useful for applying certain settings which can’t be changed during the acquisition (any settings except for exposure).

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, hbin, vbin).

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

Setup camera ROI.

hstart and hend specify horizontal image extent, vstart and vend specify vertical image extent (start are inclusive, stop are exclusive, starting from 0), hbin and vbin specify binning. By default, all non-supplied parameters take extreme values.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 6-tuple describing the ROI.

get_bit_aligment()[source]

Get data bit alignment

Can be "LSB" (normal alignment) or "MSB" (if camera data is less than 16 bit, it is padded with zeros on the right to match 16 bit).

set_bit_aligment(mode)[source]

Get data bit alignment

Can be "LSB" (normal alignment) or "MSB" (if camera data is less than 16 bit, it is padded with zeros on the right to match 16 bit).

enable_pixel_correction(enable=True)[source]

Enable or disable hotpixel correction

is_pixel_correction_enabled()[source]

Check if hotpixel correction is enabled

get_noise_filter_mode()[source]

Get the noise filter mode (for details, see set_noise_filter_mode())

set_noise_filter_mode(mode='on')[source]

Set the noise filter mode.

Can be "off", "on", or "on_hpc" (on + hot pixel correction).

set_status_line_mode(binary=True, ascii=False)[source]

Set status line mode.

binary determines if the binary line is present (it occupies first 14 pixels of the image). ascii determines if the ascii line is present (it is plane text timestamp, which takes first 8 rows and about 300 columns).

It is recommended to always have binary option on, since it is used to determine frame index for checking if there are any missing frames.

get_status_line_mode()[source]

Get status line mode.

Return tuple (binary, ascii) (see set_status_line_mode() for description)

set_metadata_mode(mode=True)[source]

Set metadata mode

get_metadata_mode()[source]

Get metadata mode

Return tuple (enabled, size, version)

get_data_dimensions()[source]

Get readout data dimensions

get_buffer_size()[source]

Get number of frames in the ring buffer

class TBufferStatus(unread, size, scheduled, scheduled_max)

Bases: tuple

scheduled
scheduled_max
size
unread
get_buffer_status()[source]
get_new_images_range()[source]

Get the range of the new images.

Return tuple (first, last) with images range (inclusive). If no images are available, return None.

read_multiple_images(rng=None, return_info=False)[source]

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

If return_info==True, return tuple (images, info), where images is a list of frames, and info is a list of frame info tuples extracted from the binary status line (with only one member, frame index). Note that if the binary status line is not activated, frame info will be an arbitrary noise. If return_info==False, just return a list of frames.

Fro technical reasons, frames should be read in successively, and every frame can only be read ones. Hence, if rng is specified, it can lead to either skipping unread frames (if rng starts after the first unread frame), or reduced number of frames compared to request (if rng attempts to read non-acquired or already-read frames).

snap()[source]

Snap a single image

class pylablib.aux_libs.devices.PCO_SC2.TFrameInfo(framestamp)

Bases: tuple

framestamp
pylablib.aux_libs.devices.PCO_SC2.get_frame_info(frame)[source]

Get frame info from the binary status line.

Assume that the status line is present; if it isn’t, the returned frame info will be a random noise.

pylablib.aux_libs.devices.PCO_SC2_lib module

Used by autodoc_mock_imports.

pylablib.aux_libs.devices.Pfeiffer module

exception pylablib.aux_libs.devices.Pfeiffer.PfeifferError[source]

Bases: RuntimeError

Pfiffer devices reading error.

class pylablib.aux_libs.devices.Pfeiffer.TPG261(conn)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

TPG 261 series pressure gauge.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
comm(msg)[source]

Send a command to the device

query(msg)[source]

Send a query to the device and return the reply

get_channel_status(channel=1)[source]
get_pressure(channel=1)[source]

Get pressure at a given channel

pylablib.aux_libs.devices.PhotonFocus module

exception pylablib.aux_libs.devices.PhotonFocus.PFGenericError[source]

Bases: RuntimeError

Generic IMAQ camera error.

class pylablib.aux_libs.devices.PhotonFocus.PfcamProperty(port, name)[source]

Bases: object

Object representing a pfcam camera property.

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

name

attribute name

readable

whether property is readable

Type:bool
writable

whether property is writable

Type:bool
is_command

whether property is a command

Type:bool
min

minimal property value (if applicable)

Type:float or int
max

maximal property value (if applicable)

Type:float or int
values

list of possible property values (if applicable)

update_minmax()[source]

Update minimal and maximal property limits

truncate_value(value)[source]

Truncate value to lie within property limits

get_value(enum_as_str=True)[source]

Get property value.

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

set_value(value, truncate=True)[source]

Get property value.

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

call_command(arg=0)[source]

If property is a command, call it with a given argument; otherwise, raise an error.

pylablib.aux_libs.devices.PhotonFocus.query_camera_name(port)[source]

Query cameras name at a given port in pfcam interface

pylablib.aux_libs.devices.PhotonFocus.list_cameras(supported=False)[source]

List all cameras available through pfcam interface

If supported==True, only return cameras which support pfcam protocol.

class pylablib.aux_libs.devices.PhotonFocus.PhotonFocusIMAQCamera(imaq_name='img0', pfcam_port=0)[source]

Bases: pylablib.aux_libs.devices.IMAQ.IMAQCamera

IMAQ+PFcam interface to a PhotonFocus camera.

Parameters:
  • imaq_name – IMAQ interface name (can be learned by IMAQ.list_cameras(); usually, but not always, starts with "img")
  • pfcam_port – port number for pfcam interface (can be learned by list_cameras(); port number is the first element of the camera data tuple)
setup_max_baudrate()[source]
open()[source]

Open connection to the camera

close()[source]

Close connection to the camera

post_open()[source]

Action to automatically call on opening

list_properties(root='')[source]

List all properties at a given root.

Return list of PfcamProperty objects, which allow querying and settings values and getting additional information (limits, values).

get_value(name, default=None)[source]

Get value of the property with a given name

set_value(name, value, ignore_missing=False, truncate=True)[source]

Set value of the property with a given name.

If truncate==True, truncate value to lie within property range.

call_command(name, arg=0, ignore_missing=False)[source]

If property is a command, call it with a given argument; otherwise, raise an error.

get_all_properties(root='', as_dict=False)[source]

Get values of all properties with the given root.

If as_dict==True, return dict object; otherwise, return Dictionary object.

set_all_properties(settings, root='', truncate=True)[source]

Set values of all properties with the given root.

If truncate==True, truncate value to lie within attribute range.

class ModelData(model, serial_number)

Bases: tuple

model
serial_number
get_model_data()[source]

Get camera model data.

Return tuple (model, serial_number).

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

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

Setup camera ROI.

By default, all non-supplied parameters take extreme values.

get_roi_limits()[source]

Get the minimal and maximal ROI parameters.

Return tuple (min_roi, max_roi), where each element is in turn 4-tuple describing the ROI.

get_exposure()[source]

Get current exposure

set_exposure(exposure)[source]

Set current exposure

get_frame_time()[source]

Get current frame time

set_frame_time(frame_time)[source]

Set current frame time

is_CFR_enabled()[source]

Check if the constant frame rate mode is enabled

enable_CFR(enabled=True)[source]

Enable constant frame rate mode

get_trigger_interleave()[source]

Check if the trigger interleave is on

set_trigger_interleave(enabled)[source]

Set the trigger interleave option on or off

is_status_line_enabled()[source]

Check if the status line is on

enable_status_line(enabled=True)[source]

Enable or disable status line

get_black_level_offset()[source]

Get the black level offset

set_black_level_offset(offset)[source]

Set the black level offset

pylablib.aux_libs.devices.PhotonFocus.get_status_lines(frames, check_transposed=True)[source]

Extract status lines from the given frames.

frames can be 2D array (one frame), 3D array (stack of frames, first index is frame number), or list of array. Automatically check if the status line is present; return None if it’s not. If check_transposed==True, check for the case where the image is transposed (i.e., line becomes a column).

pylablib.aux_libs.devices.PhotonFocus.get_status_line_position(frame, check_transposed=True)[source]

Check whether status line is present in the frame, and return its location.

Return tuple (row, transposed), where row is the status line row (can be -1 or -2) and transposed is True if the line is present in the transposed image. If no status line is found, return None. If check_transposed==True, check for the case where the image is transposed (i.e., line becomes a column).

pylablib.aux_libs.devices.PhotonFocus.remove_status_line(frame, sl_pos='calculate', policy='duplicate', copy=True)[source]

Remove status line from the frame.

Parameters:
  • frame – a frame to process (2D or 3D numpy array; if 3D, the first axis is the frame number)
  • sl_pos – status line position (returned by get_status_line_position()); if equal to "calculate", calculate here; for a 3D array, assumed to be the same for all frames
  • policy – determines way to deal with the status line; can be "keep" (keep as is), "cut" (cut off the status line row), "zero" (set it to zero), "median" (set it to the image median), or "duplicate" (set it equal to the previous row; default)
  • copy – if True, make copy of the original frames; otherwise, attempt to remove the line in-place
pylablib.aux_libs.devices.PhotonFocus.find_skipped_frames(lines, step=1)[source]

Check if there are skipped frames based on status line reading.

step specifies expected index step between neighboring frames.

Return list [(idx, skipped)], where idx is the index after which skipped frames were skipped.

pylablib.aux_libs.devices.PurePhotonics module

class pylablib.aux_libs.devices.PurePhotonics.CBDX1(addr, read_echo=True, comm_delay=0.5, mode_wait_time=5.0, offset_wait_time=5.0, connect_on_operation=True)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

CBDX1 controller for the PurePhotonics PPCL200 laser.

initialize()[source]
reset_output()[source]
ensure_output()[source]
write_register(addr, value)[source]
read_register(addr)[source]
is_busy()[source]
wait_sync(timeout=None)[source]

Pause execution of the script until device overlapped commands (e.g., taking sweeps) are complete.

timeout and wait_callback override default constructor parameters.

get_mode()[source]
set_mode(mode, wait=True)[source]
get_output()[source]
set_output(enabled=True, wait=True)[source]
get_output_level()[source]
set_output_level(level, wait=True, check_mode=True)[source]
get_wavelength()[source]
set_wavelength(wavelength, wait=True, check_mode=True)[source]
get_offset()[source]
set_offset(offset, wait=True)[source]
step_wavelength(step)[source]
sweep_wavelength(start, step_size, steps_number, delay)[source]
cycle_wavelength(step)[source]
step_offset(step)[source]
get_offset_wavelength()[source]
apply_settings(settings)[source]

Apply the settings.

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

pylablib.aux_libs.devices.Rigol module

class pylablib.aux_libs.devices.Rigol.DSA1030A(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Rigol DSA1030A Spectrum Analyzer.

select_channel(channel)[source]
current_channel()[source]
sweep_single(wait_type='sync')[source]
sweep_reset(wait_type='sync')[source]
sweep_continuous(enable=True)[source]
is_continuous()[source]
get_output()[source]
set_output(enabled=True)[source]
get_output_level()[source]
set_output_level(level)[source]
get_frequency_range()[source]
set_frequency_range(frequency)[source]
get_sweep_points()[source]
set_sweep_points(pts)[source]
get_bandwidth(bw_type='video')[source]
set_bandwidth(bwidth, bw_type='both')[source]
get_attenuation()[source]
set_attenuation(att)[source]
autoscale_power()[source]
set_data_format(fmt=None)[source]
get_data_format()[source]
request_data(fmt=None)[source]
read_sweep()[source]
grab_single_sweep(chunks=1, autoscale=True, auto_step_fraction=0.1, chunks_ovlap_pts='auto', error_retries=3)[source]
apply_settings(settings)[source]

Apply the settings.

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

pylablib.aux_libs.devices.Sirah module

exception pylablib.aux_libs.devices.Sirah.SirahError[source]

Bases: RuntimeError

Generic Sirah error

exception pylablib.aux_libs.devices.Sirah.SirahTimeoutError[source]

Bases: pylablib.aux_libs.devices.Sirah.SirahError

Sirah waiting timeout error

class pylablib.aux_libs.devices.Sirah.SirahInterface(conn)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Generic Sirah device interface using Visa communication.

Parameters:conn – VISA connection string (something like "USB0::0x17E7::<DEVICE_ID>::<DEVICE_SN>::INSTR")
open()[source]

Open the backend.

get_error_codes(clear=True)[source]

Return errors raised by the Matisse controller.

If clear==True, clear the errors on the controller (otherwise, it doesn’t execute new commands).

class pylablib.aux_libs.devices.Sirah.SirahMatisse(conn)[source]

Bases: pylablib.aux_libs.devices.Sirah.SirahInterface

Sirah Matisse device interface using Visa communication.

Parameters:conn – VISA connection string (something like "USB0::0x17E7::0x0102::<DEVICE_ID>::INSTR")
brf_home()[source]

Home BRF motor

brf_halt()[source]

Stop BRF motor (smoothly)

get_brf_status_n()[source]

Get BRF motor status as an integer

For the meaning, see Matisse Programmer’s Guide

is_brf_moving()[source]

Check if BRF motor is moving

wait_for_brf(timeout=30.0, wait_step=0.3)[source]

Wait until BRF motor is stopped

get_brf_position()[source]

Get BRF motor position

set_brf_position(position)[source]

Move BRF motor to a new position

thinet_home()[source]

Home thin etalon motor

thinet_halt()[source]

Stop thin etalon motor (smoothly)

get_thinet_status_n()[source]

Get thin etalon motor status as an integer

For the meaning, see Matisse Programmer’s Guide

is_thinet_moving()[source]

Check if thin etalon motor is moving

wait_for_thinet(timeout=30.0, wait_step=0.3)[source]

Wait until thin etalon motor is stopped

get_thinet_position()[source]

Get thin etalon motor position

set_thinet_position(position)[source]

Move thin etalon motor to a new position

get_piezoet_position()[source]

Get piezo etalon position

set_piezoet_position(position)[source]

Change piezo etalon position

pylablib.aux_libs.devices.SmarAct module

exception pylablib.aux_libs.devices.SmarAct.SmarActError[source]

Bases: RuntimeError

Generic SmarAct error.

class pylablib.aux_libs.devices.SmarAct.SCU3D(lib_path=None, idx=0, axis_mapping='xyz', axis_dir='+++')[source]

Bases: pylablib.core.devio.interface.IDevice

SmarAct SCU3D translation stage.

Parameters:
  • lib_path (str) – path to the SCU3DControl.dll (default is to use the library supplied with the package)
  • idx (int) – stage index
  • axis_mapping (str) – 3-symbol string specifying indices of x, y and z axes (can be any permutation of "xyz")
  • axis_dir (str) – 3-symbol string specifying default directions of the axes (each symbol be "+" or "-")
open()[source]

Open the connection to the stage

close()[source]

Close the connection to the stage

is_opened()[source]

Check if the device is connected

get_axis_mapping()[source]
set_axis_mapping(mapping)[source]
get_axis_dir()[source]
set_axis_dir(dir)[source]
move_macrostep(axis, steps, voltage, frequency)[source]

Move along a given axis with a given number of steps.

voltage (in Volts) and frequency (in Hz) specify the motion parameters.

move(axis, steps=1, stepsize=10)[source]

Move along a given axis with a given number of steps using one of the predefined step size.

stepsize can range from 1 (smallest) to 20 (largest).

get_status(axis)[source]

Get the axis status

wait_for_axis(axis, status='stopped', timeout=3.0)[source]

Wait until the axis reaches a given status.

By default the status is "stopped" (i.e., wait until the motion is finished).

is_moving(axis)[source]

Check if a given axis is moving

pylablib.aux_libs.devices.Tektronix module

class pylablib.aux_libs.devices.Tektronix.ITektronixScope(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Generic Tektronix Oscilloscope.

grab_single(wait_type='sync')[source]
grab_continuous(enable=True)[source]
is_continuous()[source]
is_grabbing()[source]
get_edge_trigger_source()[source]
get_edge_trigger_coupling()[source]
get_edge_trigger_slope()[source]
get_trigger_level()[source]
set_edge_trigger(source, level, coupling='dc', slope='fall')[source]
get_trigger_mode()[source]
set_trigger_mode(mode='auto')[source]
get_trigger_state()[source]
force_trigger()[source]
get_horizontal_span()[source]
set_horizontal_span(span)[source]
get_horizontal_offset()[source]
set_horizontal_offset(offset=0.0)[source]
channel_enabled(channel)[source]
enable_channel(channel, enabled=True)[source]
get_coupling(channel)[source]
set_coupling(channel, coupling='dc')[source]
get_vertical_span(channel)[source]
set_vertical_span(channel, span)[source]
get_vertical_position(channel)[source]
set_vertical_position(channel, offset)[source]
get_points_number(kind='send')[source]
set_points_number(pts_num, reset_limts=True)[source]
get_data_pts_range()[source]
set_data_pts_range(rng=None)[source]
set_data_format(fmt=None)[source]
get_data_format()[source]
get_wfmpre()[source]
request_data(fmt=None)[source]
selected_channel()[source]
select_channel(channel)[source]
read_multiple_sweeps(channels, wfmpres=None, ensure_fmt=True)[source]
read_sweep(channel, wfmpre=None, ensure_fmt=True)[source]
class pylablib.aux_libs.devices.Tektronix.DPO2014(addr)[source]

Bases: pylablib.aux_libs.devices.Tektronix.ITektronixScope

Tektronix DPO2014 Oscilloscope.

get_horizontal_offset()[source]
set_horizontal_offset(offset=0.0)[source]
class pylablib.aux_libs.devices.Tektronix.TDS2000(addr)[source]

Bases: pylablib.aux_libs.devices.Tektronix.ITektronixScope

Tektronix TDS2000 Oscilloscope.

class pylablib.aux_libs.devices.Tektronix.MDO3000(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Tektronix MDO3000 Oscilloscope with the Spectrum Analyzer add-on.

get_avg()[source]
set_avg(avg)[source]
grab_single(avg=None, wait_type='sync')[source]
grab_continuous(enable=True)[source]
is_continuous()[source]
is_grabbing()[source]
get_horizontal_span()[source]
set_horizontal_span(span)[source]
channel_enabled(channel)[source]
enable_channel(channel, enabled=True)[source]
get_vertical_span(channel)[source]
set_vertical_span(channel, span)[source]
get_frequency_range()[source]
set_frequency_range(frequency)[source]
get_bandwidth()[source]
set_bandwidth(bwidth)[source]
get_rel_sweep_step()[source]
set_rel_sweep_step(step)[source]
get_rf_avg()[source]
set_rf_avg(avg)[source]
get_ref_level()[source]
set_ref_level(level)[source]
enable_rf_channel(kind='normal', enable=True)[source]
get_rf_mode(kind='normal')[source]
set_rf_mode(mode='max', kind='norm')[source]
get_points_number(kind='send')[source]
set_points_number(pts_num, reset_limts=True)[source]
get_data_pts_range()[source]
set_data_pts_range(rng=None)[source]
set_data_format(fmt=None)[source]
get_data_format()[source]
request_data(fmt=None, set_fmt=True)[source]
read_trace(channel)[source]
read_sweep(kind='normal')[source]
grab_rf_sweep(kind='avg', avg=None, freq_step=None)[source]
get_selected_channel()[source]
select_channel(channel)[source]

pylablib.aux_libs.devices.Thorlabs module

class pylablib.aux_libs.devices.Thorlabs.PM100D(addr)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Thorlabs PM100D optical Power Meter.

Parameters:addr – connection address (usually, a VISA connection string)
setup_power_measurement()[source]

Switch the device into power measurement mode

get_power()[source]

Get the power readings

class pylablib.aux_libs.devices.Thorlabs.ThorlabsInterface(conn)[source]

Bases: pylablib.core.devio.SCPI.SCPIDevice

Generic Thorlabs device interface using Serial communication.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
open()[source]

Open the backend.

class pylablib.aux_libs.devices.Thorlabs.FW(conn, respect_bound=True)[source]

Bases: pylablib.aux_libs.devices.Thorlabs.ThorlabsInterface

Thorlabs FW102/202 motorized filter wheels.

Parameters:
  • conn – serial connection parameters (usually port or a tuple containing port and baudrate)
  • respect_bound (bool) – if True, avoid crossing the boundary between the first and the last position in the wheel
get_position()[source]

Get the wheel position (starting from 1)

set_position(pos)[source]

Set the wheel position (starting from 1)

get_pcount()[source]

Get the number of wheel positions (6 or 12)

set_pcount(pcount)[source]
get_speed()[source]

Get the motion speed

set_speed(speed)[source]

Set the motion speed

class pylablib.aux_libs.devices.Thorlabs.MDT69xA(conn)[source]

Bases: pylablib.aux_libs.devices.Thorlabs.ThorlabsInterface

Thorlabs MDT693/4A high-voltage source.

Uses MDT693A program interface, so should be compatible with both A and B versions.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
get_voltage(channel='x')[source]

Get the output voltage in Volts at a given channel

set_voltage(voltage, channel='x')[source]

Set the output voltage in Volts at a given channel

get_voltage_range()[source]

Get the selected voltage range in Volts (75, 100 or 150).

exception pylablib.aux_libs.devices.Thorlabs.KinesisError[source]

Bases: RuntimeError

Generic Kinesis device error.

exception pylablib.aux_libs.devices.Thorlabs.KinesisTimeoutError[source]

Bases: pylablib.aux_libs.devices.Thorlabs.KinesisError

Kinesis timeout error.

pylablib.aux_libs.devices.Thorlabs.list_kinesis_devices(filter_ids=True)[source]

List all Thorlabs Kinesis devices connected ot this PC.

Return list of tuples (conn, description).
If filter_ids==True, only leave devices with Tholabs-like IDs (8-digit numbers). Otherwise, show all devices (some of them might not be Thorlabs-related).
class pylablib.aux_libs.devices.Thorlabs.KinesisDevice(conn, timeout=3.0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Generic Kinesis device.

Implements FTDI chip connectivity via pyft232 (virtual serial interface).

Parameters:conn – serial connection parameters (usually 8-digit device serial number).
static list_devices(filter_ids=True)[source]

List all connected devices.

Return list of tuples (conn, description). If filter_ids==True, only leave devices with Tholabs-like IDs (8-digit numbers). Otherwise, show all devices (some of them might not be Thorlabs-related).

send_comm_nodata(messageID, param1=0, param2=0, source=1, dest=80)[source]

Send a message with no associated data.

For details, see APT communications protocol.

send_comm_data(messageID, data, source=1, dest=80)[source]

Send a message with associated data.

For details, see APT communications protocol.

class CommNoData(messageID, param1, param2, source, dest)

Bases: tuple

dest
messageID
param1
param2
source
class CommData(messageID, data, source, dest)

Bases: tuple

data
dest
messageID
source
recv_comm()[source]

Receive a message.

Return either CommNoData or CommData depending on the message type (fixed length with two parameters, or variable length with associated data). For details, see APT communications protocol.

recv_comm_nodata()[source]

Receive a fixed-length message with two parameters and no associated data.

If the next message is variable-length, raise error. For details, see APT communications protocol.

recv_comm_data()[source]

Receive a variable-length message with associated data.

If the next message is fixed-length, raise error. For details, see APT communications protocol.

add_background_comm(messageID)[source]

Mark given messageID as a ‘background’ message, which can be sent at any point without prompt (e.g., some operation confirmation).

If it is received instead during recv_comm_ operations, it is ignored, and the corresponding counter is increased.

check_background_comm(messageID)[source]

Return message counter and the last message value (None if not message received yet) of a given ‘background’ message.

class DeviceInfo(serial_no, model_no, fw_ver, hw_type, hw_ver, mod_state, nchannels)

Bases: tuple

fw_ver
hw_type
hw_ver
mod_state
model_no
nchannels
serial_no
get_info(dest=80)[source]

Get device info.

Identify the physical device (by, e.g., blinking status LED or screen)

class pylablib.aux_libs.devices.Thorlabs.MFF(conn)[source]

Bases: pylablib.aux_libs.devices.Thorlabs.KinesisDevice

MFF (Motorized Filter Flip Mount) device.

Implements FTDI chip connectivity via pyft232 (virtual serial interface).

Parameters:conn – serial connection parameters (usually 8-digit device serial number).
set_position(pos, channel=0)[source]

Set the flip mount position (either 0 or 1)

get_position(channel=0)[source]

Get the flip mount position (either 0 or 1).

Return None if the mount is current moving.

class pylablib.aux_libs.devices.Thorlabs.KDC101(conn)[source]

Bases: pylablib.aux_libs.devices.Thorlabs.KinesisDevice

Thorlabs KDC101 DC servo motor controller.

Implements FTDI chip connectivity via pyft232 (virtual serial interface).

Parameters:conn (str) – serial connection parameters (usually 8-digit device serial number).
get_status_n()[source]

Get numerical status of the device.

For details, see APT communications protocol.

status_bits = [(1, 'sw_bk_lim'), (2, 'sw_fw_lim'), (16, 'moving_bk'), (32, 'moving_fw'), (64, 'jogging_bk'), (128, 'jogging_fw'), (512, 'homing'), (1024, 'homed'), (4096, 'tracking'), (8192, 'settled'), (16384, 'motion_error'), (16777216, 'current_limit'), (2147483648, 'enabled')]
get_status()[source]

Get device status.

Return list of status strings, which can include "sw_fw_lim" (forward limit switch reached),``”sw_bk_lim”`` (backward limit switch reached), "moving_fw" (moving forward), "moving_bk" (moving backward), "homing" (homing), "homed" (homing done), "tracking", "settled", "motion_error" (excessive position error), "current_limit" (motor current limit exceeded), or "enabled" (motor is enabled).

wait_for_status(status, enabled, timeout=None, period=0.05)[source]

Wait until the given status (or list of status bits) is in the desired state.

status is a string or a list of strings describing the status bits to monitor; for possible values, see get_status(). If enabled==True, wait until one of the given statuses is enabled; otherwise, wait until all given statuses are disabled. period specifies status checking period (in s).

home(sync=True, force=False, timeout=None)[source]

Home the device.

If sync==True, wait until homing is done (with the given timeout). If force==False, only home if the device isn’t homed already.

is_homing()[source]

Check if homing is in progress

is_homed()[source]

Check if the device is homed

wait_for_home(timeout=None)[source]

Wait until the device is homes

get_velocity_params(scale=True)[source]

Get current velocity parameters (max_velocity, acceleration)

If scale==True, return these in counts/sec and counts/sec^2 respectively; otherwise, return in internal units.

set_velocity_params(max_velocity, acceleration=None)[source]

Set current velocity parameters.

The parameters are given in counts/sec and counts/sec^2 respectively (as returned by get_velocity_params() with scale=True). If acceleration is None, use current value.

get_position()[source]

Get current position

set_position_reference(position=0)[source]

Set position reference (actual motor position stays the same)

move(steps=1)[source]

Move by steps (positive or negative) from the current position

move_to(position)[source]

Move to position (positive or negative)

jog(direction)[source]

Jog in the given direction ("+" or "-")

is_moving()[source]

Check if motion is in progress

wait_for_move(timeout=None)[source]

Wait until motion is done

stop(immediate=False, sync=True, timeout=None)[source]

Stop the motion.

If immediate==True make an abrupt stop; otherwise, slow down gradually. If sync==True, wait until the motion is stopped.

wait_for_stop(timeout=None)[source]

Wait until stopping operation is done

class pylablib.aux_libs.devices.Thorlabs.K10CR1(conn)[source]

Bases: pylablib.aux_libs.devices.Thorlabs.KinesisDevice

Thorlabs K10CR1 rotation stage.

Implements FTDI chip connectivity via pyft232 (virtual serial interface).

Parameters:conn (str) – serial connection parameters (usually 8-digit device serial number).
get_status_n()[source]

Get numerical status of the device.

For details, see APT communications protocol.

status_bits = [(1, 'sw_bk_lim'), (2, 'sw_fw_lim'), (16, 'moving_bk'), (32, 'moving_fw'), (64, 'jogging_bk'), (128, 'jogging_fw'), (512, 'homing'), (1024, 'homed'), (4096, 'tracking'), (8192, 'settled'), (16384, 'motion_error'), (16777216, 'current_limit'), (2147483648, 'enabled')]
get_status()[source]

Get device status.

Return list of status strings, which can include "sw_fw_lim" (forward limit switch reached),``”sw_bk_lim”`` (backward limit switch reached), "moving_fw" (moving forward), "moving_bk" (moving backward), "homing" (homing), "homed" (homing done), "tracking", "settled", "motion_error" (excessive position error), "current_limit" (motor current limit exceeded), or "enabled" (motor is enabled).

wait_for_status(status, enabled, timeout=None, period=0.05)[source]

Wait until the given status (or list of status bits) is in the desired state.

status is a string or a list of strings describing the status bits to monitor; for possible values, see get_status(). If enabled==True, wait until one of the given statuses is enabled; otherwise, wait until all given statuses are disabled. period specifies status checking period (in s).

home(sync=True, force=False, timeout=None)[source]

Home the device.

If sync==True, wait until homing is done (with the given timeout). If force==False, only home if the device isn’t homed already.

is_homing()[source]

Check if homing is in progress

is_homed()[source]

Check if the device is homed

wait_for_home(timeout=None)[source]

Wait until the device is homes

get_velocity_params(scale=True)[source]

Get current velocity parameters (max_velocity, acceleration)

If scale==True, return these in degree/sec and degree/sec^2 respectively; otherwise, return in internal units.

set_velocity_params(max_velocity, acceleration=None)[source]

Set current velocity parameters.

The parameters are given in counts/sec and counts/sec^2 respectively (as returned by get_velocity_params() with scale=True). If acceleration is None, use current value.

get_position()[source]

Get current position (in degrees)

set_position_reference(position=0)[source]

Set position reference (actual motor position stays the same)

move(angle=1)[source]

Move by angle (degree, positive or negative) from the current position

move_to(position)[source]

Move to position (degree, positive or negative)

jog(direction)[source]

Jog in the given direction ("+" or "-")

is_moving()[source]

Check if motion is in progress

wait_for_move(timeout=None)[source]

Wait until motion is done

stop(immediate=False, sync=True, timeout=None)[source]

Stop the motion.

If immediate==True make an abrupt stop; otherwise, slow down gradually. If sync==True, wait until the motion is stopped.

wait_for_stop(timeout=None)[source]

Wait until stopping operation is done

pylablib.aux_libs.devices.Trinamic module

exception pylablib.aux_libs.devices.Trinamic.TrinamicError[source]

Bases: RuntimeError

Generic Trinamic error.

class pylablib.aux_libs.devices.Trinamic.TMCM1100(conn)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Trinamic stepper motor controller.

Parameters:conn – serial connection parameters (usually port or a tuple containing port and baudrate)
open()[source]

Open the backend.

class ReplyData(comm, status, value, addr, module)

Bases: tuple

addr
comm
module
status
value
query(comm, comm_type, value, result_format='i4', bank=0, addr=0)[source]

Send a query to the stage and return the reply.

For details, see TMCM-1110 firmware manual.

get_axis_parameter(parameter, result_format='i4', addr=0)[source]

Get a given axis parameter

set_axis_parameter(parameter, value, addr=0)[source]

Set a given axis parameter (volatile; resets on power cycling)

store_axis_parameter(parameter, value=None, addr=0)[source]

Store a given axis parameter in EEPROM (by default, value is the current value)

get_global_parameter(parameter, result_format='i4', bank=0, addr=0)[source]

Get a given global parameter

set_global_parameter(parameter, value, bank=0, addr=0)[source]

Set a given global parameter

move_to(position, addr=0)[source]

Move to a given position

move(steps=1, addr=0)[source]

Move for a given number of steps

get_position(addr=0)[source]

Get the current axis position

jog(direction, speed)[source]

Jog in a given direction with a given speed.

direction can be either "-" (negative) or "+" (positive). The motion continues until it is explicitly stopped, or until a limit is hit.

stop(addr=0)[source]

Stop motion

get_speed(addr=0)[source]

Get the speed setting

set_speed(speed, addr=0)[source]

Set the speed setting

get_current_speed(addr=0)[source]

Get the current speed

is_moving(addr=0)[source]

Check if the motor is moving

wait_for_axis(addr=0)[source]

Wait for the motor to stop moving

pylablib.aux_libs.devices.UBNT module

The MIT License (MIT)

Copyright (c) 2014 Andrew Rodgers

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

class pylablib.aux_libs.devices.UBNT.UbntConfig(config)[source]

Bases: object

parse_line(line_string, data)[source]
parse_config(conf)[source]
get_ntp()[source]
set_ntp(ntp_server)[source]
get_crontab()[source]
add_cronjob(schedule, status, cmd, label)[source]
flatten_config(obj, path=(), memo=None)[source]
get_config_dump()[source]
get_config()[source]
class pylablib.aux_libs.devices.UBNT.MfiDevice(url, user, passwd, cache_timeout=2)[source]

Bases: object

Base class for all mFi devices

login()[source]
get_data()[source]
get_sensor(port_no)[source]
get_param(port_no, param)[source]
get_cfg()[source]
set_cfg(config_string)[source]
class pylablib.aux_libs.devices.UBNT.MPower(url, user, passwd, cache_timeout=2)[source]

Bases: pylablib.aux_libs.devices.UBNT.MfiDevice

Provides an interface to a single mPower Device

get_power(port_no)[source]
switch(port_no, state='toggle')[source]
class pylablib.aux_libs.devices.UBNT.MPort(url, user, passwd, cache_timeout=2)[source]

Bases: pylablib.aux_libs.devices.UBNT.MfiDevice

Provides an API to a single mPort Device

get_temperature(port_no, temp_format='c')[source]

pylablib.aux_libs.devices.Vaunix module

class pylablib.aux_libs.devices.Vaunix.IVaunixDevice(product_id=None, idx=0)[source]

Bases: pylablib.core.devio.backend.IBackendWrapper

Generic Vaunix device.

close()[source]

Close the backend.

send_data(comm, count, value)[source]
recv_data(comm)[source]
query_data(send_comm, recv_comm=None, send_count=0, send_value=0)[source]
class pylablib.aux_libs.devices.Vaunix.LMS(product_id=None, idx=0)[source]

Bases: pylablib.aux_libs.devices.Vaunix.IVaunixDevice

Vaunix LMS (LabBrick) microwave generator.

get_output()[source]
set_output(output=True)[source]
get_extref()[source]
set_extref(extref=True)[source]
get_output_level()[source]
set_output_level(level)[source]
get_frequency()[source]
set_frequency(frequency)[source]
save_as_default()[source]
apply_settings(settings)[source]

Apply the settings.

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

pylablib.aux_libs.devices.ZurichInstruments module

pylablib.aux_libs.devices.ZurichInstruments.get_timestamps_data(trace)[source]
pylablib.aux_libs.devices.ZurichInstruments.check_timestamps(trace)[source]
pylablib.aux_libs.devices.ZurichInstruments.check_all_timestamps(data)[source]
pylablib.aux_libs.devices.ZurichInstruments.get_timestamp_chunks(ts)[source]
pylablib.aux_libs.devices.ZurichInstruments.extract_largest_chunk(traces)[source]
pylablib.aux_libs.devices.ZurichInstruments.cut_to_largest_chunk(traces)[source]
pylablib.aux_libs.devices.ZurichInstruments.align_all_timestamps(data, max_length=None)[source]
pylablib.aux_libs.devices.ZurichInstruments.normalize_time(trace, normalization='full', clockbase=210000000.0)[source]
pylablib.aux_libs.devices.ZurichInstruments.filter_transfer_function(f, order, timeconst)[source]
pylablib.aux_libs.devices.ZurichInstruments.tc_to_bandwidth(tc, order)[source]
pylablib.aux_libs.devices.ZurichInstruments.bandwidth_to_tc(bandwidth, order)[source]
pylablib.aux_libs.devices.ZurichInstruments.filter_amplitude_kernel(t, order, timeconst)[source]
pylablib.aux_libs.devices.ZurichInstruments.filter_power_kernel(t, order, timeconst)[source]
pylablib.aux_libs.devices.ZurichInstruments.PSD_filter_compensate(PSD, order, timeconst)[source]
pylablib.aux_libs.devices.ZurichInstruments.FT_filter_compensate(ft, order, timeconst)[source]
pylablib.aux_libs.devices.ZurichInstruments.trace_filter_compensate(trace, order, timeconst, truncate=True)[source]
class pylablib.aux_libs.devices.ZurichInstruments.Demod(n, dev)[source]

Bases: object

filter_transfer_function(f)[source]
filter_amplitude_kernel(t)[source]
filter_power_kernel(t)[source]
PSD_filter_compensate(PSD, relative_frequency=True)[source]
If relative_frequency=True, frequencies are given relative to the demod frequency;
otherwise, they’re real frequencies of an input signal
FT_filter_compensate(ft, relative_frequency=True)[source]
trace_filter_compensate(trace, truncate=True)[source]
class pylablib.aux_libs.devices.ZurichInstruments.ZIDevice(dev_id=None, port=8005, api_level=1)[source]

Bases: object

Generic Zurich Instruments device.

close()[source]
get_parameter(path, argtype='float')[source]
set_parameter(path, value)[source]
get_default(path, argtype='float', default=None)[source]
classmethod filter_settings_dict(settings)[source]
get_branch(path='', rel_paths=True, raw=False)[source]
set_branch(branch, path='')[source]
get_settings(path='', rel_paths=True, raw=False)
apply_settings(branch, path='')
sync()[source]
flush()[source]
get_devtype()[source]
get_options()[source]
get_clockbase()[source]
normalize_time(trace, normalization='full')[source]
get_timestamp(subtract_ref_timestamp=True)[source]
update_ref_timestamp()[source]
get_demod_sample(demod, fmt='complex')[source]
get_demods_rates()[source]
get_demods_num()[source]
set_demod_rate(demod, rate)[source]
stop_demod(demod)[source]
get_demod_frequency(demod)[source]
set_demod_frequency(demod, freq)[source]
get_demod_power(demod, sigout, only_enabled=True)[source]
set_demod_power(demod, sigout, power_dBm=None, enable=True)[source]
read_demods(trace_length, demods=None, save_frequencies_for=None, buffer_size=None, sanitize_data=True, consistent_length=False)[source]
get_demod(demod_idx)[source]
read_demod_pts(trace_pts, demod, poll_time=None, sanitize_data=True)[source]
repeat_read_demod_pts(trace_pts, demod, traces_num=1, poll_time=None)[source]
class DemodTraceAccumulator(rate, length, columns=3)[source]

Bases: object

add_piece(*traces)[source]
full()[source]
read_demods_poll(trace_length, demods=None, save_frequencies_for=None, sanitize_data=True, consistent_length=False)[source]
get_auxin_sample(channel, fmt='float')[source]
get_scope_trace_pts()[source]
set_scope_trace_pts(length)[source]
get_scope_source_idx(source)[source]
get_scope_source_range(source)[source]
get_scope_timestep_idx()[source]
get_scope_timestep(timestep_idx=None)[source]
get_scope_time_points(length=None)[source]
setup_trigger(channel='continuous', edge='rising', level=0.0, delay=0.0, holdoff=0.0)[source]
setup_scope(timestep_idx=None, source='sigin0', trace_pts=None, bw_limit=True)[source]
read_scope_poll(traces=1, poll_time=None, add_time=False, timeout='auto', fast_flush=False)[source]
read_scope(timestep_idx=None, source='sigin0', traces=1, trace_pts=None, poll_time=None, add_time=False, bw_limit=True, timeout='auto')[source]
class pylablib.aux_libs.devices.ZurichInstruments.HF2Device(dev_id=None, port=8005)[source]

Bases: pylablib.aux_libs.devices.ZurichInstruments.ZIDevice

Zurich Instruments HF2 device.

get_clockbase()[source]
get_demods_rates()[source]
set_demod_rate(demod, rate)[source]
get_scope_trace_pts()[source]
set_scope_trace_pts(length)[source]
get_scope_source()[source]
setup_trigger(channel='continuous', edge='rising', level=0.0, delay=0.0, holdoff=0.0)[source]
setup_scope(timestep_idx=None, source='sigin0', trace_pts=None, bw_limit=True)[source]
read_scope_poll(traces=1, poll_time=None, add_time=False, timeout='auto', fast_flush=True)[source]
class pylablib.aux_libs.devices.ZurichInstruments.UHFDevice(dev_id=None, port=8004)[source]

Bases: pylablib.aux_libs.devices.ZurichInstruments.ZIDevice

Zurich Instruments UHF device.

get_demods_rates()[source]
set_demod_rate(demod, rate)[source]
get_scope_source_idx(source)[source]
get_scope_source_range(source)[source]
get_scope_source()[source]
setup_trigger(channel='continuous', edge='rising', level=0.0, delay=0.0, holdoff=0.0)[source]
setup_scope(timestep_idx=None, source='sigin0', trace_pts=None, bw_limit=True)[source]
read_scope_poll(traces=1, poll_time=None, add_time=False, timeout='auto', fast_flush=False, stop_after=True)[source]
read_demods_with_scope(trace_length, demods=None)[source]
class pylablib.aux_libs.devices.ZurichInstruments.ZISweeper(dev, settings=None)[source]

Bases: object

Sweeper interface for Zurich Instruments devices.

is_set()[source]
setup(sweep_range, oscillator, demods, settings=None)[source]
frequency_points()[source]
get_max_tc()[source]
get_tc(variable_tc=False)[source]
execute(result_format=('c', 'comb'), method='zi')[source]
execute_manual(result_format=('c', 'comb'))[source]
execute_zi(result_format=('c', 'comb'), poll_time=0.1)[source]

pylablib.aux_libs.devices.device_manager module

class pylablib.aux_libs.devices.device_manager.DeviceManager(path=None)[source]

Bases: object

add_device(name, dev_cls, addr)[source]
add_from_file(path)[source]
get_device(name, reopen=False)[source]

pylablib.aux_libs.devices.interfaces module

class pylablib.aux_libs.devices.interfaces.ITranslationStage[source]

Bases: pylablib.core.devio.interface.IDevice

pylablib.aux_libs.devices.misc module

pylablib.aux_libs.devices.misc.get_default_lib_folder(absolute=True)[source]

Get default DLL folder withing the package, depending on the Python bitness

If absolute==True, get absolute path (including pyLabLib folder); otherwise, get subfolder within pyLabLib folder.

pylablib.aux_libs.devices.misc.get_os_lib_folder()[source]

Get default Windows DLL folder (System32 or SysWOW64, depending on Python and Windows bitness)

pylablib.aux_libs.devices.misc.load_lib(name, locations=('global', ), call_conv='cdecl', locally=False, error_message=None, check_order='location')[source]

Load DLL.

Parameters:
  • name – name or path of the library (can also be a list or a tuple with several names, which are tried in that order).
  • locations – list or tuple of locations to search for a library; the function tries locations in order and returns the first successfully loaded library a location is a string which can be a path to the containing folder, "local" (local package path given by get_default_lib_folder()), or "global" (load path as is; also searches in the standard OS specified locations determined by PATH variable, e.g., System32 folder)
  • locally (bool) – if True, change local path to allow loading of dependent DLLs
  • call_conv (str) – DLL call convention; can be either "cdecl" (corresponds to ctypes.cdll) or "stdcall" (corresponds to ctypes.windll)
  • error_message (str) – error message to add in addition to the default error message shown when the DLL is not found
  • check_order (str) – determines the order in which possible combinations of names and locations are looped over; can be "location" (loop over locations, and for each location loop over names), "name" (loop over names, and for each name loop over locations), or a list of tuples [(loc,name)] specifying order of checking (in the latter case, name and location arguments are ignored, except for generating error mesage).

pylablib.aux_libs.devices.pfcam_lib module

Used by autodoc_mock_imports.

Module contents