Streaming

Streaming in a PicoScope is a great tool for monitoring a waveform for a long period of time without the delay between block captures. Though this method of capture is fairly limited in sample rate and usability in comparison to a block capture and especially rapid block capture.

Using Streaming in pyPicoSDK

Streaming is implemented in this package as a class to take advantage of the benefits offered by an object-oriented approach. For a quick start-up use the example code and alter it to your application.

Methods & Functions

Below are the included public methods for streaming:

Streaming Scope class

Methods:

Name Description
config_streaming

Configures the streaming settings for data acquisition. This method

get_streaming_values

Main loop for handling streaming data acquisition.

run_streaming

Initiates the data streaming process.

start_streaming_while

Starts and continuously runs the streaming acquisition loop until

stop

Signals the streaming loop to stop.

config_streaming(channel, samples, interval, time_units, pre_trig_samples=0, post_trig_samples=250, ratio=0, ratio_mode=RATIO_MODE.RAW, data_type=DATA_TYPE.INT16_T)

Configures the streaming settings for data acquisition. This method sets up the channel, sample counts, timing intervals, and buffer management for streaming data from the device.

Parameters:
  • channel (CHANNEL) –

    The channel to stream data from.

  • samples (int) –

    The number of samples to acquire in each streaming segment.

  • interval (int) –

    The time interval between samples.

  • time_units (str | TIME_UNIT) –

    Units for the sample interval (e.g., 'ms' or TIME_UNIT.MS).

  • pre_trig_samples (int, default: 0 ) –

    Number of samples to capture before a trigger event. Defaults to 0.

  • post_trig_samples (int, default: 250 ) –

    Number of samples to capture after a trigger event. Defaults to 250.

  • ratio (int, default: 0 ) –

    Downsampling ratio to apply to the captured data. Defaults to 0 (no downsampling).

  • ratio_mode (RATIO_MODE, default: RAW ) –

    Mode used for applying the downsampling ratio. Defaults to RATIO_MODE.RAW.

  • data_type (DATA_TYPE, default: INT16_T ) –

    Data type for the samples in the buffer. Defaults to DATA_TYPE.INT16_T.

Returns:
  • None

    None

get_streaming_values()

Main loop for handling streaming data acquisition.

This method retrieves the latest streaming data from the device, appends new samples to the internal buffer array, and manages buffer rollover when the hardware buffer becomes full.

The method ensures that the internal buffer (self.buffer_array) always contains the most recent samples up to max_buffer_size. It also handles alternating between buffer segments when a buffer overflow condition is detected.

run_streaming()

Initiates the data streaming process.

This method prepares the device for streaming by clearing existing data buffers, setting up a new data buffer for the selected channel, and starting the streaming process with the configured parameters such as sample interval, trigger settings, and downsampling options.

The method resets internal buffer indices and flags to prepare for incoming data.

start_streaming_while()

Starts and continuously runs the streaming acquisition loop until StreamingScope.stop() is called.

stop()

Signals the streaming loop to stop.