Skip to content

Commit b8bad23

Browse files
committed
Add paragraph verifying closed-loop latency
- how to measure latency using the devices that will be used during the actual experiment rather than loadtester
1 parent 4654c9a commit b8bad23

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

articles/tutorials/tune-readsize.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ times can be achieved.
1111

1212
> [!NOTE]
1313
> Performance will vary based on your computer's capabilities and your results
14-
> might differ from those presented below. The computer used to create this tutorial
15-
> has the following specs:
14+
> might differ from those presented below. The computer used to create this
15+
> tutorial has the following specs:
1616
>
1717
> - CPU: Intel i9-12900K
1818
> - RAM: 64 GB
@@ -389,11 +389,37 @@ single correct value for `ReadSize` that is adequate for all experiments. The
389389
diversity of experiments (in particular, the wide range at which they produce
390390
data) requires a range of `ReadSize` values.
391391

392-
Last, in this tutorial, there was minimal computational load imposed by
393-
the data processing workflow itself. In most applications, some processing is performed on the
394-
data to generate the feedback signal. It's important to take this into account
395-
when tuning your system and potentially modifying the workflow to perform
396-
computations on incoming data in order to account for the effect of
392+
Last, in this tutorial, there was minimal computational load imposed by the
393+
workflow used in this tutorial. In most applications, some processing is
394+
performed on the data to generate the feedback signal. It's important to take
395+
this into account when tuning your system and potentially modifying the workflow
396+
to perform computations on incoming data in order to account for the effect of
397397
computational demand on closed loop performance.
398398

399+
### Measuring Latency in Actual Experiment
400+
401+
After tuning `ReadSize`, it is important to experimentally verify the latencies
402+
using the actual devices in your experiment. For example, if your feedback
403+
involves toggling ONIX's digital output (which in turn toggles a stimulation
404+
device like a [Stimjim](https://github.com/open-ephys/stimjim) or a [RHS2116
405+
external
406+
trigger](xref:OpenEphys.Onix1.ConfigureRhs2116Trigger.StimulusTrigger)), loop
407+
that digital output signal back into one of ONIX's digital inputs. This enables
408+
you to save when the feedback physically occurred. This can be used to measure
409+
your feedback latency by taking the difference between the clock count when the
410+
trigger condition occurred and the clock count when the feedback signal was
411+
received by ONIX.
412+
413+
You might wonder: why use the LoadTester device if I can measure latency using
414+
the actual devices that I intend to use in my experiment? The benefit of the
415+
LoadTester device is that you're able to collect at least tens of thousands of
416+
latency samples to plot in a histogram in a short amount of time. Trying to use
417+
digital I/O to take as many latency measurements in a similar amount of time can
418+
render your latency measurements inaccurate for the actual experiment you intend
419+
to perform. In particular, toggling digital inputs faster necessarily increases
420+
the total data throughput of <xref:OpenEphy.Onix1.DigitalInputData>. If the data
421+
throughput of `DigitalInputData` significantly exceeds what is required for your
422+
experiment, the latency measurements will not reflect the latencies you will
423+
experience during the actual experiment.
424+
399425
<!-- ## Tuning `ReadSize` with Real-Time Computation -->

0 commit comments

Comments
 (0)