ps6000a Reference

Initializing ps6000a

import pypicosdk as psdk

scope = psdk.ps6000a()

scope.open_unit()
# Do something
scope.close_unit()

Reference

Bases: PicoScopeBase

PicoScope 6000 (A) API specific functions

Methods:

Name Description
close_unit

Closes the PicoScope device and releases the hardware handle.

get_enumerated_units

Returns count, serials and serial string length of a specific PicoScope unit.

get_nearest_sampling_interval

This function returns the nearest possible sample interval to the requested

get_time_axis

Return an array of time values based on the timebase and number

get_timebase

This function calculates the sampling rate and maximum number of

get_unit_info

Get specified information from unit. Use UNIT_INFO.XXXX or integer.

get_unit_serial

Get and return batch and serial of unit.

get_values

Retrieves a block of captured samples from the device once it's ready.

is_over_range

Logs and prints a warning if any channel has been over range.

is_ready

Blocks execution until the PicoScope device is ready.

open_unit

Open PicoScope unit.

run_block_capture

Runs a block capture using the specified timebase and number of samples.

run_simple_block_capture

Performs a complete single block capture using current channel and trigger configuration.

set_channel

Enable/disable a channel and specify certain variables i.e. range, coupling, offset, etc.

set_data_buffer

Tells the driver where to store the data that will be populated when get_values() is called.

set_data_buffer_for_enabled_channels

Sets data buffers for enabled channels set by picosdk.set_channel()

set_siggen

Configures and applies the signal generator settings.

set_simple_trigger

Sets up a simple trigger from a specified channel and threshold in mV

stop

This function stops the scope device from sampling data

close_unit()

Closes the PicoScope device and releases the hardware handle.

This calls the PicoSDK CloseUnit function to properly disconnect from the device.

Returns:
  • None

    None

get_enumerated_units()

Returns count, serials and serial string length of a specific PicoScope unit.

Returns:
  • int

    Number of devices of this type

  • str

    Comma separated string of all serials

  • int

    Length of string

get_nearest_sampling_interval(interval_s)

This function returns the nearest possible sample interval to the requested sample interval. It does not change the configuration of the oscilloscope.

Channels need to be setup first before calculating as more channels may increase sample interval.

Parameters:
  • interval_s (float) –

    Time value in seconds (s) you would like to obtain.

Returns:
  • dict( dict ) –

    Dictionary of suggested timebase and actual sample interval in seconds (s).

get_time_axis(timebase, samples)

Return an array of time values based on the timebase and number of samples

Parameters:
  • timebase (int) –

    PicoScope timebase

  • samples (int) –

    Number of samples captured

Returns:
  • list( list ) –

    List of time values in nano-seconds

get_timebase(timebase, samples, segment=0)

This function calculates the sampling rate and maximum number of samples for a given timebase under the specified conditions.

Parameters:
  • timebase (int) –

    Selected timebase multiplier (refer to programmer's guide).

  • samples (int) –

    Number of samples.

  • segment (int, default: 0 ) –

    The index of the memory segment to use.

Returns:
  • dict( None ) –

    Returns interval (ns) and max samples as a dictionary.

get_unit_info(unit_info)

Get specified information from unit. Use UNIT_INFO.XXXX or integer.

Parameters:
  • unit_info (UNIT_INFO) –

    Specify information from PicoScope unit i.e. UNIT_INFO.PICO_BATCH_AND_SERIAL.

Returns:
  • str( str ) –

    Returns data from device.

get_unit_serial()

Get and return batch and serial of unit.

Returns:
  • str( str ) –

    Returns serial, e.g., "JR628/0017".

get_values(samples, start_index=0, segment=0, ratio=0, ratio_mode=RATIO_MODE.RAW)

Retrieves a block of captured samples from the device once it's ready. If a channel goes over-range a warning will appear.

This function should be called after confirming the device is ready using is_ready(). It invokes the underlying PicoSDK GetValues function to read the data into memory.

Parameters:
  • samples (int) –

    Number of samples to retrieve.

  • start_index (int, default: 0 ) –

    Starting index in the buffer.

  • segment (int, default: 0 ) –

    Memory segment index to retrieve data from.

  • ratio (int, default: 0 ) –

    Downsampling ratio.

  • ratio_mode (RATIO_MODE, default: RAW ) –

    Ratio mode for downsampling.

Returns:
  • int( int ) –

    Actual number of samples retrieved.

is_over_range()

Logs and prints a warning if any channel has been over range.

Returns:
  • list( list ) –

    List of channels that have been over range

is_ready()

Blocks execution until the PicoScope device is ready.

Continuously calls the PicoSDK IsReady function in a loop, checking if the device is prepared to proceed with data acquisition.

Returns:
  • None

    None

open_unit(serial_number=None, resolution=0)

Open PicoScope unit.

Parameters:
  • serial_number (str, default: None ) –

    Serial number of device.

  • resolution (RESOLUTION, default: 0 ) –

    Resolution of device.

run_block_capture(timebase, samples, pre_trig_percent=50, segment=0)

Runs a block capture using the specified timebase and number of samples.

This sets up the PicoScope to begin collecting a block of data, divided into pre-trigger and post-trigger samples. It uses the PicoSDK RunBlock function.

Parameters:
  • timebase (int) –

    Timebase value determining sample interval (refer to PicoSDK guide).

  • samples (int) –

    Total number of samples to capture.

  • pre_trig_percent (int, default: 50 ) –

    Percentage of samples to capture before the trigger.

  • segment (int, default: 0 ) –

    Memory segment index to use.

Returns:
  • int( int ) –

    Estimated time (in milliseconds) the device will be busy capturing data.

run_simple_block_capture(timebase, samples, segment=0, start_index=0, datatype=DATA_TYPE.INT16_T, ratio=0, ratio_mode=RATIO_MODE.RAW, pre_trig_percent=50)

Performs a complete single block capture using current channel and trigger configuration.

This function sets up data buffers for all enabled channels, starts a block capture, and retrieves the values once the device is ready. It is a simplified interface for common block capture use cases.

Parameters:
  • timebase (int) –

    Timebase value determining the sample interval (refer to PicoSDK guide).

  • samples (int) –

    Total number of samples to capture.

  • segment (int, default: 0 ) –

    Memory segment index to use.

  • start_index (int, default: 0 ) –

    Starting index in the buffer.

  • datatype (DATA_TYPE, default: INT16_T ) –

    Data type to use for the capture buffer.

  • ratio (int, default: 0 ) –

    Downsampling ratio.

  • ratio_mode (RATIO_MODE, default: RAW ) –

    Downsampling mode.

  • pre_trig_percent (int, default: 50 ) –

    Percentage of samples to capture before the trigger.

Returns:
  • dict( dict ) –

    A dictionary mapping each enabled channel to its corresponding data buffer.

  • list( list ) –

    Time axis (x-axis) list of timestamps for the sample data

Examples:

>>> scope.set_channel(CHANNEL.A, RANGE.V1)
>>> scope.set_simple_trigger(CHANNEL.A, threshold_mv=500)
>>> buffers = scope.run_simple_block_capture(timebase=3, samples=1000)

set_channel(channel, range, enabled=True, coupling=COUPLING.DC, offset=0.0, bandwidth=BANDWIDTH_CH.FULL)

Enable/disable a channel and specify certain variables i.e. range, coupling, offset, etc.

For the ps6000a drivers, this combines _set_channel_on/off to a single function. Set channel on/off by adding enabled=True/False

Parameters:
  • channel (CHANNEL) –

    Channel to setup.

  • range (RANGE) –

    Voltage range of channel.

  • enabled (bool, default: True ) –

    Enable or disable channel.

  • coupling (COUPLING, default: DC ) –

    AC/DC/DC 50 Ohm coupling of selected channel.

  • offset (int, default: 0.0 ) –

    Analog offset in volts (V) of selected channel.

  • bandwidth (BANDWIDTH_CH, default: FULL ) –

    Bandwidth of channel (selected models).

set_data_buffer(channel, samples, segment=0, datatype=DATA_TYPE.INT16_T, ratio_mode=RATIO_MODE.RAW, action=ACTION.CLEAR_ALL | ACTION.ADD)

Tells the driver where to store the data that will be populated when get_values() is called. This function works on a single buffer. For aggregation mode, call set_data_buffers instead.

Parameters:
  • channel (CHANNEL) –

    Channel you want to use with the buffer.

  • samples (int) –

    Number of samples/length of the buffer.

  • segment (int, default: 0 ) –

    Location of the buffer.

  • datatype (DATATYPE, default: INT16_T ) –

    C datatype of the data.

  • ratio_mode (RATIO_MODE, default: RAW ) –

    Down-sampling mode.

  • action (ACTION, default: CLEAR_ALL | ADD ) –

    Method to use when creating a buffer.

Returns:
  • Array

    ctypes.Array: Array that will be populated when get_values() is called.

set_data_buffer_for_enabled_channels(samples, segment=0, datatype=DATA_TYPE.INT16_T, ratio_mode=RATIO_MODE.RAW)

Sets data buffers for enabled channels set by picosdk.set_channel()

Parameters:
  • samples (int) –

    The sample buffer or size to allocate.

  • segment (int, default: 0 ) –

    The memory segment index.

  • datatype (DATA_TYPE, default: INT16_T ) –

    The data type used for the buffer.

  • ratio_mode (RATIO_MODE, default: RAW ) –

    The ratio mode (e.g., RAW, AVERAGE).

Returns:
  • dict( dict ) –

    A dictionary mapping each channel to its associated data buffer.

set_siggen(frequency, pk2pk, wave_type, offset=0.0, duty=50)

Configures and applies the signal generator settings.

Sets up the signal generator with the specified waveform type, frequency, amplitude (peak-to-peak), offset, and duty cycle.

Parameters:
  • frequency (float) –

    Signal frequency in hertz (Hz).

  • pk2pk (float) –

    Peak-to-peak voltage in volts (V).

  • wave_type (WAVEFORM) –

    Waveform type (e.g., WAVEFORM.SINE, WAVEFORM.SQUARE).

  • offset (float, default: 0.0 ) –

    Voltage offset in volts (V).

  • duty (int or float, default: 50 ) –

    Duty cycle as a percentage (0–100).

Returns:
  • dict( dict ) –

    Returns dictionary of the actual achieved values.

set_simple_trigger(channel, threshold_mv, enable=True, direction=TRIGGER_DIR.RISING, delay=0, auto_trigger_ms=5000)

Sets up a simple trigger from a specified channel and threshold in mV

Parameters:
  • channel (int) –

    The input channel to apply the trigger to.

  • threshold_mv (float) –

    Trigger threshold level in millivolts.

  • enable (bool, default: True ) –

    Enables or disables the trigger.

  • direction (TRIGGER_DIR, default: RISING ) –

    Trigger direction (e.g., TRIGGER_DIR.RISING, TRIGGER_DIR.FALLING).

  • delay (int, default: 0 ) –

    Delay in samples after the trigger condition is met before starting capture.

  • auto_trigger_ms (int, default: 5000 ) –

    Timeout in milliseconds after which data capture proceeds even if no trigger occurs.

stop()

This function stops the scope device from sampling data