3. Using the DS1054Z ClassΒΆ

The Class ds1054z.DS1054Z is a very easy and convenient way to interact with your oscilloscope programmatically.

First, import the class from the ds1054z module:

>>> from ds1054z import DS1054Z

Now you’re able to instantiate the class providing the host you want to connect to. This can be an IP address or a VISA resources string:

>>> scope = DS1054Z('')
>>> # or
>>> scope = DS1054Z('TCPIP::')

More information on the resources string can be found in the README of the vxi11 package which ds1054z.DS1054Z uses to connect to the scope.

You can then check the identification of the device by accessing its idn property:

>>> print(scope.idn)

which will print something like RIGOL TECHNOLOGIES,DS1054Z,DS1ZA116171318,00.04.03.

To send a command to the oscilloscope, use the ds1054z.DS1054Z.write() method. Here we start the scope:

>>> scope.write(":RUN")

Note that for those very basic functions there might already be a convenience function present. In this case it’s called ds1054z.DS1054Z.run():

>>> scope.run()

If you want to read back values from the scope, use the ds1054z.DS1054Z.query() method:

>>> scope.query(":ACQuire:SRATe?")

Please note that the answer is given as a (unicode) string here. You still need to convert the value to a float yourself.

>>> float(scope.query(":ACQuire:SRATe?"))