I have problem with following function "scopeGrab", occasionally I receive 1 sample less than number of time samples (i.e voltage = 3839 and time = 3840).
The code I'm using:
self.scope= usb.tmc('/dev/usbtmc0')
self.scope.write(":WAVEFORM:POINTS 5000")
def scopeGrab(self):
time.sleep(1);
self.scope.write(":CHANnel1:OFFSet?")
self.yoff = float(self.scope.read(20))
self.scope.write(":WAVEFORM:FORMAT ASCII");
self.scope.write(":VIEW CHANNEL1")
self.scope.write(":DIGITIZE CHANNEL1")
self.scope.write(":WAVEFORM:DATA?")
self.tmp=self.scope.read(5)
self.numstr=self.scope.read(5)
self.stringData=self.scope.read(int(self.numstr))
self.normdata = np.fromstring(self.stringData,sep=",")-self.yoff;
self.scope.write(":RUN")
return self.normdata
It happens when the number of bytes to be transmitted equals to 53745 instead of 53759.
I'm wondering what could be the reason for that and how to fix it?
I read in the Programmer's Guide page 639, it says the data can be clipped due to the "Hole".
Two thoughts/questions:
1. Can you post a scope screenshot of when this happens? If you don't want to post it publicly, you can email it to me at connectivity.support@keysight.com
2. Can you reproduce this was a standard signal like a Sine wave? If so, I could try to reproduce it on my side.