Hi guys,
Writing software to control a spectrometer we are building and I'm having trouble getting math command data in from the oscilloscope (DPO7354).
I have written the math functions (which correct display in the math function group on the oscilloscope thus I know they are being written) as:
scope.write('MATH1:define "avg(CH1)"')
scope.write('MATH2:define "spectralMag(MATH1)"')
then, I set the source channel:
scope.write('data:source MATH2')
but I get a timeout error that doesn't occur when I just read from CH1.
Here's (most) code:
scope.write('MATH1:define "avg(CH1)"')
scope.write('MATH2:define "spectralMag(MATH1)"')
#io config
scope.write('header 0')
scope.write('data:encdg SRIBINARY')
scope.write('data:source CH1') # channel
scope.write('data:start 1') # first sample
scope.write('HORIZONTAL:MODE:SCALE 200e-9')
print(scope.query('horizontal:recordlength?'))
record = int(scope.query('horizontal:recordlength?'))
print(record)
scope.write('data:stop {}'.format(record)) # last sample
scope.write('wfmoutpre:byt_n 1') # 1 byte per sample
# acq config
scope.write('acquire:state 0') # stop
scope.write('acquire:stopafter SEQUENCE') # single
scope.write('acquire:state 1') # run
t5 = time.perf_counter()
r = scope.query('*opc?') # sync
t6 = time.perf_counter()
print('acquire time: {} s'.format(t6 - t5))
I get a timeout error when I try to write the .bin data:
#bin_wave = scope.query_binary_values('curve?', datatype='b', container=np.array)
bin_wave = scope.write('CURVE?')
The commented out line works for CH1, but nothing I try works for MATH2.