Hi @jst and welcome to the forum! This forum is the perfect place for these questions.
Capturing data to a JLS file is not hard, but it’s not trivial either. I just added a capture_jls.py example that records at full rate until you press CTRL-C.
In read_by_callback.py, the StreamProcess.stream_notify method gets called when new data is available. The “self._buffer” is part of the implementation to store up to the first length samples. Your code will do whatever you want, but likely will call stream_buffer.samples_get to get the most recent data.
The reduction frequencies are enumerated as a parameter. These values allow for simple and convenient UI selection. You could hack the code to define you own reductions here. In downsample_logging.py, you could specify a frequency of 100 with the command-line option:
--downsample 4
to give 25 Hz. 6 Hz requires a factor of 3, which does not divide evenly into any of the predefined downsampling frequencies. Does this simplified selection matter for your application?
In general, weakrefs allow a way to break cycles of circular references so that the Python garbage collector can do its job. In this case, it prevents a circular reference from LoggerDevice back to its parent, Logger, which also maintains a reference to LoggerDevice. Since the entire program exits together, removing the weakref would likely not affect behavior. However, it’s good practice to maintain clean child-parent relationships where the part holds the child reference, but not the other way around.