detect_transients_excess#

pypillometry.signal.detect_transients_excess(sy, rate, noise, smooth=5, min_scale=10, max_scale=300, z=4.0, unusable=None, max_gap=0)[source]#

The flanks of dropouts that change faster than the pupil can manage, tested over many scales (see excess_flank()): the change before and after each run of missing or masked samples, in either direction.

Parameters:
  • sy (np.ndarray) – pupil data (NaN or 0 for missing values)

  • rate (float or np.ndarray) – the largest plausible change of the pupil per sample (positive; one for all samples or one per sample)

  • noise (float) – standard deviation of the noise of a sample

  • smooth (int) – width of the running median and range of the scales (samples; see excess_flank())

  • min_scale (int) – width of the running median and range of the scales (samples; see excess_flank())

  • max_scale (int) – width of the running median and range of the scales (samples; see excess_flank())

  • z (float) – threshold in standard deviations of the noise of a difference

  • unusable (np.ndarray of bool, optional) – samples masked for other reasons: they are dropouts too, and a flank stops at them

  • max_gap (int) – a flank goes on across up to this many missing or masked samples in a row (see excess_flank())

Return type:

ndarray

Returns:

array (n x 2) of first/last sample (both inclusive), sorted, the ones that overlap or touch merged