ps5000a Reference

Initializing ps5000a

import pypicosdk as psdk

scope = psdk.ps5000a()

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

Reference

Bases: PicoScopeBase

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_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

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.

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