diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-28 21:22:34 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-28 21:22:34 -0500 |
commit | 32e67836d7012a0420d78d32908c7660ac0bfc8c (patch) | |
tree | ebdc948cc45c553c738695d089db2611fe39549e | |
parent | f5a860c6677841972456a7d93a0c72552894a231 (diff) | |
download | qolab-32e67836d7012a0420d78d32908c7660ac0bfc8c.tar.gz qolab-32e67836d7012a0420d78d32908c7660ac0bfc8c.zip |
added Trigger Mode capabilty, stop release scope before getting all traces
-rw-r--r-- | qolab/hardware/scope/__init__.py | 20 | ||||
-rw-r--r-- | qolab/hardware/scope/sds1104x.py | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/qolab/hardware/scope/__init__.py b/qolab/hardware/scope/__init__.py index d4e31a8..8c022c4 100644 --- a/qolab/hardware/scope/__init__.py +++ b/qolab/hardware/scope/__init__.py @@ -28,13 +28,33 @@ class Scope(BasicInstrument): def getTrace(self, chNum, availableNpnts=None, maxRequiredPoints=None, decimate=True): # Should work with minimal arguments list # but might be faster if parameters provided: less IO requests + # old_trg_mode = self.getTriggerMode() + # self.setTriggerMode('STOP'); # to get synchronous channels warnings.warn( 'this function is not implemented' ) + # if old_trg_mode != "STOP": + # short speed up here with this check + # self.setTriggerMode(old_trg_mode) + + def getTriggerMode(self): + # we expect NORM, AUTO, SINGLE, STOP + warnings.warn( 'this function is not implemented' ) + + def setTriggerMode(self, mode): + # we expect NORM, AUTO, SINGLE, STOP + warnings.warn( 'this function is not implemented' ) + def getAllTraces(self, availableNpnts=None, maxRequiredPoints=None, decimate=True): allTraces=TraceSetSameX('scope traces') allTraces.config['tags']['DAQ']=self.getConfig() + old_trg_mode = self.getTriggerMode() + self.setTriggerMode('STOP'); # to get synchronous channels for chNum in range(1, self.numberOfChannels+1): allTraces.addTrace( self.getTrace(chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints, decimate=decimate) ) + # restore scope to the before acquisition mode + if old_trg_mode != "STOP": + # short speed up here with this check + self.setTriggerMode(old_trg_mode) return( allTraces ) def plot(self, **kwargs): diff --git a/qolab/hardware/scope/sds1104x.py b/qolab/hardware/scope/sds1104x.py index 540e800..da7fd65 100644 --- a/qolab/hardware/scope/sds1104x.py +++ b/qolab/hardware/scope/sds1104x.py @@ -187,13 +187,29 @@ class SDS1104X(ScopeSCPI): t.config['tags']['Npnts'] = availableNpnts t.config['tags']['Sparsing'] = sparsing return(t) + + def getTriggerMode(self): + # we expect NORM, AUTO, SINGLE, STOP + res = scope.query('TRIG_MODE?') + # res is in the form 'TRMD AUTO' + return res[5:] + + def setTriggerMode(self, val): + # we expect NORM, AUTO, SINGLE, STOP + res = scope.write(f'TRIG_MODE {val}') def getTrace(self, chNum, availableNpnts=None, maxRequiredPoints=None, decimate=True): + old_trg_mode = self.getTriggerMode() + self.setTriggerMode('STOP'); # to get synchronous channels wfVoltage, availableNpnts = self.getWaveform( chNum, availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints, decimate=decimate) t = self.getTimeTrace(availableNpnts=availableNpnts, maxRequiredPoints=maxRequiredPoints) tr = TraceXY( f'Ch{chNum}' ) tr.x = t tr.y = wfVoltage + # restore scope to the before acquisition mode + if old_trg_mode != "STOP": + # short speed up here with this check + self.setTriggerMode(old_trg_mode) return( tr ) |