Skip to main content
. 2023 Jan 5;16:1064313. doi: 10.3389/fnbot.2022.1064313

Algorithm 3.

Post refinement to improve robustness.

1:  function POST REFINEMENT(pext)
2:   ppastpext(1)
3:   pcurrent ← −1
4:   count ← 0
5:   idxbgn ← 1
6:   idxfin ← 0
7:   pre(1:T) ← −1
8:   for t = 1 to T do
9:   pcurrent = pext(t)
10:   if pcurrentppast then
11:   idxfin = t−1
12:   if count>phist then
13:   pre(idxbgn:idxfin) = ppast
14:   idxbgn = t
15:   count = 1
16:   else
17:   pre(idxbgn:idxfin) = pcurrent
18:   count = count+1
19:   end if
20:   else
21:   count = count+1
22:   end if
23:   ppast = pcurrent
24:   end for
25:   return pre
26:  end function