JS220 capture.py capture duration

Hi,
I have used joulescope-0.9.7 and the pyjoulescope_examples\bin\capture.py to record data using the JS110. I passed: capture(duration_s=int(self.duration), frequency=int(self.frequency), filename=str(self.configuration["JLSFilename"]), serial_number=None,jls_ver=int(2), signals=str("current"))
When I recorded 1 second the Joulescope UI did show 1s.

Now I have updated to joulescope-1.1.9.
When I do a record using JS110 for 1s:
duration of the file seen in JoulescopeUI: 1s
When I do a record using JS220 for 1s:
duration of the file seen in JoulescopeUI: 0.5s

In the joulescope.v1.js220.py the _on_reduction_frequency is 1000000 with the remark that the USB is the bottleneck. Also mentioned in https://forum.joulescope.com/t/js220-duration-argument-not-working/494/14.

Is there a possibility to capture in 2Msps using the JS220?
(What is the minimal version of Joulescope for JS220?)
BR

Lukas

Hi @lukGWF ! While your Joulescope JS220 does sample at 2 Msps, it performs downsampling onboard to reduce the rate to 1 Msps. It downsamples while maintaining the 300 kHz bandwidth with no loss of useful information. The JS110 had some quirks with response over frequency. The JS220 significantly improved frequency response, and you are not missing any usable information due to this downsampling.

I took a closer look at the code, and the JS220 wrapper in pyjoulescope does accept a sampling frequency of 2000000 and forces it to 1000000. However, it then does not update the sampling_frequency parameter, which informs the JLS recording. So, you get the right number of samples for the duration, but the JLS file reports 2 Msps rather than 1 Msps. The quick fix is to omit --frequency or set it to 1000000. We will fix this in pyjoulescope.

The capture.py script was never great about accurately capturing short durations. It uses host-based elapsed time rather than inspecting the incoming samples received, so you will often find that the captured data is slighly shorter than requested.