Thank you @attila for the feedback. However, I do not seem to get the desired sample rate in such a burst mode. Here's the approach I'm using (based on examples):
#set up acquisition
dwf.FDwfAnalogInFrequencySet(hdwf, c_double(10000000.0))
dwf.FDwfAnalogInBufferSizeSet(hdwf, c_int(1000000))
dwf.FDwfAnalogInChannelEnableSet(hdwf, c_int(-1), c_int(1))
dwf.FDwfAnalogInChannelRangeSet(hdwf, c_int(-1), c_double(5))
dwf.FDwfAnalogInAcquisitionModeSet(hdwf, acqmodeSingle)
dwf.FDwfAnalogInRecordLengthSet(hdwf, 1000)
dwf.FDwfAnalogInBuffersSet(hdwf, 100)
dwf.FDwfAnalogInTriggerAutoTimeoutSet(hdwf, 0) # disable auto trigger
dwf.FDwfAnalogInTriggerSourceSet(hdwf, trigsrcDetectorAnalogIn); # one of the analog in channels
dwf.FDwfAnalogInTriggerTypeSet(hdwf, trigtypeEdge)
dwf.FDwfAnalogInTriggerChannelSet(hdwf, 0) # 1nd channel
dwf.FDwfAnalogInTriggerLevelSet(hdwf, c_double(1.0)) # V
dwf.FDwfAnalogInTriggerConditionSet(hdwf, DwfTriggerSlopeFall)
dwf.FDwfAnalogInTriggerPositionSet(hdwf, 0)
time.sleep(2)
print("Starting oscilloscope")
dwf.FDwfAnalogInConfigure(hdwf, c_int(1), c_int(1))
tStartTotal = time.time()
for cFrame in range(0, 10):
tStartFrame = time.time()
while True:
dwf.FDwfAnalogInStatus(hdwf, c_int(1), byref(sts))
if sts.value == DwfStateDone.value:
break
time.sleep(0.001)
print("Acquisition done")
tEndWait = time.time()
dwf.FDwfAnalogInStatusData(hdwf, 0, rgdSamples, nSamples) # get channel 1 data
tEndGet = time.time()
#plot window
dc = 0 #sum(rgdSamples)/len(rgdSamples)
print(f"Time wait={tEndWait-tStartFrame}, total={tEndGet-tStartFrame}")
tEndTotal = time.time()
tTimeOverall = tEndTotal - tStartTotal
print(f"Time overall={tTimeOverall}, {tTimeOverall/nFrames} per each of {nFrames} frames, {nFrames*nSamples/tTimeOverall/1000000} MS/s")
dwf.FDwfDeviceCloseAll()
plt.plot(numpy.fromiter(rgdSamples[:6000], dtype=float))
plt.show()
This outputs:
...
Acquisition done
Time wait=0.1982564926147461, total=0.2032620906829834
Time overall=2.1467978954315186, 0.21467978954315187 per each of 10 frames, 4.658100336915946 MS/s
1. Acquisition time is about 0.2 sec for 1M samples at 10MS/s, not 0.1 sec. Without AnalogInBuffersSet it is even slower.
2. Also, it looks that the acquisition is continuous for 1M samples, not 1000 waveforms 1000 samples each. I try to set AnalogInRecordLengthSet for that, but with no success.
How do I record by 1000 samples, and then transfer in larger batches?