1408
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
40
Programming Examples
1 : "PEAK",
2 : "AVERage",
3 : "HRESolution",
}
(
wav_form,
acq_type,
wfmpts,
avgcnt,
x_increment,
x_origin,
x_reference,
y_increment,
y_origin,
y_reference
) = do_query_numbers(":WAVeform:PREamble?")
print "Waveform format: %s" % wav_form_dict[wav_form]
print "Acquire type: %s" % acq_type_dict[acq_type]
print "Waveform points desired: %d" % wfmpts
print "Waveform average count: %d" % avgcnt
print "Waveform X increment: %1.12f" % x_increment
print "Waveform X origin: %1.9f" % x_origin
print "Waveform X reference: %d" % x_reference
# Always 0.
print "Waveform Y increment: %f" % y_increment
print "Waveform Y origin: %f" % y_origin
print "Waveform Y reference: %d" % y_reference
# Always 125.
# Get numeric values for later calculations.
x_increment = do_query_number(":WAVeform:XINCrement?")
x_origin = do_query_number(":WAVeform:XORigin?")
y_increment = do_query_number(":WAVeform:YINCrement?")
y_origin = do_query_number(":WAVeform:YORigin?")
y_reference = do_query_number(":WAVeform:YREFerence?")
# Get the waveform data.
data_bytes = do_query_ieee_block(":WAVeform:DATA?")
nLength = len(data_bytes)
print "Number of data values: %d" % nLength
# Open file for output.
strPath = "c:\scope\data\waveform_data.csv"
f = open(strPath, "w")
# Output waveform data in CSV format.
for i in xrange(0, nLength - 1):
time_val = x_ (i * x_increment)
voltage = (data_bytes[i] - y_reference) * y_inc y_origin
f.write("%E, %f\n" % (time_val, voltage))
# Close output file.
f.close()
print "Waveform format BYTE data written to %s." % strPath
# =========================================================