Data Retrieval

Bases: PicoScopeBase, shared_ps6000a_psospa

PicoScope OSP (A) API specific functions

Methods:

Name Description
get_scaling_values

Return probe scaling factors for each channel.

get_time_axis

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

get_values

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

get_values_bulk

Retrieve data from multiple memory segments.

get_values_bulk_async

Begin asynchronous retrieval of values from multiple segments.

get_values_overlapped

Retrieve overlapped data from multiple segments for block or rapid block mode.

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.

no_of_streaming_values

Return the number of values currently available while streaming.

stop_using_get_values_overlapped

Terminate overlapped capture mode.

get_scaling_values(n_channels=8)

Return probe scaling factors for each channel. Args: n_channels: Number of channel entries to retrieve. Returns: list[PICO_SCALING_FACTORS_VALUES]: Scaling factors for n_channels channels.

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

get_values_bulk(start_index, no_of_samples, from_segment_index, to_segment_index, down_sample_ratio, down_sample_ratio_mode)

Retrieve data from multiple memory segments.

Parameters:
  • start_index (int) –

    Index within each segment to begin copying from.

  • no_of_samples (int) –

    Total number of samples to read from each segment.

  • from_segment_index (int) –

    Index of the first segment to read.

  • to_segment_index (int) –

    Index of the last segment. If this value is less than from_segment_index the driver wraps around.

  • down_sample_ratio (int) –

    Downsampling ratio to apply before copying.

  • down_sample_ratio_mode (int) –

    Downsampling mode from :class:RATIO_MODE.

Returns:
  • int

    tuple[int, int]: (samples, overflow) where samples is the

  • int

    number of samples copied and overflow is a bit mask of any

  • int

    channels that exceeded their input range.

get_values_bulk_async(start_index, no_of_samples, from_segment_index, to_segment_index, down_sample_ratio, down_sample_ratio_mode, lp_data_ready, p_parameter)

Begin asynchronous retrieval of values from multiple segments.

Parameters:
  • start_index (int) –

    Index within each segment to begin copying from.

  • no_of_samples (int) –

    Number of samples to read from each segment.

  • from_segment_index (int) –

    Index of the first segment to read.

  • to_segment_index (int) –

    Index of the last segment in the range.

  • down_sample_ratio (int) –

    Downsampling ratio to apply before copying.

  • down_sample_ratio_mode (int) –

    Downsampling mode from :class:RATIO_MODE.

  • lp_data_ready (POINTER) –

    Callback invoked when data is available. The callback signature should be callback(handle, status, n_samples, overflow).

  • p_parameter (POINTER) –

    User parameter passed through to lp_data_ready.

get_values_overlapped(start_index, no_of_samples, down_sample_ratio, down_sample_ratio_mode, from_segment_index, to_segment_index, overflow)

Retrieve overlapped data from multiple segments for block or rapid block mode.

Call this method before :meth:run_block_capture to defer the data retrieval request. The driver validates and performs the request when :meth:run_block_capture runs, which avoids the extra communication that occurs when calling :meth:run_block_capture followed by :meth:get_values. After the capture completes you can call :meth:get_values again to retrieve additional copies of the data. Stop further captures with :meth:stop_using_get_values_overlapped and check progress using :meth:ps6000a.PicoScope.get_no_of_processed_captures.

Parameters:
  • start_index (int) –

    Index within the circular buffer to begin reading from.

  • no_of_samples (int) –

    Number of samples to copy from each segment.

  • down_sample_ratio (int) –

    Downsampling ratio to apply.

  • down_sample_ratio_mode (int) –

    Downsampling mode from :class:RATIO_MODE.

  • from_segment_index (int) –

    First segment index to read.

  • to_segment_index (int) –

    Last segment index to read.

  • overflow (c_int16) –

    ctypes.c_int16 instance that receives any overflow flags.

Returns:
  • int( int ) –

    Actual number of samples copied from each segment.

Examples:

>>> samples = scope.get_values_overlapped(
...     start_index=0,              # read from start of buffer
...     no_of_samples=1024,         # copy 1024 samples
...     down_sample_ratio=1,        # no downsampling
...     down_sample_ratio_mode=RATIO_MODE.RAW,
...     from_segment_index=0,       # first segment only
...     to_segment_index=0,
... )
>>> scope.run_block_capture(timebase=1, samples=1024)
>>> data = scope.get_values(samples=1024)
>>> samples, scope.over_range
(1024, 0)

is_over_range()

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

The :attr:over_range attribute stores a bit mask updated by data retrieval methods like :meth:get_values and :meth:get_values_overlapped. Calling this method logs a warning if any channel went over range and returns a list of the affected channel names.

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

no_of_streaming_values()

Return the number of values currently available while streaming.

stop_using_get_values_overlapped()

Terminate overlapped capture mode.

Call this when overlapped captures are complete to release any resources allocated by :meth:get_values_overlapped.