Output example
tp = [ 2.2, 2.4, 2.5, 2.6 ]
Looking at this, the closest value is 2.2 or 2.4 w.r.t t1
2.2 = period`_arr(i1, i2, i3, 4, 5, i6, i7)
2.4 = period`_arr(i1, i2, i3, 3, 1, i6, i7)
tn = [ 5.2, 5.4, 7.5, 5.8 ]
Looking at this, the closest value is 5.4 or 5.8 w.r.t t2
5.4 = period`_arr(i1, i2, i3, 1, 2, i6, i7)
5.8 = period`_arr(i1, i2, i3, 4, 5, i6, i7)
so i should choose 2.2 and 5.8 as the close c_tp and c_tn respectively
since the the indices i4 of p = i4 of n and i5 of p = i5 of n. the other i values can take any value