Subsystems - ds2000

Acquire Subsystem - acquire.py

class ds2000.acquire.Acquire(device)

Bases: ds2000.common.BaseController

AVERAGES: Tuple[int] = (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
MEMDEPTH_DUAL: Tuple[int] = (7000, 70000, 700000, 7000000, 28000000)
MEMDEPTH_SINGLE: Tuple[int] = (14000, 140000, 1400000, 14000000, 56000000)
get_antialiasing()

Rigol Programming Guide

Syntax

:ACQuire:AALias <bool>

:ACQuire:AALias?

Description

Enable or disable the antialiasing function of the oscilloscope. The query returns the current state of the antialiasing function of the oscilloscope.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:ACQuire:AALias ON

The query returns 1.

Return type

bool

get_averages()

Rigol Programming Guide

Syntax

:ACQuire:AVERages <count>

:ACQuire:AVERages?

Description

Set the number of averages and the value should be a power function of 2. Query the current number of averages of the oscilloscope.

Parameter

Name

Type

Range

Default

<count>

Integer

2 to 8192

2

Explanation

Use the :ACQuire:TYPE command to select the average acquisition mode. In this mode, the oscilloscope averages the waveforms from multiple samples to reduce the random noise of the input signal and improve the vertical resolution. The greater the number of averages is, the lower the noise will be and the higher the vertical resolution will be but the slower the response of the displayed waveform to the waveform changes will be.

Return Format

The query returns an integer between 2 and 8192.

Example

:ACQuire:AVERages 128

The query returns 128.

Return type

int

get_memorydepth()

Rigol Programming Guide

Syntax

:ACQuire:MDEPth <mdep>

:ACQuire:MDEPth?

Description

Set the memory depth of the oscilloscope namely the number of waveform points that can be stored in a single trigger sample. Query the current memory depth of the oscilloscope.

Parameter

Name

Type

Range

Default

<mdep>

Discrete

Refer to Explanation

AUTO

Explanation

When a single channel is on: <mdep> can be set to AUTO|14000|140000|1400000|14000000|56000000.

When dual channels are on: <mdep> can be set to AUTO|7000|70000|700000|7000000|28000000.

Return Format

The query returns the actual number of points (integer) or AUTO.

Example

:ACQuire:MDEPth 1400000

The query returns 1400000.

Return type

int

get_samplerate()

Rigol Programming Guide

Syntax

:ACQuire:SRATe?

Description

Query the current sample rate.

Return Format

The query returns the sample rate in scientific notation.

Example

:ACQuire:SRATe?

The query returns 2.000000e+09.

Return type

int

set_antialiasing(enabled=False)

Rigol Programming Guide

Syntax

:ACQuire:AALias <bool>

:ACQuire:AALias?

Description

Enable or disable the antialiasing function of the oscilloscope. The query returns the current state of the antialiasing function of the oscilloscope.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:ACQuire:AALias ON

The query returns 1.

set_averages(count=2)

Rigol Programming Guide

Syntax

:ACQuire:AVERages <count>

:ACQuire:AVERages?

Description Set the number of averages and the value should be a power function of 2. Query the current number of averages of the oscilloscope.

Parameter

Name

Type

Range

Default

<count>

Integer

2 to 8192

2

Explanation

Use the :ACQuire:TYPE command to select the average acquisition mode. In this mode, the oscilloscope averages the waveforms from multiple samples to reduce the random noise of the input signal and improve the vertical resolution. The greater the number of averages is, the lower the noise will be and the higher the vertical resolution will be but the slower the response of the displayed waveform to the waveform changes will be.

Return Format

The query returns an integer between 2 and 8192.

Example

:ACQuire:AVERages 128

The query returns 128.

set_memorydepth(memdepth=0)

Rigol Programming Guide

Syntax

:ACQuire:MDEPth <mdep>

:ACQuire:MDEPth?

Description

Set the memory depth of the oscilloscope namely the number of waveform points that can be stored in a single trigger sample. Query the current memory depth of the oscilloscope.

Parameter

Name

Type

Range

Default

<mdep>

Discrete

Refer to Explanation

AUTO

Explanation

When a single channel is on:

<mdep> can be set to AUTO|14000|140000|1400000|14000000|56000000.

When dual channels are on:

<mdep> can be set to AUTO|7000|70000|700000|7000000|28000000.

Return Format

The query returns the actual number of points (integer) or AUTO.

Example

:ACQuire:MDEPth 1400000

The query returns 1400000.

class ds2000.acquire.AcquireType(type, average_count)

Bases: NamedTuple

average_count: int

Alias for field number 1

type: str

Alias for field number 0

class ds2000.acquire.Type(subdevice)

Bases: ds2000.common.SubController

average()

Rigol Programming Guide

Syntax

:ACQuire:TYPE <type> :ACQuire:TYPE?

Description

Set the acquisition mode of the sample. Query the current acquisition mode of the sample.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|AVERages|PEAK|HRESolution}

NORMal

Explanation

When AVERages is selected, use the :ACQuire:AVERages command to set the number of averages.

Return Format

The query returns NORM, AVER, PEAK or HRES.

Example

:ACQuire:TYPE AVERages

The query returns AVER.

Return type

None

highres()

Rigol Programming Guide

Syntax

:ACQuire:TYPE <type>

:ACQuire:TYPE?

Description

Set the acquisition mode of the sample. Query the current acquisition mode of the sample.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|AVERages|PEAK|HRESolution}

NORMal

Explanation

When AVERages is selected, use the :ACQuire:AVERages command to set the number of averages.

Return Format

The query returns NORM, AVER, PEAK or HRES.

Example

:ACQuire:TYPE AVERages

The query returns AVER.

Return type

None

normal()

Rigol Programming Guide

Syntax

:ACQuire:TYPE <type>

:ACQuire:TYPE?

Description

Set the acquisition mode of the sample. Query the current acquisition mode of the sample.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|AVERages|PEAK|HRESolution}

NORMal

Explanation

When AVERages is selected, use the :ACQuire:AVERages command to set the number of averages.

Return Format The query returns NORM, AVER, PEAK or HRES.

Example

:ACQuire:TYPE AVERages

The query returns AVER.

Return type

None

peakdetect()

Rigol Programming Guide

Syntax

:ACQuire:TYPE <type>

:ACQuire:TYPE?

Description

Set the acquisition mode of the sample. Query the current acquisition mode of the sample.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|AVERages|PEAK|HRESolution}

NORMal

Explanation

When AVERages is selected, use the :ACQuire:AVERages command to set the number of averages.

Return Format

The query returns NORM, AVER, PEAK or HRES.

Example

:ACQuire:TYPE AVERages

The query returns AVER.

Return type

None

status()

Channel Subsystem - channel.py

class ds2000.channel.Channel(device, channel)

Bases: ds2000.common.BaseController

OFFSET_RANGES: Tuple[ds2000.channel.ChannelOffsetRange, ] = (ChannelOffsetRange(min_scl=0.0005, max_scl=0.05, off=2), ChannelOffsetRange(min_scl=0.051, max_scl=0.2, off=10), ChannelOffsetRange(min_scl=0.205, max_scl=2, off=50), ChannelOffsetRange(min_scl=2.05, max_scl=10, off=100))
PROBE_ATTENUATION_RATIOS: Tuple[float, ] = (0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 1.0, 10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 1000.0)
get_fine_adjust()

Rigol Programming Guide

Syntax

:CHANnel<n>:VERNier <bool> :CHANnel<n>:VERNier?

Description

Enable or disable the fine adjustment function of the vertical scale of CH1 or CH2. Query the current status of the fine adjustment function of the vertical scale of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<bool>

Bool

{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:CHANnel1:VERNier ON The query returns 1.

Return type

bool

get_invert()

Rigol Programming Guide

Syntax

:CHANnel<n>:INVert <bool> :CHANnel<n>:INVert?

Description

Enable or disable the inverted display of CH1 or CH2. Query the current status of the inverted display of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:CHANnel1:INVert ON The query returns 1.

Return type

bool

get_offset()
Offset
  • Set to None to get the default value. (Default)

  • Enter a floating point value to set the offset by yourselt.

Rigol Programming Guide

Syntax

:CHANnel<n>:OFFSet <offset> :CHANnel<n>:OFFSet?

Description

Set the vertical offset of the waveform of CH1 or CH2. Query the current vertical offset of the waveform of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<offset>

Real

500μV/div to 50mV/div: ± 2V 51mV/div to 200mV/div: ± 10V 205mV/div to 2V/div: ± 50V 2.05V/div to 10V/div: ± 100V

CHANnel1: 2V CHANnel2: -2V

Return Format

The query returns the vertical offset in scientific notation.

Example

:CHANnel1:OFFSet 0.01 The query returns 1.000000e-02.

Return type

float

get_probe_attenuation_ratio()

Rigol Programming Guide

Syntax

:CHANnel<n>:PROBe

Syntax

:CHANnel<n>:PROBe <atten> :CHANnel<n>:PROBe?

Description

Set the probe attenuation ratio of CH1 or CH2. Query the probe attenuation ratio of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<atten>

Discrete

{0.01|0.02|0.05|0.1|0.2|0.5|1|2|5| 10|20|50|100|200|500|1000}

1

Return Format

The query returns the attenuation ratio currently set.

Example

:CHANnel1:PROBe 10 The query returns 10.

Return type

float

get_scale()

Rigol Programming Guide

:CHANnel<n>:SCALe

Syntax

:CHANnel<n>:SCALe <scale>

:CHANnel<n>:SCALe?

Description

Set the vertical scale of the waveform of CH1 or CH2. Query the current vertical scale of the waveform of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<scale>

Real

500μV to 10V

1V

Note: the range of the vertical scale is related to the probe ratio currently set. For the setting of the probe ratio, refer to the :CHANnel<n>:PROBe command.

Return Format

The query returns the vertical scale in scientific notation.

Example

:CHANnel1:SCALe 1

The query returns 1.000000e+00.

Return type

float

set_fine_adjust(enabled=False)

Rigol Programming Guide

Syntax

:CHANnel<n>:VERNier <bool> :CHANnel<n>:VERNier?

Description

Enable or disable the fine adjustment function of the vertical scale of CH1 or CH2. Query the current status of the fine adjustment function of the vertical scale of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<bool>

Bool

{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:CHANnel1:VERNier ON The query returns 1.

Return type

None

set_invert(enable=False)

Rigol Programming Guide

Syntax

:CHANnel<n>:INVert <bool> :CHANnel<n>:INVert?

Description

Enable or disable the inverted display of CH1 or CH2. Query the current status of the inverted display of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:CHANnel1:INVert ON The query returns 1.

Return type

None

set_offset(offset=None)
Offset
  • Set to None to get the default value. (Default)

  • Enter a floating point value to set the offset by yourselt.

Rigol Programming Guide

Syntax

:CHANnel<n>:OFFSet <offset> :CHANnel<n>:OFFSet?

Description

Set the vertical offset of the waveform of CH1 or CH2. Query the current vertical offset of the waveform of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<offset>

Real

500μV/div to 50mV/div: ± 2V 51mV/div to 200mV/div: ± 10V 205mV/div to 2V/div: ± 50V 2.05V/div to 10V/div: ± 100V

CHANnel1: 2V CHANnel2: -2V

Return Format

The query returns the vertical offset in scientific notation.

Example

:CHANnel1:OFFSet 0.01 The query returns 1.000000e-02.

Return type

None

set_probe_attenuation_ratio(ratio=1)

Rigol Programming Guide

Syntax

:CHANnel<n>:PROBe

Syntax

:CHANnel<n>:PROBe <atten> :CHANnel<n>:PROBe?

Description

Set the probe attenuation ratio of CH1 or CH2. Query the probe attenuation ratio of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<atten>

Discrete

{0.01|0.02|0.05|0.1|0.2|0.5|1|2|5| 10|20|50|100|200|500|1000}

1

Return Format

The query returns the attenuation ratio currently set.

Example

:CHANnel1:PROBe 10 The query returns 10.

Return type

None

set_scale(scale=1)

Rigol Programming Guide

:CHANnel<n>:SCALe

Syntax

:CHANnel<n>:SCALe <scale>

:CHANnel<n>:SCALe?

Description

Set the vertical scale of the waveform of CH1 or CH2. Query the current vertical scale of the waveform of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<scale>

Real

500μV to 10V

1V

Note: the range of the vertical scale is related to the probe ratio currently set. For the setting of the probe ratio, refer to the :CHANnel<n>:PROBe command.

Return Format

The query returns the vertical scale in scientific notation.

Example

:CHANnel1:SCALe 1

The query returns 1.000000e+00.

Return type

None

class ds2000.channel.ChannelBandwidthLimit(subdevice)

Bases: ds2000.common.SubController

bw_100m()

Rigol Programming Guide

Syntax

:CHANnel<n>:BWLimit <type> :CHANnel<n>:BWLimit?

Description

Set the bandwidth limit of CH1 or CH2 to 20M (20 MHz), 100M (100 MHz) or OFF (turn bandwidth limit off). Query the current bandwidth limit of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<type>

Discrete

{20M|100M|OFF}

OFF

Note: for DS2072 and DS2012, the bandwidth limit can only be 20MHz.

Return Format

The query returns 20M, 100M or OFF.

Example

:CHANnel1:BWLimit 20M The query returns 20M.

bw_20m()

Rigol Programming Guide

Syntax

:CHANnel<n>:BWLimit <type> :CHANnel<n>:BWLimit?

Description

Set the bandwidth limit of CH1 or CH2 to 20M (20 MHz), 100M (100 MHz) or OFF (turn bandwidth limit off). Query the current bandwidth limit of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<type>

Discrete

{20M|100M|OFF}

OFF

Note: for DS2072 and DS2012, the bandwidth limit can only be 20MHz.

Return Format

The query returns 20M, 100M or OFF.

Example

:CHANnel1:BWLimit 20M The query returns 20M.

off()

Rigol Programming Guide

Syntax

:CHANnel<n>:BWLimit <type> :CHANnel<n>:BWLimit?

Description

Set the bandwidth limit of CH1 or CH2 to 20M (20 MHz), 100M (100 MHz) or OFF (turn bandwidth limit off). Query the current bandwidth limit of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<type>

Discrete

{20M|100M|OFF}

OFF

Note: for DS2072 and DS2012, the bandwidth limit can only be 20MHz.

Return Format

The query returns 20M, 100M or OFF.

Example

:CHANnel1:BWLimit 20M The query returns 20M.

status()

Rigol Programming Guide

Syntax

:CHANnel<n>:BWLimit <type> :CHANnel<n>:BWLimit?

Description

Set the bandwidth limit of CH1 or CH2 to 20M (20 MHz), 100M (100 MHz) or OFF (turn bandwidth limit off). Query the current bandwidth limit of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<type>

Discrete

{20M|100M|OFF}

OFF

Note: for DS2072 and DS2012, the bandwidth limit can only be 20MHz.

Return Format

The query returns 20M, 100M or OFF.

Example

:CHANnel1:BWLimit 20M The query returns 20M.

class ds2000.channel.ChannelCoupling(subdevice)

Bases: ds2000.common.SubController

ac()

Rigol Programming Guide

Syntax

:CHANnel<n>:COUPling <coupling> :CHANnel<n>:COUPling?

Description

Set the coupling mode of CH1 or CH2 to AC, DC or GND. Query the current coupling mode of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<coupling>

Discrete

{AC|DC|GND}

DC

Return Format

The query returns AC, DC or GND.

Example

:CHANnel1:COUPling AC The query returns AC.

Return type

None

dc()

Rigol Programming Guide

Syntax

:CHANnel<n>:COUPling <coupling> :CHANnel<n>:COUPling?

Description

Set the coupling mode of CH1 or CH2 to AC, DC or GND. Query the current coupling mode of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<coupling>

Discrete

{AC|DC|GND}

DC

Return Format

The query returns AC, DC or GND.

Example

:CHANnel1:COUPling AC The query returns AC.

Return type

None

gnd()

Rigol Programming Guide

Syntax

:CHANnel<n>:COUPling <coupling> :CHANnel<n>:COUPling?

Description

Set the coupling mode of CH1 or CH2 to AC, DC or GND. Query the current coupling mode of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<coupling>

Discrete

{AC|DC|GND}

DC

Return Format

The query returns AC, DC or GND.

Example

:CHANnel1:COUPling AC The query returns AC.

Return type

None

status()

Rigol Programming Guide

Syntax

:CHANnel<n>:COUPling <coupling> :CHANnel<n>:COUPling?

Description

Set the coupling mode of CH1 or CH2 to AC, DC or GND. Query the current coupling mode of CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<coupling>

Discrete

{AC|DC|GND}

DC

Return Format

The query returns AC, DC or GND.

Example

:CHANnel1:COUPling AC The query returns AC.

Return type

str

class ds2000.channel.ChannelOffsetRange(min_scl: float, max_scl: float, off: float)

Bases: NamedTuple

A structure to get get a iterable to check a entered offset against the ranges defined below.

max_scl: float

Alias for field number 1

min_scl: float

Alias for field number 0

off: float

Alias for field number 2

class ds2000.channel.ChannelUnits(subdevice)

Bases: ds2000.common.SubController

current()

Rigol Programming Guide

Syntax

:CHANnel<n>:UNITs <units> :CHANnel<n>:UNITs?

Description

Set the amplitude display unit of CH1 or CH2. Query the current amplitude display unit of the CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<units>

Discrete

{VOLTage|WATT|AMPere|UNKNown}

VOLTage

Return Format

The query returns VOLT, WATT, AMP or UNKN.

Example

:CHANnel1:UNITs VOLTage The query returns VOLT.

Return type

None

power()

Rigol Programming Guide

Syntax

:CHANnel<n>:UNITs <units> :CHANnel<n>:UNITs?

Description

Set the amplitude display unit of CH1 or CH2. Query the current amplitude display unit of the CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<units>

Discrete

{VOLTage|WATT|AMPere|UNKNown}

VOLTage

Return Format

The query returns VOLT, WATT, AMP or UNKN.

Example

:CHANnel1:UNITs VOLTage The query returns VOLT.

Return type

None

status()

Rigol Programming Guide

Syntax

:CHANnel<n>:UNITs <units> :CHANnel<n>:UNITs?

Description

Set the amplitude display unit of CH1 or CH2. Query the current amplitude display unit of the CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<units>

Discrete

{VOLTage|WATT|AMPere|UNKNown}

VOLTage

Return Format

The query returns VOLT, WATT, AMP or UNKN.

Example

:CHANnel1:UNITs VOLTage The query returns VOLT.

Return type

str

unknown()

Rigol Programming Guide

Syntax

:CHANnel<n>:UNITs <units> :CHANnel<n>:UNITs?

Description

Set the amplitude display unit of CH1 or CH2. Query the current amplitude display unit of the CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<units>

Discrete

{VOLTage|WATT|AMPere|UNKNown}

VOLTage

Return Format

The query returns VOLT, WATT, AMP or UNKN.

Example

:CHANnel1:UNITs VOLTage The query returns VOLT.

Return type

None

voltage()

Rigol Programming Guide

Syntax

:CHANnel<n>:UNITs <units> :CHANnel<n>:UNITs?

Description

Set the amplitude display unit of CH1 or CH2. Query the current amplitude display unit of the CH1 or CH2.

Parameter

Name

Type

Range

Default

<n>

Discrete

{1|2}

<units>

Discrete

{VOLTage|WATT|AMPere|UNKNown}

VOLTage

Return Format

The query returns VOLT, WATT, AMP or UNKN.

Example

:CHANnel1:UNITs VOLTage The query returns VOLT.

Return type

None

Common Subsystem - common.py

class ds2000.common.BaseController(device)

Bases: object

class ds2000.common.SubController(subdevice)

Bases: object

class ds2000.common.SubSubController(subsubdevice)

Bases: object

ds2000.common.check_input(arg, arg_name, arg_type=None, mini=None, maxi=None, unit=None, ext_type_err=None, ext_range_err=None)

Validating input type and input value is a oftten done thing here. To not repeate it the whole time, this should help quite a bit.

Type and range checks are optional. If you only want to check for one, leave the other arguments of this function as None. One of both is needed.

To format the error message nicely, use the unit argument. Use “s” for example, if you want to format 10.E-6 as 10µs. If disabled it will fill the placeholder with 0.00001 without “s”.

mini and maxi need to be the same type.

Parameters
  • arg (Any) – The argument, to validate.

  • arg_name (str) – The name of the argument as string.

  • arg_type (Optional[Any]) – The type the argument should be.

  • mini (Union[None, int, float]) – The min value of the argument range.

  • maxi (Union[None, int, float]) – The max value of the argument range.

  • unit (Optional[str]) – The unit of the argument, if it should be formated.

  • ext_type_err (Optional[str]) – Some extended error msg, if a type error will occure.

  • ext_range_err (Optional[str]) – Some extended error msg, if a Value will occure.

Return type

None

Returns

None

ds2000.common.check_level(level, scale, offset)

Display Subsystem - display.py

class ds2000.display.Display(device)

Bases: ds2000.common.BaseController

GRID_GRADING_TIMES = (0.0, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, -1.0, inf)
MENU_DISPLAY_TIME = (1, 2, 5, 10, 20, -1)
clear()

Rigol Programming Guide

Syntax

:DISPlay:CLEar

Description

Clear all the waveforms on the screen.

Explanation

If the oscilloscope is in RUN state (refer to the :RUN command), new waveforms will be displayed. You can also use the :CLEar command to clear all the waveforms on the screen.

Return type

None

data()

Rigol Programming Guide

Syntax

:DISPlay:DATA?

Description

Read the bitmap data stream of the image currently displayed.

Explanation

The command is sent from the PC to the instrument through the VISA interface. The instrument responds to the command and directly returns the bitmap data stream of the image currently displayed to the buffer area of the PC.

Return Format

The format of the bitmap data stream:

Component

TMC Blockheader

BMP Data

Size (length)

N[1] +2

800*480*3+54=1152054[2]

Example #9001152054 BM… ============== ================================ ======================= Explanation TMC Blockheader ::= #NXXXXXX Specific bitmap data.

is used to describe the length of the data stream. Wherein, # is the start denoter of the data stream; N is less than or equal to 9 and the N figures following it denotes the length of the data stream in bytes. For example, #9001152054; wherein, N is 9 and 001152054 denotes that the data stream contains 1152054 bytes of effective data.

Note[1]: N is the width used to describe the data length in the TMC header. For example, #90000.

Note[2]: the width is 800, the height is 480, the bit depth is 24Bit = 3Byte, 54 is the size of the bitmap file header.

Example

  1. Make sure that the buffer is large enough to receive the data stream, otherwise the program might be abnormal when reading the data stream.

  2. The returned data stream contains TMC data header and you need to remove the data header to make the data stream a standard bitmap data stream.

  3. When the data size is larger than 1 M and the communication speed of the interface is not fast enough, you need to set an appropriate timeout time

  4. The terminator ‘n’(0X0A) at the end of the data should be removed.

Return type

bytearray

get_grid_brightness()

Rigol Programming Guide

Syntax

:DISPlay:GBRightness <brightness> :DISPlay:GBRightness?

Description

Set the brightness of the screen grid and the unit is %. Query the current brightness of the screen grid.

Parameter

Name

Type

Range

Default

<brightness>

Integer

0 to 100

50

Return Format

The query retruns an integer between 0 and 100.

Example

:DISPlay:GBRightness 60 The query returns 60.

Return type

int

get_persistence_time()
Return type

float

Returns

The persistence in s, where 0.0 means Minimum and math.inf is infinite.

Rigol Programming Guide

Syntax

:DISPlay:GRADing:TIME <time> :DISPlay:GRADing:TIME?

Description

Set the persistence time and the unit is s. Query the current persistence time.

Parameter

Name

Type

Range

Default

<time>

Discrete

{MIN|0.05|0.1|0.2|0.5|1|2|5|10|20|INFinite}

MIN

Explanation

MIN: set the persistence time to its minimum to view the waveform changing in high refresh rate.

Specific Values: a certain value between 0.05 s and 20 s, enable to observe glitch that changes relatively slowly or glitch with low occurrence probability.

INFinite: in this mode, the oscilloscope displays the newly acquired waveform without clearing the waveform formerly acquired. Enable to measure noise and jitter as well as capture incidental events.

Return Format

The query returns the persistence time set.

Example

:DISPlay:GRADing:TIME 0.1 The query returns 0.1.

get_waveform_brightness()

Rigol Programming Guide

Syntax

:DISPlay:WBRightness <time> :DISPlay:WBRightness?

Description

Set the waveform brightness and the unit is %. Query the current waveform brightness.

Parameter

Name

Type

Range

Default

<time>

Integer

0 to 100

50

Return Format

The query returns an integer between 0 and 100.

Example

:DISPlay:WBRightness 60 The query returns 60.

Return type

int

set_grid_brightness(brightness=50)

Rigol Programming Guide

Syntax

:DISPlay:GBRightness <brightness> :DISPlay:GBRightness?

Description

Set the brightness of the screen grid and the unit is %. Query the current brightness of the screen grid.

Parameter

Name

Type

Range

Default

<brightness>

Integer

0 to 100

50

Return Format

The query retruns an integer between 0 and 100.

Example

:DISPlay:GBRightness 60 The query returns 60.

Return type

None

set_menu_display_time(time=- 1)

Rigol Programming Guide

Syntax

:DISPlay:MPERsistence <time> :DISPlay:MPERsistence?

Description

Set the menu display time and the unit is s. Query the current menu display time.

Parameter

Name

Type

Range

Default

<time>

Discrete

{1|2|5|10|20|INFinite}

INFinite

Return Format

Query the menu display time set.

Example

:DISPlay:MPERsistence 20 The query returns 20.

Return type

None

set_persistence_time(time=0.0)

Rigol Programming Guide

Syntax

:DISPlay:GRADing:TIME <time> :DISPlay:GRADing:TIME?

Description

Set the persistence time and the unit is s. Query the current persistence time.

Parameter

Name

Type

Range

Default

<time>

Discrete

{MIN|0.05|0.1|0.2|0.5|1|2|5|10|20|INFinite}

MIN

Explanation

MIN: set the persistence time to its minimum to view the waveform changing in high refresh rate. Specific Values: a certain value between 0.05 s and 20 s, enable to observe glitch that changes relatively slowly or glitch with low occurrence probability. INFinite: in this mode, the oscilloscope displays the newly acquired waveform without clearing the waveform formerly acquired. Enable to measure noise and jitter as well as capture incidental events.

Return Format

The query returns the persistence time set.

Example

:DISPlay:GRADing:TIME 0.1 The query returns 0.1.

Return type

None

set_waveform_brightness(brightness=50)

Rigol Programming Guide

Syntax

:DISPlay:WBRightness <time> :DISPlay:WBRightness?

Description

Set the waveform brightness and the unit is %. Query the current waveform brightness.

Parameter

Name

Type

Range

Default

<time>

Integer

0 to 100

50

Return Format

The query returns an integer between 0 and 100.

Example

:DISPlay:WBRightness 60 The query returns 60.

Return type

None

class ds2000.display.DisplayGrid(subdevice)

Bases: ds2000.common.SubController

full()

Rigol Programming Guide

Syntax

:DISPlay:GRID <grid> :DISPlay:GRID?

Description

Set the grid type of screen display. Query the current grid type of screen display.

Parameter

Name

Type

Range

Default

<grid>

Discrete

{FULL|HALF|NONE}

FULL

Explanation

FULL: turn the background grid and coordinate on.

HALF: turn the background grid off.

NONE: turn the background grid and coordinate off.

Return Format

The query returns FULL, HALF or NONE.

Example

:DISPlay:GRID NONE The query returns NONE.

half()

Rigol Programming Guide

Syntax

:DISPlay:GRID <grid> :DISPlay:GRID?

Description

Set the grid type of screen display. Query the current grid type of screen display.

Parameter

Name

Type

Range

Default

<grid>

Discrete

{FULL|HALF|NONE}

FULL

Explanation

FULL: turn the background grid and coordinate on.

HALF: turn the background grid off.

NONE: turn the background grid and coordinate off.

Return Format

The query returns FULL, HALF or NONE.

Example

:DISPlay:GRID NONE The query returns NONE.

none()

Rigol Programming Guide

Syntax

:DISPlay:GRID <grid> :DISPlay:GRID?

Description

Set the grid type of screen display. Query the current grid type of screen display.

Parameter

Name

Type

Range

Default

<grid>

Discrete

{FULL|HALF|NONE}

FULL

Explanation

FULL: turn the background grid and coordinate on.

HALF: turn the background grid off.

NONE: turn the background grid and coordinate off.

Return Format

The query returns FULL, HALF or NONE.

Example

:DISPlay:GRID NONE The query returns NONE.

status()

Rigol Programming Guide

Syntax

:DISPlay:GRID <grid> :DISPlay:GRID?

Description

Set the grid type of screen display. Query the current grid type of screen display.

Parameter

Name

Type

Range

Default

<grid>

Discrete

{FULL|HALF|NONE}

FULL

Explanation

FULL: turn the background grid and coordinate on.

HALF: turn the background grid off.

NONE: turn the background grid and coordinate off.

Return Format

The query returns FULL, HALF or NONE.

Example

:DISPlay:GRID NONE The query returns NONE.

Return type

str

class ds2000.display.DisplayType(subdevice)

Bases: ds2000.common.SubController

dots()

Rigol Programming Guide

Syntax

:DISPlay:TYPE <type> :DISPlay:TYPE?

Description

Set the display mode of the waveform on the screen. Query the current display mode of the waveform on the screen.

Parameter

Name

Type

Range

Default

<type>

Discrete

{VECTors|DOTS}

VECTors

Explanation

VECTors: the sample points are connected by lines and displayed. Normally, this mode can provide the most vivid waveform to view the steep edge of the waveform (such as square waveform). DOTS: display the sample points directly. You can directly view each sample point and use the cursor to measure the X and Y values of the sample point.

Return Format

The query returns VECT or DOTS.

Example

:DISPlay:TYPE DOTS The query returns DOTS.

status()

Rigol Programming Guide

Syntax

:DISPlay:TYPE <type> :DISPlay:TYPE?

Description

Set the display mode of the waveform on the screen. Query the current display mode of the waveform on the screen.

Parameter

Name

Type

Range

Default

<type>

Discrete

{VECTors|DOTS}

VECTors

Explanation

VECTors: the sample points are connected by lines and displayed. Normally, this mode can provide the most vivid waveform to view the steep edge of the waveform (such as square waveform). DOTS: display the sample points directly. You can directly view each sample point and use the cursor to measure the X and Y values of the sample point.

Return Format

The query returns VECT or DOTS.

Example

:DISPlay:TYPE DOTS The query returns DOTS.

vectors()

Rigol Programming Guide

Syntax

:DISPlay:TYPE <type> :DISPlay:TYPE?

Description

Set the display mode of the waveform on the screen. Query the current display mode of the waveform on the screen.

Parameter

Name

Type

Range

Default

<type>

Discrete

{VECTors|DOTS}

VECTors

Explanation

VECTors: the sample points are connected by lines and displayed. Normally, this mode can provide the most vivid waveform to view the steep edge of the waveform (such as square waveform).

DOTS: display the sample points directly. You can directly view each sample point and use the cursor to measure the X and Y values of the sample point.

Return Format

The query returns VECT or DOTS.

Example

:DISPlay:TYPE DOTS The query returns DOTS.

Error Handling - errors.py

exception ds2000.errors.DS2000Error

Bases: ds2000.errors.Error

exception ds2000.errors.DS2000InternalError(message=None, payload=None)

Bases: ds2000.errors.Error

BUGMSG = 'If you discover this message, please try updating the ds2000 package. If you see this message again, we would be glad, if you would hand in a "Bug report" at https://github.com/MichaelSasser/ds2000/issues with the complete traceback.\nPython version: 3.9.1 final\nds2000 version: 0.1.0 \n'
exception ds2000.errors.DS2000InternalSyntaxError(message=None, payload=None)

Bases: ds2000.errors.DS2000InternalError

payload: Any
exception ds2000.errors.DS2000StateError

Bases: ds2000.errors.Error

exception ds2000.errors.Error

Bases: Exception

Base class for exceptions in this module.

IEEE 488.2 Common Commands - ieee.py

class ds2000.ieee.IEEE(device)

Bases: ds2000.common.BaseController

idn()

This method returns the ID character string of the device_address as a Instrument Tuple.

Rigol Programming Guide

Syntax

*IDN?

Description

Query the current device information.

Return Format

Rigol Technologies,<model>,<serial number>,X.XX.XX <model>: the model number of the instrument. <serial number>: the serial number of the instrument. X.XX.XX: the software version of the instrument.

Example

*IDN?

The query returns RIGOL TECHNOLOGIES,DS2202,DS2A0000000001,00.00.01. Instrument

Return type

str

rst()

Rigol Programming Guide

Syntax

*RST

Description

Restore the instrument to the default values.

Timebase Subsystem - timebase.py

class ds2000.timebase.Timebase(device)

Bases: ds2000.common.BaseController

disable_fine_adjustment()

Rigol Programming Guide

Syntax

:TIMebase:VERNier <bool> :TIMebase:VERNier?

Description

Enable or disable the fine adjustment of the horizontal scale. Query the current status of the fine adjustment of the horizontal scale.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:TIMebase:VERNier ON The query returns 1.

Return type

None

enable_fine_adjustment()

Rigol Programming Guide

Syntax

:TIMebase:VERNier <bool> :TIMebase:VERNier?

Description

Enable or disable the fine adjustment of the horizontal scale. Query the current status of the fine adjustment of the horizontal scale.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:TIMebase:VERNier ON The query returns 1.

Return type

None

fine_adjustment_enabled()

Rigol Programming Guide

Syntax

:TIMebase:VERNier <bool> :TIMebase:VERNier?

Description

Enable or disable the fine adjustment of the horizontal scale. Query the current status of the fine adjustment of the horizontal scale.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:TIMebase:VERNier ON The query returns 1.

Return type

bool

get_offset()

Rigol Programming Guide

Syntax

:TIMebase[:MAIN]:OFFSet <offset> :TIMebase[:MAIN]:OFFSet?

Description

Set the offset of the main time base and the unit is s. Query the current offset of the main time base.

Parameter

Name

Type

Range

Default

<offset>

Real

RUN: -MemDepth/SamplingRate to 1s (when the TimeScale is less than 20ms) -MemDepth/SamplingRate to 10×TimeScale (when the TimeScale is greater than or equal to 20ms) STOP: -7000s to 7000s ROLL RUN: not avaliable ROLL STOP: -7000s to 0

0

Note: For the MemDepth, refer to the :ACQuire:MDEPth command. For the SamplingRate, refer to the :ACQuire:SRATe? command. For the TimeScale, refer to the :TIMebase[:MAIN]:SCALe command.

Return Format

The query returns the offset in the scientific notation.

Example

:TIMebase:MAIN:OFFSet 0.0002 The query returns 2.000000e-04.

Return type

int

get_scale()

Rigol Programming Guide

Syntax

:TIMebase[:MAIN]:SCALe <scale_value>

:TIMebase[:MAIN]:SCALe?

Description

Set the scale of the main time base and the unit is s/div. Query the current scale of the main time base.

Name

Type

Range

Default

<scale_value>

Real

Depend on the time base mode [1]: Normal: 2ns[2] to 1ks ROLL: 200ms to 1ks

1μs

Note[1]: refer to the :TIMebase:MODE command.

Note[2]: this value is different for different model. For DS2072 and DS2012, the value is 5 ns.

Return Format

The query returns the current scale of the main time base in scientific notation.

Example

:TIMebase:MAIN:SCALe 0.0002

The query returns 2.000000e-04.

Return type

float

set_offset(seconds=0)

Rigol Programming Guide

Syntax

:TIMebase[:MAIN]:OFFSet <offset> :TIMebase[:MAIN]:OFFSet?

Description

Set the offset of the main time base and the unit is s. Query the current offset of the main time base.

Parameter

Name

Type

Range

Default

<offset>

Real

RUN: -MemDepth/SamplingRate to 1s (when the TimeScale is less than 20ms) -MemDepth/SamplingRate to 10×TimeScale (when the TimeScale is greater than or equal to 20ms) STOP: -7000s to 7000s ROLL RUN: not avaliable ROLL STOP: -7000s to 0

0

Note: For the MemDepth, refer to the :ACQuire:MDEPth command. For the SamplingRate, refer to the :ACQuire:SRATe? command. For the TimeScale, refer to the :TIMebase[:MAIN]:SCALe command.

Return Format

The query returns the offset in the scientific notation.

Example

:TIMebase:MAIN:OFFSet 0.0002 The query returns 2.000000e-04.

Return type

None

set_scale(seconds=1e-06)

Rigol Programming Guide

Syntax

:TIMebase[:MAIN]:SCALe <scale_value>

:TIMebase[:MAIN]:SCALe?

Description

Set the scale of the main time base and the unit is s/div. Query the current scale of the main time base.

Name

Type

Range

Default

<scale_value>

Real

Depend on the time base mode [1]: Normal: 2ns[2] to 1ks ROLL: 200ms to 1ks

1μs

Note[1]: refer to the :TIMebase:MODE command.

Note[2]: this value is different for different model. For DS2072 and DS2012, the value is 5 ns.

Return Format

The query returns the current scale of the main time base in scientific notation.

Example

:TIMebase:MAIN:SCALe 0.0002

The query returns 2.000000e-04.

Return type

float

class ds2000.timebase.TimebaseDelay(subdevice)

Bases: ds2000.common.SubController

disable()

Rigol Programming Guide

Syntax

:TIMebase:DELay:ENABle <bool> :TIMebase:DELay:ENABle?

Description

Enable or disable the delayed sweep. Query the current status of the delayed sweep.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:TIMebase:DELay:ENABle ON The query returns 1.

Return type

None

enable()

Rigol Programming Guide

Syntax

:TIMebase:DELay:ENABle <bool> :TIMebase:DELay:ENABle?

Description

Enable or disable the delayed sweep. Query the current status of the delayed sweep.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:TIMebase:DELay:ENABle ON The query returns 1.

Return type

None

get_offset()

Rigol Programming Guide

Syntax

:TIMebase:DELay:OFFSet <offset> :TIMebase:DELay:OFFSet?

Description

Set the offset of the delayed time base and the unit is s. Query the current offset of the delayed time base.

Parameter

Name

Type

Range

Default

<offset>

Real

-(LeftTime - DelayRange/2) to (RightTime - DelayRange/2)

0

Note: LeftTime = 7×MainScale – MainOffset. For the MainScale, refer to the :TIMebase[:MAIN]:SCALe command. RightTime = 7×MainScale + MainOffset. For the MainOffset, refer to the :TIMebase[:MAIN]:OFFSet command. DelayRange = 14×DelayScale. For the DelayScale, refer to the :TIMebase:DELay:SCALe command.

Return Format

The query returns the offset in scientific notation.

Example

:TIMebase:DELay:OFFSet 0.000002 The query returns 2.000000e-06.

Return type

float

get_scale()

Rigol Programming Guide

Syntax

:TIMebase:DELay:SCALe <scale_value> :TIMebase:DELay:SCALe?

Description

Set the scale of the delayed time base and the unit is s/div. Query the current scale of the delayed time base.

Parameter

Name

Type

Range

Default

<scale_value>

Real

(1×50/real-time sample rate)×1/40 to the current MAIN SCALe

500ns

Note: for the MAIN SCALe, refer to the :TIMebase[:MAIN]:SCALe command.

Return Format

The query returns the horizontal scale in scientific notation.

Example

:TIMebase:DELay:SCALe 0.00000005 The query returns 5.000000e-08.

Return type

float

set_offset(offset=0)

Rigol Programming Guide

Syntax

:TIMebase:DELay:OFFSet <offset> :TIMebase:DELay:OFFSet?

Description

Set the offset of the delayed time base and the unit is s. Query the current offset of the delayed time base.

Parameter

Name

Type

Range

Default

<offset>

Real

-(LeftTime - DelayRange/2) to (RightTime - DelayRange/2)

0

Note: LeftTime = 7×MainScale – MainOffset. For the MainScale, refer to the :TIMebase[:MAIN]:SCALe command. RightTime = 7×MainScale + MainOffset. For the MainOffset, refer to the :TIMebase[:MAIN]:OFFSet command. DelayRange = 14×DelayScale. For the DelayScale, refer to the :TIMebase:DELay:SCALe command.

Return Format

The query returns the offset in scientific notation.

Example

:TIMebase:DELay:OFFSet 0.000002 The query returns 2.000000e-06.

Return type

None

set_scale(scale=5e-07)

Rigol Programming Guide

Syntax

:TIMebase:DELay:SCALe <scale_value> :TIMebase:DELay:SCALe?

Description

Set the scale of the delayed time base and the unit is s/div. Query the current scale of the delayed time base.

Parameter

Name

Type

Range

Default

<scale_value>

Real

(1×50/real-time sample rate)×1/40 to the current MAIN SCALe

500ns

Note: for the MAIN SCALe, refer to the :TIMebase[:MAIN]:SCALe command.

Return Format

The query returns the horizontal scale in scientific notation.

Example

:TIMebase:DELay:SCALe 0.00000005 The query returns 5.000000e-08.

Return type

None

status()

Rigol Programming Guide

Syntax

:TIMebase:DELay:ENABle <bool> :TIMebase:DELay:ENABle?

Description

Enable or disable the delayed sweep. Query the current status of the delayed sweep.

Parameter

Name

Type

Range

Default

<bool>

Bool

{{0|OFF}|{1|ON}}

0|OFF

Return Format

The query returns 0 or 1.

Example

:TIMebase:DELay:ENABle ON The query returns 1.

Return type

bool

class ds2000.timebase.TimebaseHorizontalRef(device)

Bases: ds2000.common.SubController

get_position()

Rigol Programming Guide

Syntax

:TIMebase:HREF:POSition <pos> :TIMebase:HREF:POSition?

Description

Set the user-defined reference position around which the waveform expands or compresses horizontally. Query the current user-defined reference position around which the waveform expands or compresses horizontally.

Parameter

Name

Type

Range

Default

<pos>

Integer

-350 to 350

0

Return Format

The query returns an integer.

Example

:TIMebase:HREF:POSition 150 The query returns 150.

Return type

int

set_position(pos=0)

Rigol Programming Guide

Syntax

:TIMebase:HREF:POSition <pos> :TIMebase:HREF:POSition?

Description

Set the user-defined reference position around which the waveform expands or compresses horizontally. Query the current user-defined reference position around which the waveform expands or compresses horizontally.

Parameter

Name

Type

Range

Default

<pos>

Integer

-350 to 350

0

Return Format

The query returns an integer.

Example

:TIMebase:HREF:POSition 150 The query returns 150.

Return type

None

class ds2000.timebase.TimebaseHorizontalRefMode(subsubdevice)

Bases: ds2000.common.SubSubController

center()

Rigol Programming Guide

Syntax

:TIMebase:HREF:MODE <href> :TIMebase:HREF:MODE?

Description

Set the horizontal reference mode namely the reference position according to which the waveform expands and compresses horizontally. Query the current horizontal reference mode.

Parameter

Name

Type

Range

Default

<href>

Discrete

{CENTer|TPOSition|USER}

CENTer

Explanation

CENTer: the waveform expands or compresses horizontally around the center of the screen. TPOSition: the waveform expands or compresses horizontally around the trigger position. USER: the waveform expands or compresses horizontally around the user-defined reference position. Refer to the :TIMebase:HREF:POSition command.

Return Format

The query returns CENT, TPOS or USER.

Example

:TIMebase:HREF:MODE TPOSition The query returns TPOS.

Return type

None

status()

Rigol Programming Guide

Syntax

:TIMebase:HREF:MODE <href> :TIMebase:HREF:MODE?

Description

Set the horizontal reference mode namely the reference position according to which the waveform expands and compresses horizontally. Query the current horizontal reference mode.

Parameter

Name

Type

Range

Default

<href>

Discrete

{CENTer|TPOSition|USER}

CENTer

Explanation

CENTer: the waveform expands or compresses horizontally around the center of the screen. TPOSition: the waveform expands or compresses horizontally around the trigger position. USER: the waveform expands or compresses horizontally around the user-defined reference position. Refer to the :TIMebase:HREF:POSition command.

Return Format

The query returns CENT, TPOS or USER.

Example

:TIMebase:HREF:MODE TPOSition The query returns TPOS.

Return type

str

trigger_position()

Rigol Programming Guide

Syntax

:TIMebase:HREF:MODE <href> :TIMebase:HREF:MODE?

Description

Set the horizontal reference mode namely the reference position according to which the waveform expands and compresses horizontally. Query the current horizontal reference mode.

Parameter

Name

Type

Range

Default

<href>

Discrete

{CENTer|TPOSition|USER}

CENTer

Explanation

CENTer: the waveform expands or compresses horizontally around the center of the screen. TPOSition: the waveform expands or compresses horizontally around the trigger position. USER: the waveform expands or compresses horizontally around the user-defined reference position. Refer to the :TIMebase:HREF:POSition command.

Return Format

The query returns CENT, TPOS or USER.

Example

:TIMebase:HREF:MODE TPOSition The query returns TPOS.

Return type

None

class ds2000.timebase.TimebaseMode(subdevice)

Bases: ds2000.common.SubController

main()

Rigol Programming Guide

Syntax

:TIMebase:MODE <mode> :TIMebase:MODE?

Description

Set the horizontal time base mode. Query the current horizontal time base mode.

Parameter

Name

Type

Range

Default

<mode>

Discrete

{MAIN|XY|ROLL}

MAIN

Return Format

The query returns MAIN, XY or ROLL.

Example

:TIMebase:MODE MAIN The query returns MAIN.

Return type

None

roll()

Rigol Programming Guide

Syntax

:TIMebase:MODE <mode> :TIMebase:MODE?

Description

Set the horizontal time base mode. Query the current horizontal time base mode.

Parameter

Name

Type

Range

Default

<mode>

Discrete

{MAIN|XY|ROLL}

MAIN

Return Format

The query returns MAIN, XY or ROLL.

Example

:TIMebase:MODE MAIN The query returns MAIN.

Return type

None

status()

Rigol Programming Guide

Syntax

:TIMebase:MODE <mode> :TIMebase:MODE?

Description

Set the horizontal time base mode. Query the current horizontal time base mode.

Parameter

Name

Type

Range

Default

<mode>

Discrete

{MAIN|XY|ROLL}

MAIN

Return Format

The query returns MAIN, XY or ROLL.

Example

:TIMebase:MODE MAIN The query returns MAIN.

Return type

str

xy()

Rigol Programming Guide

Syntax

:TIMebase:MODE <mode> :TIMebase:MODE?

Description

Set the horizontal time base mode. Query the current horizontal time base mode.

Parameter

Name

Type

Range

Default

<mode>

Discrete

{MAIN|XY|ROLL}

MAIN

Return Format

The query returns MAIN, XY or ROLL.

Example

:TIMebase:MODE MAIN The query returns MAIN.

Return type

None

Waveform Subsystem - waveform.py

class ds2000.waveform.Format(subdevice)

Bases: ds2000.common.SubController

ascii()

Rigol Programming Guide:

:WAVeform:FORMat

Syntax :WAVeform:FORMat <format> :WAVeform:FORMat?

Description Set the return format of the waveform data. Query the current return format of the waveform data.

Parameter

Name

Type

Range

Default

<format>

Discrete

{WORD|BYTE|ASCii}

BYTE

Explanation

In different modes, the :WAVeform:POINts command returns different numbers of waveform points.

NORMal : return the number of waveform points currently displayed.

MAXimum : return the maximum number of effective data points under the current state. Return the number of data points displayed on the screen when the instrument is in run state and the number of data points in the internal memory in stop state.

RAW : It is only available when the instrument is in stop state. You can use the :WAVeform:POINts command to set the desired number of data points in the internal memory.

Return Format

The query returns WORD, BYTE or ASC.

Example

:WAVeform:FORMat WORD

The query returns WORD.

byte()

Rigol Programming Guide

:WAVeform:FORMat

Syntax

:WAVeform:FORMat <format> :WAVeform:FORMat?

Description

Set the return format of the waveform data. Query the current return format of the waveform data.

Parameter

Name

Type

Range

Default

<format>

Discrete

{WORD|BYTE|ASCii}

BYTE

Explanation

In different modes, the :WAVeform:POINts command returns different numbers of waveform points. NORMal : return the number of waveform points currently displayed.

MAXimum : return the maximum number of effective data points under the current state. Return the number of data points displayed on the screen when the instrument is in run state and the number of data points in the internal memory in stop state.

RAW : It is only available when the instrument is in stop state. You can use the :WAVeform:POINts command to set the desired number of data points in the internal memory.

Return Format

The query returns WORD, BYTE or ASC.

Example

:WAVeform:FORMat WORD

The query returns WORD.

get()
word()

Rigol Programming Guide

:WAVeform:FORMat

Syntax

:WAVeform:FORMat <format>

:WAVeform:FORMat?

Description

Set the return format of the waveform data. Query the current return format of the waveform data.

Parameter

Name

Type

Range

Default

<format>

Discrete

{WORD|BYTE|ASCii}

BYTE

Explanation

In different modes, the :WAVeform:POINts command returns different numbers of waveform points.

NORMal : return the number of waveform points currently displayed.

MAXimum : return the maximum number of effective data points under the current state. Return the number of data points displayed on the screen when the instrument is in run state and the number of data points in the internal memory in stop state.

RAW : It is only available when the instrument is in stop state. You can use the :WAVeform:POINts command to set the desired number of data points in the internal memory.

Return Format

The query returns WORD, BYTE or ASC.

Example

:WAVeform:FORMat WORD

The query returns WORD.

class ds2000.waveform.Mode(subdevice)

Bases: ds2000.common.SubController

get()
maximum()

Rigol Programming Guide

:WAVeform:MODE

Syntax

:WAVeform:MODE <mode>

:WAVeform:MODE?

Description

Set the reading mode of waveform. Query the current reading mode of waveform.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|MAXimum|RAW}

NORMal

Explanation

In different modes, the :WAVeform:POINts command returns different numbers of waveform points.

NORMal : return the number of waveform points currently displayed.

MAXimum : return the maximum number of effective data points under the current state. Return the number of data points displayed on the screen when the instrument is in run state and the number of data points in the internal memory in stop state.

RAW : It is only available when the instrument is in stop state. You can use the :WAVeform:POINts command to set the desired number of data points in the internal memory.

Return Format

The query returns NORM, MAX or RAW.

Example

:WAVeform:MODE RAW

The query returns RAW.

normal()

Rigol Programming Guide:

:WAVeform:MODE

Syntax

:WAVeform:MODE <mode> :WAVeform:MODE?

Description

Set the reading mode of waveform. Query the current reading mode of waveform.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|MAXimum|RAW}

NORMal

Explanation

In different modes, the :WAVeform:POINts command returns different numbers of waveform points.

NORMal : return the number of waveform points currently displayed.

MAXimum : return the maximum number of effective data points under the current state. Return the number of data points displayed on the screen when the instrument is in run state and the number of data points in the internal memory in stop state.

RAW : It is only available when the instrument is in stop state. You can use the :WAVeform:POINts command to set the desired number of data points in the internal memory.

Return Format

The query returns NORM, MAX or RAW.

Example

:WAVeform:MODE RAW

The query returns RAW.

raw()

Rigol Programming Guide

:WAVeform:MODE

Syntax

:WAVeform:MODE <mode>

:WAVeform:MODE?

Description

Set the reading mode of waveform. Query the current reading mode of waveform.

Parameter

Name

Type

Range

Default

<type>

Discrete

{NORMal|MAXimum|RAW}

NORMal

Explanation

In different modes, the :WAVeform:POINts command returns different numbers of waveform points.

NORMal : return the number of waveform points currently displayed.

MAXimum : return the maximum number of effective data points under the current state. Return the number of data points displayed on the screen when the instrument is in run state and the number of data points in the internal memory in stop state.

RAW : It is only available when the instrument is in stop state. You can use the :WAVeform:POINts command to set the desired number of data points in the internal memory.

Return Format

The query returns NORM, MAX or RAW.

Example

:WAVeform:MODE RAW

The query returns RAW.

class ds2000.waveform.Preamble(format, type, points, count, x_inc, x_origin, x_ref, y_inc, y_origin, y_ref)

Bases: NamedTuple

count: int

Alias for field number 3

format: str

Alias for field number 0

points: int

Alias for field number 2

type: str

Alias for field number 1

x_inc: float

Alias for field number 4

x_origin: float

Alias for field number 5

x_ref: float

Alias for field number 6

y_inc: float

Alias for field number 7

y_origin: float

Alias for field number 8

y_ref: float

Alias for field number 9

class ds2000.waveform.Waveform(device)

Bases: ds2000.common.BaseController

begin()

Rigol Programming Guide

:WAVeform:BEGin

Syntax

:WAVeform:BEGin

Description

Enable the waveform reading.

channel(channel=1)

Rigol Programming Guide

:WAVeform:SOURce

Syntax

:WAVeform:SOURce <source>

:WAVeform:SOURce?

Description

Set the channel source of waveform reading. Query the current channel source of waveform reading.

Parameter

Name

Type

Range

Default

<source>

Discrete

{CHANnel1|CHANnel2}

CHANnel1

Return Format

The query returns CHAN1 or CHAN2。

Example

:WAVeform:SOURce CHANnel2

The query returns CHAN2.

data(recorded=False)

Rigol Programming Guide

Syntax

:WAVeform:DATA?

Description

Read the waveform data.

Explanation

This command is affected by the :WAVeform:FORMat, :WAVeform:MODE, :WAVeform:POINts, :WAVeform:SOURce and related commands.

Procedures of the screen waveform data reading:

Command

Description

S1. :WAV:SOURce CHAN1

Set the channel source to be read

S2. :WAV:MODE NORM

Set the waveform mode to NORM

S3. :WAV:DATA?

Obtain data from buffer

Procedures of the internal memory waveform data reading:

Command

Description

S1. :STOP

The internal memory waveform data can only be read in STOP state

S2. :WAV:SOURce CHAN1

Set the channel source to be read

S3. :WAV:MODE RAW

Set the waveform mode to RAW

S4. :WAV:RESet

Reset the waveform reading

S5. :WAV:BEGin

Start the waveform reading

S6. :WAV:STATus?

Get the state

  1. IDLE

Waveform reading thread finishes

:WAV:DATA?

Get data in buffer

WAV

END

Waveform reading finishes

  1. READ

Waveform reading thread is running

:WAV:DATA?

Get data in buffer

Repeat S6

Continue to read waveform data

See the example below.

visa32.viPrintf(viSession, ":STOP\n");
visa32.viPrintf(viSession, ":WAV:MODE RAW\n");
visa32.viPrintf(viSession, ":WAV:SOURce %s\n", strChan );
visa32.viPrintf(viSession, ":WAV:RESet\n");
visa32.viPrintf(viSession, ":WAV:BEGin\n");
while (true) {
    Thread.Sleep( 100 );
    visa32.viPrintf(viSession, ":WAV:STATus?\n");
    visa32.viScanf(viSession, "%s", strBuild);
    if (strBuild[0] == 'I') {  //IDLE
        visa32.viPrintf(viSession, ":WAV:DATA?\n");
        visa32.viRead(viSession, wfmBuf, wfmBuf.Length, out readCnt);
        readSum += ( readCnt -12);
        readTim++;
        Console.WriteLine("{0}: Read {1} Sum {2}" ,
                          readTim, readCnt, readSum);
        return readSum;
    } else {
        visa32.viPrintf(viSession, ":WAV:DATA?\n");
        visa32.viRead(viSession, wfmBuf, wfmBuf.Length, out readCnt);
        readSum += (readCnt -12);
        readTim++;
        Console.WriteLine("{0}: Read {1} Sum {2}" ,
                          readTim, readCnt, readSum);
        Console.WriteLine("Press any key to read next data." );
        //Console.ReadKey();
        Console.WriteLine("Reading..." );
    }
}

Return Format

The data returned contains 2 parts: the TMC data description header and the waveform data.

#900000ddddXXXX…

Wherein, dddd denotes the number of the effective waveform points in the data stream. When reading the internal memory data, the waveform data returned each time might be the data block in one area of the buffer. Each data block has a TMC description header similar to #9XXXXXXXXX, wherein XXXXXXXXX denotes the number of the waveform points in this data block. Waveform data in two adjacent data blocks are consecutive.

The waveform data read can be converted to the voltage of each point of the waveform on the screen according to the method below.

The figure below shows the waveform data read. First, select “View as hexadecimal only” from the dropdown list at the right of Buffer; at this point, the waveform data read is displayed in hexadecimal format; the first 11 figures denote the number of bytes that the “Denoter” holds in the internal memory; the figures following are the waveform data on the screen and users can convert the waveform data read to the voltage of each point of the waveform on the screen using the formula (ox63 - vertical reference position in Y direction) × VerticalScale-OFFSet. For the vertical reference position in Y direction, refer to the :WAVeform:YREFerence? command, for the VerticalScale, refer to the :CHANnel<n>:SCALe command and for the OFFSet, refer to the :CHANNel<n>:OFFSet command.

Note: when the return format of the waveform data is set to ASCii (refer to the :WAVeform:FORMat command), the query returns the actual voltage of each point of the waveform on the screen in scientific notation.

C# Test Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.IO;
namespace FalconWavQuery
{
class Program
{
        static void Main(string[] args)
        {
                Int32 viDef = 0;
                Int32 viSession = 0;
                Int32 s32ReadByte;
                if (args.Length < 2) {
                        Console.WriteLine("Invalid Input!
                                 FalconWavQuery CHAN1 fileName");
                        return;
                }
                Stopwatch stpWatch = new Stopwatch();
                InitVisa(out viDef);
                if (ConnectDevice(viDef, out viSession) == true) {}
                else {
                        Console.WriteLine("Connect fail!");
                        return;
                }
                stpWatch.Start();
                s32ReadByte = TestReadWfm(viSession,
                                          args[0], args[1]);
                stpWatch.Stop();
                Console.WriteLine("Speed is {0} KB/s",
                                  s32ReadByte /
                                  stpWatch.ElapsedMilliseconds);
                DeInitVisa(viDef, viSession);
                Console.WriteLine("Press any key to continue.");
                Console.ReadKey();
        }
        static Int32 TestReadWfm(Int32 viSession, string strChan,
                                 string strFile)
        {
                byte []wfmBuf;
                Int32 readCnt = 0;
                Int32 readSum = 0;
                Int32 readTim = 0;
                Int32 maxPacket = 0;
                StringBuilder strBuild;
                Stream streamOut;
                BinaryWriter wfmStream;
                wfmBuf = new byte[1024 * 1024 * 10];
                strBuild = new StringBuilder(256);
                visa32.viPrintf(viSession, ":STOP\n");
                visa32.viPrintf(viSession, ":WAV:MODE RAW\n");
                visa32.viPrintf(viSession, ":WAV:SOURce %s\n",
                                strChan);
                visa32.viPrintf(viSession, ":WAV:RESet\n");
                visa32.viPrintf(viSession, ":WAV:BEGin\n");
                //read buffer to WFM
                streamOut = File.Create(strFile, 10000000);
                wfmStream = new BinaryWriter(streamOut);
                while (true) {
                        //Thread.Sleep( 10000 );
                        visa32.viPrintf(viSession,
                                        ":WAV:STATus?\n");
                        visa32.viScanf(viSession, "%s", strBuild);
                         if (strBuild[0] == 'I') {  //IDLE
                                visa32.viPrintf(viSession,
                                                ":WAV:DATA?\n");
                                visa32.viRead(viSession, wfmBuf,
                                         wfmBuf.Length, out readCnt);
                                //data header #9XXXX...
                                //plus end mark \n
                                readCnt -= 12;
                                readSum += (readCnt);
                                if (readCnt > maxPacket) {
                                        maxPacket = readCnt;
                                }
                                //readTim++;
                                //skip data header #9XXXX...
                                if (readCnt > 0) {
                                        wfmStream.Write(wfmBuf, 11,
                                                        readCnt);
                                }
                                wfmStream.Close();
                                Console.WriteLine("{0}: Read {1} Sum
                                     {2} Max {3}", readTim,
                                     readCnt, readSum,
                                                  maxPacket);
                                return readSum;
                        } else {
                                //READ
                                visa32.viPrintf(viSession,
                                                ":WAV:DATA?\n");
                                visa32.viRead(viSession, wfmBuf,
                                         wfmBuf.Length, out readCnt);
                                //data header #9XXXX...
                                //plus end mark \n
                                readCnt -= 12;
                                readSum += (readCnt);
                                if (readCnt > maxPacket) {
                                        maxPacket = readCnt;
                                }
                                Console.WriteLine("{0}: Read {1} ",
                                                  readTim, readCnt);
                                readTim++;
                                //skip data header #9XXXX...
                                if (readCnt > 0) {
                                        wfmStream.Write(wfmBuf, 11,
                                                        readCnt);
                                }
                        }
                }
                return readSum;
        }
        //initialize VISA
        static bool InitVisa(out Int32 viDef)
        {
                Int32 viError;
                viError = visa32.viOpenDefaultRM(out viDef);
                if (viError != visa32.VI_SUCCESS) {
                        return false;
                } else {
                        return true;
                }
        }
        //to initialize VISA
        static void DeInitVisa(Int32 viDef, Int32 viSession)
        {
                visa32.viClose(viSession);
                visa32.viClose(viDef);
        }
        //connect devices
        static bool ConnectDevice(Int32 viDef, out Int32 viSession)
        {
                Int32 viError;
                Int32 viFindList;
                Int32 viRetCount;
                StringBuilder strRsrc = new StringBuilder(256);
                viError = visa32.viFindRsrc(viDef, "USB?*", out
                                            viFindList,
                                            out viRetCount,
                                            strRsrc);
                if (viRetCount > 0) {
                        viError = visa32.viOpen(viDef,
                                                strRsrc.ToString(),
                                                0, 0, out viSession);
                        if (viError != visa32.VI_SUCCESS) {
                                visa32.viClose(viDef);
                                return false;
                        }
                        return true;
                } else {
                        viSession = 0;
                        return false;
                }
        }
}
}
end()

Rigol Programming Guide

:WAVeform:END

Syntax

:WAVeform:END

Description

Stop the waveform reading.

points(points)

Rigol Programming Guide

:WAVeform:POINts

Syntax

:WAVeform:POINts <point>

:WAVeform:POINts?

Description

Set the number of waveform points to be read. Query the current number of waveform points to be read.

Parameter

Name

Type

Range

Default

<point>

Integer

NORMal: 1 to 1400 MAX: 1 to the number of effective points currently on the screen RAW: 1 to the current maximum memory depth

Explanation

The number of waveform points is limited by the current reading mode of waveform (refer to the :WAVeform:MODE command). Return Format The query returns an integer.

Example

:WAVeform:POINts 600

The query returns 600..

preamble()

Rigol Programming Guide

:WAVeform:PREamble?

Syntax

:WAVeform:PREamble?

Description

Query and return all the waveform parameters.

Return Format

The query returns 10 waveform parameters separated by “,”: <format>,<type>,<points>,<count>,<xincrement>,<xorigin>,<xreference>, <yincrement>,<yorigin>,<yreference>

<format>:

0 (WORD), 1 (BYTE) or 2 (ASC). Refer to the :WAVeform:FORMat command.

<type>:

0 (NORMal), 1 (MAXimum) or 2 (RAW). Refer to the :WAVeform:MODE command.

<points>:

integer between 1 and 56000000. Refer to the :WAVeform:POINts command.

<count>:

the number of averages in average sample mode (refer to the :ACQuire:AVERages command) and 1 in other modes.

<xincrement>:

the time difference between two neighboring points in X direction. Refer to the :WAVeform:XINCrement? command.

<xorigin>:

the time from the trigger point to the “Reference Time” in X direction. Refer to the :WAVeform:XORigin? command.

<xreference>:

the reference time of the data point in X direction. Refer to the :WAVeform:XREFerence? command.

<yincrement>:

the voltage value per unit in Y direction. Refer to the :WAVeform:YINCrement? command.

<yorigin>

the vertical offset relative to the “Vertical Reference Position” in Y direction. Refer to the :WAVeform:YORigin? command.

<yreference>:

the vertical reference position in Y direction. Refer to the :WAVeform:YREFerence? command.

Example

:WAVeform:PREamble?

The query returns 0,0,1400,1,0.000000,-0.000007,0,0.040000,2.000000,127.

Return type

Preamble

reset()

Rigol Programming Guide

:WAVeform:RESet

Syntax

:WAVeform:RESet

Description

Reset the waveform reading.

start(start=1)

Rigol Programming Guide

:WAVeform:STARt

Syntax

:WAVeform:STARt <sta>

:WAVeform:STARt?

Description

Set the start position of internal memory waveform reading. Query the current start position of internal memory waveform reading.

Parameter

Name

Type

Range

Default

<sta>

Integer

NORMal: 1 to 1400 MAX: 1 to the number of effective points currently on the screen RAW: 1 to the current maximum memory depth

Explanation

For the memory depth, refer to the :ACQuire:MDEPth command. The setting of the start position is limited by the current reading mode of the waveform (refer to the :WAVeform:MODE command).

Return Format

The query returns an integer.

Example

:WAVeform:STARt 100

The query returns 100.

status()

Rigol Programming Guide

:WAVeform:STATus?

Syntax

:WAV:STATus?

Description

Query and return the current waveform reading state.

Explanation

IDLE: the waveform reading thread finishes.

READ: the waveform reading thread is running.

n: the current number of waveform points to be read.

Return Format

The query returns IDLE,n or READ,n.

Return type

WaveformStatus

stop(stop)

Rigol Programming Guide

:WAVeform:STOP

Syntax

:WAVeform:STOP <sta>

:WAVeform:STOP?

Description

Set the stop position of internal memory waveform reading. Query the current stop position of internal memory waveform reading.

Parameter

Name

Type

Range

Default

<sta>

Integer

NORMal: 1 to 1400 MAX: 1 to the number of effective points currently on the screen RAW: 1 to the current maximum memory depth

Explanation

For the memory depth, refer to the :ACQuire:MDEPth command. The setting of the stop position is limited by the current reading mode of the waveform (refer to the :WAVeform:MODE command).

Return Format

The query returns an integer.

Example

:WAVeform:STOP 200

The query returns 200.

property x_increment

Rigol Programming Guide

Syntax

:WAVeform:XINCrement?

Description

Query the time difference between two neighboring points of the specified source (refer to the :WAVeform:SOURce command) in X direction and the unit is s.

Return Format

The query returns the time difference in scientific notation.

Example

:WAVeform:XINCrement?

The query returns 1.000000e-08.

Return type

float

property x_origin

Rigol Programming Guide

Syntax

:WAVeform:XORigin?

Description

Query the time from the trigger point to the reference time (refer to the :WAVeform:SOURce command) of the specified source (refer to the :WAVeform:XREFerence? command) in X direction and the unit is s.

Return Format

The query returns the time value in scientific notation.

Example

:WAVeform:XORigin?

The query returns -7.000000e-06.

Return type

float

property x_reference

Rigol Programming Guide

Syntax

:WAVeform:XREFerence?

Description

Query the reference time of the specified source (refer to the :WAVeform:SOURce command) in X direction and the unit is s.

Return Format

The query returns the reference time in integer.

Example

:WAVeform:XREFerence?

The query returns 0.

Return type

float

property y_increment

Rigol Programming Guide

Syntax

:WAVeform:YINCrement?

Description

Query the voltage value per unit of the specified source (refer to the :WAVeform:SOURce command) in Y direction and the unit is the same with the unit of the signal source.

Return Format

The query returns the voltage value in scientific notation.

Example

:WAVeform:YINCrement?

The query returns 4.000000e-02.

Return type

float

property y_origin

Rigol Programming Guide

Syntax

:WAVeform:YORigin?

Description

Query the vertical offset relative to the vertical reference position (refer to the :WAVeform:SOURce command) of the specified source (refer to the :WAVeform:YREFerence? command) in Y direction and the unit is the same with the unit of the signal source.

Return Format

The query returns the offset value in scientific notation.

Example

:WAVeform:YORigin?

The query returns 2.000000e+00.

Return type

float

property y_reference

Rigol Programming Guide

Syntax

:WAVeform:YREFerence?

Description

Query the vertical reference position of the specified source (refer to the :WAVeform:SOURce command) in Y direction and the unit is the same with the unit of the signal source.

Return Format

The query returns the reference position in integer.

Example

:WAVeform:YREFerence?

The query returns 127.

Return type

float

class ds2000.waveform.WaveformStatus(status, points)

Bases: NamedTuple

points: int

Alias for field number 1

status: bool

Alias for field number 0