Modelling events in a time-series with random interval between (heart beats) with Turing.jl

I just took another look at the signal and found it to be quite similar to extracting the period between tachometer signals. If you then want to process the signal further fitting a spline through the heart rate is discussed here.

When the signal is negative there seems to be a threshold value where there is only one crossing per heartbeat.

This type of method can be enhanced using a hold-off value, where a threshold crossing is not counted until the signal is past the hold-off period.

You can also dynamically modify threshold values such that the threshold is a fraction of the signal peak values for the last few heartbeats.

Start simple and enhance the algorithm as necessary.