diff options
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/hardware/scope/sds1104x.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py index 493be48..657f599 100644 --- a/qolab/hardware/scope/sds1104x.py +++ b/qolab/hardware/scope/sds1104x.py @@ -104,14 +104,21 @@ class SDS1104X(ScopeSCPI): # FP = 1 corresponds to the second data point self.write(cstr) + trRaw = Trace(f'Ch{chNum}') + qstr = f'C{chNum}:WAVEFORM? DAT2' - wfRaw=self.query_binary_values(qstr, datatype='b', header_fmt='ieee', container=np.array, chunk_size=(Npnts+100)) # expected full reply: 'C1:WF DAT2,#9000000140.........' - trRaw = Trace(f'Ch{chNum}') - trRaw.values = wfRaw.reshape(wfRaw.size,1) - if decimate and sparsing != 1: - numtaps = 3; # not sure it is the best case - trRaw.values = scipy.signal.decimate(trRaw.values, sparsing, 3, axis=0) + try: + wfRaw=self.query_binary_values(qstr, datatype='b', header_fmt='ieee', container=np.array, chunk_size=(Npnts+100)) + trRaw.values = wfRaw.reshape(wfRaw.size,1) + if decimate and sparsing != 1: + numtaps = 3; # not sure it is the best case + trRaw.values = scipy.signal.decimate(trRaw.values, sparsing, 3, axis=0) + except ValueError as err: + # most likely we get crazy number of points + # self.read() # flushing the bogus output of previous command + print(f'Error: getting waveform failed for {qstr=}') + wfRaw=np.array([]) trRaw.config['unit'] = 'Count' trRaw.config['tags']['Decimate'] = decimate return(trRaw, availableNpnts, Npnts) @@ -226,7 +233,7 @@ if __name__ == '__main__': instr=rm.open_resource('TCPIP::192.168.0.62::INSTR') scope = SDS1104X(instr) print(f'ID: {scope.idn}') - print(f'Ch1 mean: {scope.mean(1)}') + # print(f'Ch1 mean: {scope.mean(1)}') print(f'Ch1 available points: {scope.getAvailableNumberOfPoints(1)}') print(f'Sample Rate: {scope.getSampleRate()}') print(f'Time per Div: {scope.getTimePerDiv()}') |