910 Keysight InfiniiVision DSOX1204A/G Oscilloscopes Programmer's Guide
36 Programming Examples
# Download the screen image.
# --------------------------------------------------------
myScope.WriteLine(":HARDcopy:INKSaver OFF")
# Get the screen data.
myScope.WriteLine(":DISPlay:DATA? PNG, COLor")
image_bytes = myScope.ReadLineBinaryBlockOfByte()
nLength = len(image_bytes)
fStream = File.Open("screen_image.png", FileMode.Create)
fStream.Write(image_bytes, 0, nLength)
fStream.Close()
print "Screen image written to screen_image.png."
# Download waveform data.
# --------------------------------------------------------
# Set the waveform points mode.
myScope.WriteLine(":WAVeform:POINts:MODE RAW")
myScope.WriteLine(":WAVeform:POINts:MODE?")
qresult = myScope.ReadLine()
print "Waveform points mode: %s" % qresult
# Get the number of waveform points available.
myScope.WriteLine(":WAVeform:POINts?")
qresult = myScope.ReadLine()
print "Waveform points available: %s" % qresult
# Set the waveform source.
myScope.WriteLine(":WAVeform:SOURce CHANnel1")
myScope.WriteLine(":WAVeform:SOURce?")
qresult = myScope.ReadLine()
print "Waveform source: %s" % qresult
# Choose the format of the data returned:
myScope.WriteLine(":WAVeform:FORMat BYTE")
myScope.WriteLine(":WAVeform:FORMat?")
qresult = myScope.ReadLine()
print "Waveform format: %s" % qresult
# Display the waveform settings from preamble:
wav_form_dict = {
0 : "BYTE",
1 : "WORD",
4 : "ASCii",
}
acq_type_dict = {
0 : "NORMal",
1 : "PEAK",
2 : "AVERage",
3 : "HRESolution",
}
myScope.WriteLine(":WAVeform:PREamble?")
(
wav_form, acq_type, wfmpts, avgcnt, x_increment, x_origin,
x_reference, y_increment, y_origin, y_reference
) = string.split(myScope.ReadLine(), ",")