1111def estimate_ntp_and_tr (phys_in , thr = None , ci = 1 ):
1212 """
1313 Find groups of trigger in a spiky signal like the trigger channel signal.
14+
15+ Parameters
16+ ----------
17+ phys_in : BlueprintInput object
18+ A BlueprintInput object containing a physiological acquisition
19+ thr : None, optional
20+ The threshold for automatic spike detection. Default is to use the average of
21+ the signal.
22+ ci : int or float, optional
23+ Confidence Interval (CI) to use in the estimation of the trigger clusters. The
24+ cluster algorithm considers triggers with duration (in samples) within this CI
25+ as part of the same group, thus the same. If CI is an integer, it will consider
26+ that amount of triggers. If CI is a float and < 1, it will consider that
27+ percentage of the trigger duration. CI cannot be a float > 1. Default is 1.
28+ Change to .25 if there is a CMRR DWI sequence or when recording sub-triggers.
29+
30+ Returns
31+ -------
32+ ntp
33+ The list of number of timepoints found for each take.
34+ tr
35+ The list of corresponding TR, computed as average samples per group / frequency.
36+
37+ Raises
38+ ------
39+ Exception
40+ If it doesn't find at least a group.
41+ ValueError
42+ If CI is a float above 1 or if it is not an int or a float.
1443 """
1544 LGR .info ('Running automatic clustering of triggers to find timepoints and tr of each "take"' )
1645 trigger = phys_in .timeseries [phys_in .trigger_idx ]
@@ -27,7 +56,7 @@ def estimate_ntp_and_tr(phys_in, thr=None, ci=1):
2756 elif isinstance (ci , float ) and ci < 1 :
2857 upper_ci_isi = unique_isi * (1 + ci )
2958 elif isinstance (ci , float ) and ci > 1 :
30- raise ValueError ("Confidence intervals above 1 are not supported." )
59+ raise ValueError ("Confidence intervals percentages above 1 are not supported." )
3160 else :
3261 raise ValueError ("Confidence intervals must be either integers or floats." )
3362
0 commit comments