def _timeBase(self, settings, timebase): assert type(timebase) is int _timeInterval = ctypes.c_int32() _timeUnits = ctypes.c_int32() _oversample = ctypes.c_int16(settings['oversample']) _maxSamples = ctypes.c_int32() self.status["getTimebase"] = ps.ps2000_get_timebase( self.chandle, timebase, settings['noSamples'], ctypes.byref(_timeInterval), ctypes.byref(_timeUnits), _oversample, ctypes.byref(_maxSamples)) assert_pico2000_ok(self.status["getTimebase"]) timeIntervalSeconds = 1e-9 * _timeInterval.value out = { 'sampleRate': 1. / timeIntervalSeconds, 'noSamples': _maxSamples.value, 'timeIntervalSeconds': timeIntervalSeconds, '_timeUnits': _timeUnits } return out
maxSamples = preTriggerSamples + postTriggerSamples # Get timebase information # handle = chandle # timebase = 8 = timebase # no_of_samples = maxSamples # pointer to time_interval = ctypes.byref(timeInterval) # pointer to time_units = ctypes.byref(timeUnits) # oversample = 1 = oversample # pointer to max_samples = ctypes.byref(maxSamplesReturn) timebase = 8 timeInterval = ctypes.c_int32() timeUnits = ctypes.c_int32() oversample = ctypes.c_int16(1) maxSamplesReturn = ctypes.c_int32() status["getTimebase"] = ps.ps2000_get_timebase(chandle, timebase, maxSamples, ctypes.byref(timeInterval), ctypes.byref(timeUnits), oversample, ctypes.byref(maxSamplesReturn)) assert_pico2000_ok(status["getTimebase"]) # Run block capture # handle = chandle # no_of_samples = maxSamples # timebase = timebase # oversample = oversample # pointer to time_indisposed_ms = ctypes.byref(timeIndisposedms) timeIndisposedms = ctypes.c_int32() status["runBlock"] = ps.ps2000_run_block(chandle, maxSamples, timebase, oversample, ctypes.byref(timeIndisposedms)) assert_pico2000_ok(status["runBlock"]) # Check for data collection to finish using ps5000aIsReady ready = ctypes.c_int16(0) check = ctypes.c_int16(0)