PicoScope conversions

These functions are general functions to convert data to another format. This is particularly useful for converting ADC data to mV or calculating the needed timebase for your PicoScope.

As the conversions talk to the PicoScope to retrieve the resolution and ADC limits, the PicoScope needs to be initialized using scope.open_unit() followed by the conversion.

Example

>>> import pypicosdk as psdk
>>> scope = psdk.ps6000a()
>>> scope.open_unit(resolution=psdk.RESOLUTION._8BIT)
>>> scope.mv_to_adc(100, channel_range=psdk.RANGE.V1)
3251
>>> scope.close_unit()

Reference

PicoScope base class including common SDK and python modules and functions

Methods:

Name Description
adc_to_mv

Converts ADC value to mV - based on maximum ADC value

buffer_adc_to_mv

Converts an ADC buffer list to mV list

buffer_ctypes_to_list

Converts a ctype dataset into a python list of samples

channels_buffer_adc_to_mv

Converts dict of multiple channels adc values to millivolts (mV)

channels_buffer_ctype_to_list

Takes a ctypes channel dictionary buffer and converts into a integer array.

interval_to_timebase

Converts a time interval (between samples) into a PicoScope timebase

mv_to_adc

Converts a millivolt (mV) value to an ADC value based on the device's

sample_rate_to_timebase

Converts sample rate to a PicoScope timebase value based on the

adc_to_mv(adc, channel_range)

Converts ADC value to mV - based on maximum ADC value

buffer_adc_to_mv(buffer, channel)

Converts an ADC buffer list to mV list

buffer_ctypes_to_list(ctypes_list)

Converts a ctype dataset into a python list of samples

channels_buffer_adc_to_mv(channels_buffer)

Converts dict of multiple channels adc values to millivolts (mV)

channels_buffer_ctype_to_list(channels_buffer)

Takes a ctypes channel dictionary buffer and converts into a integer array.

interval_to_timebase(interval, unit=TIME_UNIT.S)

Converts a time interval (between samples) into a PicoScope timebase value based on the attached PicoScope.

This function will return the closest possible timebase. Use get_nearest_sample_interval(interval_s) to get the full timebase and actual interval achieved.

Parameters:
  • interval (float) –

    Desired time interval between samples

  • unit (TIME_UNIT, default: S ) –

    Time unit of interval.

mv_to_adc(mv, channel_range)

Converts a millivolt (mV) value to an ADC value based on the device's maximum ADC range.

Parameters:
  • mv (float) –

    Voltage in millivolts to be converted.

  • channel_range (int) –

    Range of channel in millivolts i.e. 500 mV.

Returns:
  • int( int ) –

    ADC value corresponding to the input millivolt value.

sample_rate_to_timebase(sample_rate, unit=SAMPLE_RATE.MSPS)

Converts sample rate to a PicoScope timebase value based on the attached PicoScope.

This function will return the closest possible timebase. Use get_nearest_sample_interval(interval_s) to get the full timebase and actual interval achieved.

Parameters:
  • sample_rate (int) –

    Desired sample rate

  • unit (SAMPLE_RATE, default: MSPS ) –

    unit of sample rate.