Hi @deonm and welcome to the Joulescope forum!
1 Hz
The Joulescope UI easily allows you select 1 Hz today:
So, that leaves 2.5 Hz and 0.5 Hz from your request.
2.5 Hz
The JS220 supports computing statistics over any arbitrary number of samples 1,000 (1 kHz) to 1,000,000 (1 Hz). Although the UI constrains choices to the standard 1, 2, 5 sequence, the JS220 does not.
I don’t see a reason to break the standard 1, 2, 5 sequence to add 2.5 Hz to the UI. I could see adding a “custom” setting, but that does not exist today. If you want 2.5 Hz today, you can hack the UI source code to add 2.5 Hz. You first have to clone the pyjoulescope_ui git repo and get it running in Python on your host computer. You can follow the instructions in the README.md.
Modify the joulescope_ui/devices/jsdrv/js220.py file:
- Change
statistics_frequency dtype to float
- Add [2.5, ‘2.5 Hz’] as an option
- Change
scnt = 1_000_000 // value to scnt = int(1_000_000 / float(value))
You can then select 2.5 Hz, like this:
Here is the diff:
diff --git a/joulescope_ui/devices/jsdrv/js220.py b/joulescope_ui/devices/jsdrv/js220.py
index 92b03cc..d57a41b 100644
--- a/joulescope_ui/devices/jsdrv/js220.py
+++ b/joulescope_ui/devices/jsdrv/js220.py
@@ -176,7 +176,7 @@ _SETTINGS_CLASS = {
'default': 1_000_000,
},
'statistics_frequency': {
- 'dtype': 'int',
+ 'dtype': 'float',
'brief': N_('Statistics frequency'),
'detail': N_("""This setting controls the output frequency for
the statistics data that is displayed in the
@@ -188,6 +188,7 @@ _SETTINGS_CLASS = {
[20, '20 Hz'],
[10, '10 Hz'],
[5, '5 Hz'],
+ [2.5, '2.5 Hz'],
[2, '2 Hz'],
[1, '1 Hz'],
],
@@ -746,7 +747,7 @@ class Js220(Device):
elif topic == 'signal_frequency':
self._driver_publish('h/fs', int(value), timeout=0)
elif topic == 'statistics_frequency':
- scnt = 1_000_000 // value
+ scnt = int(1_000_000 / float(value))
self._driver_publish('s/stats/scnt', scnt, timeout=0)
elif topic == 'target_power':
self._current_range_update()
0.5 Hz
Adding [0.5, '0.5 Hz'] like we did with 2.5 Hz does not work, since the JS220 limits itself to a maximum window of 1,000,000 samples. This ensures that the accumulation stays within the numerical precision used by the JS220. However, you can combine statistics on the host side, as the accrue feature does today. Neither the Joulescope driver, Joulescope UI, nor Multimeter widget has a combine N statistics feature today, but downsample_logging.py does. Does 1 Hz in the UI with the option to record at 0.5 Hz using downsample_logging.py work for you?