User manual

Table Of Contents
Part 2: Automation Programming Reference
Accessing Out.Result Objects
To read a single measured property of a waveform, place the object (or its shortcut) into a variable:
numsamples = h.Acquisition.C1.Out.Result.Samples
print(numsamples)
To access the entire waveform, use the DataArray object. For example, to plot the C1 waveform:
wave = h.Acquisition.C1.Out.Result.DataArray
plt.plot(wave)
plt.show()
With ActiveDSO
For more examples, see the Technical Brief: Using Python with ActiveDSO for Remote Communication.
Connect and Disconnect
Connecting to the oscilloscope using ActiveDSO similarly calls the win32com.client then instantiates the
ActiveDSO control "LeCroy.ActiveDSOCtrl.1", here aliased as "scope". The MakeConnection string makes
the remote connection to the oscilloscope:
import win32com.client
scope=win32com.client.Dispatch("LeCroy.ActiveDSOCtrl.1")
scope.MakeConnection("<connection string>")
The <connection string> is whatever you would normally enter in the ActiveDSO MakeConnection method
to specify the interface, for example "IP: 172.0.0.31".
To disconnect, send:
scope.Disconnect()
Accessing Control Variables
For CVARs that you can read or write (yellow folder objects), use WriteString to send commands. The
<command string> is the remote command, either in the legacy 488.2 format, or an Automation control
sent within the VBS command.
scope.WriteString("<command string>", <Boolean EOI>)
For example, to set the C1 V/div to 20 mV using Automation, you would send:
scope.WriteString("""VBS 'app.Acquisition.C1.VDIV=".02 V" ' """, 1)
Note: The triple quotes around the command string are required because the double quotes
around the value ".02 V" are part of the Automation control embedded within the VBS command.
Otherwise, Python would interpret the first double quote as the end of the command string.
2-51