Non-causal of variable threshold algorithm I'm not entirely sure this question belongs here. (Maybe better suited on stackoverflow or theoretical computer science). But here it goes.
I'm reading a paper called. "Time-Frequency Analysis of Heart-Rate Variability". In this paper they discuss a new algorithm to automatically remove artifacts from a signal. The pseudoalgrithm is given:

This is all the information. I was wondering if someone could explain me this (or give his opinion): They do not explicitly explain what a step is, though I assume it is a step of the loop. They say the $u_n$ and $u_m$ depend on deviation of last STEP HR values. My interpretation of these values are that they are the deviation of the previous values which were already accepted. 
Though the problem with this interpretation is that at the start there will only be one value which is accepted which is the intial value, so this means that the second value will be discarded since the deviation will be 0.
I was wondering if someone had another take on this, or a better explanation, because the paper does not give more information than this on the algorithm.
 A: I am putting clarifying questions in the intro to my answer so that they can be addressed in comments, and because I am pretty sure that I can answer this.
Questions:


*

*Is this the source article: https://ieeexplore.ieee.org/document/620503/
Answer so far:
This looks like 3 types of filters on the data.


*

*If the absolute change isn't too big

*If the absolute slope isn't too big

*If the difference from the mean isn't too big


Then accept the value.  Lines 1-3 here relate to lines 2-4 in your pseudocode, I think.
Step means one iteration through the loop.
There is no framework for defining what Un and Um are.  They appear to be heuristic. If it isn't defined, then the procedure isn't fully defined.  You could assume constant, or you could assume EWMA.  You could assume anything, but you could also be wrong.
There is a fun (and much more informative) text on abrupt change detection by Basseville and Nikiforov here: http://people.irisa.fr/Michele.Basseville/kniga/ .  The 1-3 filters are all included in much more depth and detail in the textbook.
