msl.equipment.resources.picotech.picoscope.picoscope module

Base class for a PicoScope from Pico Technology.

msl.equipment.resources.picotech.picoscope.picoscope.enumerate_units()[source]

Find the PicoScopes that are connected to the computer.

This function counts the number of PicoScopes connected to the computer, and returns a list of serial numbers as a string.

Note

You cannot call this function after you have opened a connection to a PicoScope.

Returns

list of str – A list of serial numbers of the PicoScopes that were found.

class msl.equipment.resources.picotech.picoscope.picoscope.PicoScope(record, func_ptrs)[source]

Bases: ConnectionSDK

Use the PicoScope SDK to communicate with the oscilloscope.

The properties for a PicoScope connection supports the following key-value pairs in the Connections Database:

'open': bool, Whether to open the connection synchronously [default: True]
'open_async': bool, Whether to open the connection asynchronously [default: False]
'auto_select_power': bool, For devices that can be powered by an AC adaptor or a USB cable [default: True]
'resolution': str, Only valid for ps5000a [default: '8bit']

The SDK version that was initially used to create this base class and the PicoScope subclasses was Pico Technology SDK 64-bit v10.6.10.24

Do not instantiate this class directly. Use the connect() method to connect to the equipment.

Parameters
property handle

Returns the handle to the SDK library.

Type

int

property channel

The information about each channel.

Type

dict of PicoScopeChannel

property dt

The time between voltage samples (i.e., delta t).

Type

float

property pre_trigger

The number of seconds that data was acquired for before the trigger event.

Type

float

close_unit()[source]

Disconnect from the PicoScope.

disconnect()[source]

Disconnect from the PicoScope.

get_unit_info(info=None, include_name=True)[source]

Retrieves information about the PicoScope.

This function retrieves information about the specified oscilloscope. If the device fails to open, or no device is opened only the driver version is available.

Parameters
  • info (PicoScopeInfoApi, PS2000Info or PS3000Info, optional) – An enum value, or if None then request all information from the PicoScope. The enum depends on the model number of the PicoScope that you are connected to.

  • include_name (bool, optional) – If True then includes the enum member name as a prefix. For example, returns 'CAL_DATE: 09Aug16' if include_name is True else '09Aug16'.

Returns

str – The requested information from the PicoScope.

is_ready()[source]

Has the PicoScope collecting the requested number of samples?

This function may be used instead of a callback function to receive data from run_block(). To use this method, pass None as the callback parameter in run_block(). You must then poll the driver to see if it has finished collecting the requested samples.

Returns

bool – Whether the PicoScope has collected the requested number of samples.

maximum_value()[source]

int: This function returns the maximum ADC count.

minimum_value()[source]

int: This function returns the minimum ADC count.

ping_unit()[source]

Ping the PicoScope.

This function can be used to check that the already opened device is still connected to the USB port and communication is successful.

run_block(pre_trigger=0.0, callback=None, segment_index=0)[source]

Start collecting data in block mode.

All input arguments are ignored for ps2000 and ps3000.

Parameters
  • pre_trigger (float, optional) – The number of seconds before the trigger event to start acquiring data.

  • segment_index (int, optional) – Specifies which memory segment to save the data to (see manual).

  • callback (BlockReady, optional) – A BlockReady callback function.

run_streaming(pre_trigger=0.0, auto_stop=True, factor=1, ratio_mode='NONE')[source]

Start collecting data in streaming mode.

This function tells the oscilloscope to start collecting data in streaming mode. When data has been collected from the device it is down sampled if necessary and then delivered to the application. Call get_streaming_latest_values() to retrieve the data.

When a trigger is set, the total number of samples stored in the driver is the sum of max_pre_trigger_samples and max_post_trigger_samples. If auto_stop is false then this will become the maximum number of samples without down sampling.

The ratio_mode argument is ignored for ps4000 and ps5000.

Parameters
  • pre_trigger (float, optional) – The number of seconds before the trigger event to start acquiring data.

  • auto_stop (bool, optional) – A flag that specifies if the streaming should stop when all of samples have been captured.

  • factor (int, optional) – The down-sampling factor that will be applied to the raw data.

  • ratio_mode (enum.IntEnum, optional) – Which down-sampling mode to use.

set_channel(channel, coupling='dc', scale='10V', offset=0.0, bandwidth='full', enabled=True)[source]

Configure a channel.

This function specifies whether an input channel is to be enabled, its input coupling type, voltage range, analog offset and bandwidth limit. Some of the arguments within this function have model-specific values. Please consult the manual according to the model you have.

The bandwidth argument is only used for ps6000.

The offset and bandwidth arguments are ignored for ps2000, ps3000, ps4000 and ps5000.

Parameters
  • channel (enum.IntEnum) – The channel to be configured

  • coupling (enum.IntEnum, optional) – The impedance and coupling type.

  • scale (enum.IntEnum, optional) – The input voltage range.

  • offset (float, optional) – A voltage to add to the input channel before digitization. The allowable range of offsets depends on the input range selected for the channel, as obtained from get_analogue_offset().

  • bandwidth (enum.IntEnum, optional) – The bandwidth limiter to use.

  • enabled (bool, optional) – Whether to enable the channel.

set_timebase(dt, duration, segment_index=0, oversample=0)[source]

Set the timebase information.

The segment_index is ignored for ps2000 and ps3000.

The oversample argument is ignored by ps2000a, ps3000a, ps4000a and ps5000a.

Parameters
  • dt (float) – The sampling interval, in seconds.

  • duration (float) – The number of seconds to acquire data for.

  • segment_index (int, optional) – Which memory segment to save the data to.

  • oversample (int, optional) – The amount of over-sample required.

Returns

  • float – The sampling interval, i.e. dt.

  • int – The number of samples that will be acquired.

Raises

PicoTechError – If the timebase or duration is invalid.

set_trigger(channel, threshold, delay=0.0, direction='rising', timeout=0.1, enable=True)[source]

Set up the trigger.

Parameters
  • channel (enum.IntEnum) – The trigger channel.

  • threshold (float) – The threshold voltage to signal a trigger event.

  • delay (float, optional) – The time, in seconds, between the trigger occurring and the first sample.

  • direction (enum.IntEnum, optional) – The direction in which the signal must move to cause a trigger.

  • timeout (float, optional) – The time, in seconds, to wait to automatically create a trigger event if no trigger event occurs. If timeout <= 0 then wait indefinitely for a trigger. Only accurate to the nearest millisecond.

  • enable (bool, optional) – Set to False to disable the trigger for this channel. Not used for ps2000 or ps3000.

stop()[source]

Stop the oscilloscope from sampling data.

If this function is called before a trigger event occurs, then the oscilloscope may not contain valid data.

wait_until_ready()[source]

Blocking function to wait for the scope to finish acquiring data.

set_pulse_width_qualifier(conditions, direction, lower, upper, pulse_width_type)[source]

This function sets up pulse width qualification, which can be used on its own for pulse width triggering or combined with other triggering to produce more complex triggers. The pulse width qualifier is set by defining a list of PwqConditions structures, which are found in the structs module.