Im using the python moku api for the moku:pro the get a voltage reading from a certain channel. My goal is to measure over a relatively short time with a comparably low sample rate (something like 100 ms and 100 Sa/s or even 10 Sa/s).
Sadly the Datalogger can not record for shorter than one second, and one forum entry from an employee stated this is because for smaller times it is easier to use the Oscilloscope instrument. I don’t agree with that because the Datalogger allows for a higher sample rate at certain time scales (e.g. the Oscilloscope sampling rate at a 1s time span is 16.3 kSa/s, vs 2.0 MSa/s for the Datalogger which was already stated in the original post) and the Oscilloscope does not allow to set the sampling rate independently of the time span. So if I want to record for 100 ms im stuck with 162 kSa/s from the Oscilloscope.
So this is why I tried the streaming api of the Datalogger as a replacement. However I noticed a few problems that occured. When setting low sample rates like 10 to 100 Sa/s the get_stream_data()
method gets very slow to the point that I have to wait for half a minute only to get three data points. For example inserting a sampling rate of 10 Sa/s into the datalogger_streaming.py
breaks it as the stream ends before the first get_stream_data()
call can be executed. It also seems that calling get_stream_data()
does not return all newly streamed data but only a certain amount. When I call get_stream_data()
and the sleep for 5 s and call get_stream_data()
again I do not recive all points up to 5s which can be verified because the points come with the time since the start of the stream. This might actually be intended behaviour (e.g. just returning 512 points at a time or something like this) but in that case I did not find this in the api documentation.
I also noticed that when using get_stream_data()
the programm sometimes continues to run after the last line/command has executed and can not be interrupted by ctrl+C. Im not sure what causes this but my assumption is that when not all data from the stream was read some subprocess continues to run, which might block the program. In some rare cases I managed to stop it and somehow and got the error:
Exception in thread Thread-3:
...
File "mokucli\converter\targets.py", line 62, in _check_logger_status
OverflowError: sleep length is too large
...
This might be unrelated though I am not sure.
I am using the newest version of mokucli and the moku python library. Python however is not on the newest verion. If anyone has an idea of what is going on or whether I am just completely misunderstanding the api I would appreciate some intel on that.
Thanks