def runBlock(self, scope, **kwargs): settings = {} for key, current_value in self.settings.items(): settings[key] = kwargs[key] if key in kwargs else current_value check_kwargs_scope(**kwargs) _noSamples = int(scope.settings['noSamples']) _timebase = scope.settings['timebase'] _timeIndisposeMs = ctypes.c_int32() _oversample = ctypes.c_int16(scope.settings['oversample']) #additional callback options here, use isready instead self.status["runBlock"] = ps.ps2000_run_block( self.chandle, _noSamples, _timebase, _oversample, ctypes.byref(_timeIndisposeMs)) assert_pico2000_ok(self.status["runBlock"]) self.settings = settings
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) while ready.value == check.value: status["isReady"] = ps.ps2000_ready(chandle) ready = ctypes.c_int16(status["isReady"]) # Create buffers ready for data bufferA = (ctypes.c_int16 * maxSamples)() bufferB = (ctypes.c_int16 * maxSamples)() # Get data from scope # handle = chandle