Closed EmilMelgaard closed 3 months ago
Full log: joulescope_log.txt
Hi @EmilMelgaard - When used this way, the sample buffer needs to be large enough for the read and at least one sample chunk. An extra second should be more than enough. Does changing this line fix the issue?
device.buffer_duration = t + 1
If you are making measurements on the order of seconds, there is also no need to resize the buffer. The default 30 second buffer should work just fine.
Hi @mliberty1, Thank you, adding a second seems to fix the issue as far as I can see. In my real code I measure up to four minutes, I just reduced the time in the example to reduce the time to reproduce :-)
Great! Note that the buffer requires about 15 MB/s, and then provides a copy which doubles the RAM requirement. I would not recommend going much beyond 4 minutes duration using this method. For longer captures, you can save directly to your own buffer to avoid the copy. See read_by_callback.py and read_by_pyjoulescope_driver.py. For even longer captures, just record to JLS first.
I will close this issue, but feel free to reopen if you still have concerns!
Sometimes I get a ValueError when I change the buffer duration to match the sampling duration just before reading.
I'm using python 3.11 64-bit, joulescope version 1.1.15, pyjoulescope-driver version 1.5.4 and a Joulescope JS220.
Example of the error:
Example code to reproduce the error:
I don't get the error the same time every run, but I have attached a log of a full run with info logging enabled.