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

**URL:** <https://discourse.julialang.org/t/modelling-events-in-a-time-series-with-random-interval-between-heart-beats-with-turing-jl/112653>\
**Category:** Probabilistic Programming\
**Tags:** question, turing\
**Created:** [April 7, 2024, 8:02pm UTC](https://discourse.julialang.org/t/modelling-events-in-a-time-series-with-random-interval-between-heart-beats-with-turing-jl/112653 "2024-04-07T20:02:53Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [May 13, 2024, 9:38pm UTC](https://discourse.julialang.org/t/modelling-events-in-a-time-series-with-random-interval-between-heart-beats-with-turing-jl/112653/16 "2024-05-13T21:38:59Z")

</div>

I just took another look at the signal and found it to be quite similar to extracting the period between [tachometer signals](https://discourse.julialang.org/t/extract-rpm-from-tachometer-signal/77329/12). If you then want to process the signal further fitting a spline through the heart rate is discussed [here](https://discourse.julialang.org/t/smoothing-interpolation-for-tachometer-data/56117/16).

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.

---

_[View the full topic](https://discourse.julialang.org/t/modelling-events-in-a-time-series-with-random-interval-between-heart-beats-with-turing-jl/112653)._
