Jump to content
  • 0

Python scope script speed


kojak

Question

Hello @attila

I need fast scope measurement and I found that function dwf.FDwfAnalogInStatus(self.hdwf, c_int(True), byref(status)) takes about 7.4 ms (plus acquisition time). When I set fReadData to false then it took slightly more than acquisition time. Do you think that you can optimize this function to be faster? I also found that this function is blocking even if fReadData is false, is this desirable?

Thank you

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Hi @kojak

Having the fReadData false only the status bytes are read from the device: state, trigger info, buffer pointer, last ADC sample.
With fReadData true the data buffer is also read, for 8k samples 32kB of data, which should take longer.

Link to comment
Share on other sites

Hi @attila

I am getting this times measured by time_ = time.time() before and time_ = time.time() - time_ after call:

dwf.FDwfAnalogInConfigure(self.hdwf, c_bool(False), c_bool(True))

Average 0.312 ms
Mean    0.210 ms
StDev   0.516 ms
Min     0.084 ms
Max     12.434 ms
Over    2619 samples

dwf.FDwfAnalogInStatus(hdwf, c_int(False), byref(status))

Average 0.689 ms
Mean    0.322 ms
StDev   1.363 ms
Min     0.091 ms
Max     14.773 ms
Over    2740 samples

dwf.FDwfAnalogInStatus(hdwf, c_int(True), byref(status))

Average 6.873 ms
Mean    6.794 ms
StDev   1.445 ms
Min     5.389 ms
Max     22.871 ms
Over    2785 samples

dwf.FDwfAnalogInStatusData(hdwf, 0, samples_ch1, 8192)
dwf.FDwfAnalogInStatusData(hdwf, 1, samples_ch2, 8192)

Average 0.231 ms
Mean    0.205 ms
StDev   0.142 ms
Min     0.119 ms
Max     3.727 ms
Over    2555 samples

I do not know how much data is transfered by calling dwf.FDwfAnalogInStatus(hdwf, c_int(True), byref(status)). But if I use only 2 bytes per sample and channel, then I get 32 kB data transfered during 6,8 ms which gives me about 4,6 MB/s. This is good.

But I have an question, do you think that during calling dwf.FDwfAnalogInStatus(hdwf, c_int(False), byref(status)) or another probably new function you can transfer data which is already measured? So during polling whether is conversion finished parts of the data will be transfered. Some kind of Draw while recording option. Finally calling dwf.FDwfAnalogInStatus(hdwf, c_int(True), byref(status)) will assemble parts of data and transfer remaining data from AD.

Link to comment
Share on other sites

Hi @kojak

See the C:/Program Files (x86)/Digilent/WaveFormsSDK/samples/py/AnalogIn_Record.py
In this, the FDwfAnalogInStatus/FDwfAnalogInStatusData returns the newly acquired samples in each loop iteration.
The drawing process can consume much time which could lead to device buffer overflow, losing samples in the loop process...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...