pyhctsa.operations.symbolic.binary_stretch

pyhctsa.operations.symbolic.binary_stretch(x, stretch_what='gaps1')

Homogeneity of the gaps between like symbols in a binarized time series.

This is hctsa’s SB_BinaryGapHomogeneity (formerly SB_BinaryStretch). The input is binarized at zero (values above zero become 1, the rest 0; the time series is typically z-scored first, so this is a split about the mean). The gaps between successive 1s (or 0s) are then characterized by the longest block of gaps of one type (shorter or longer than one sample) between like symbols, as a proportion of the time-series length.

Note: Despite its former name, this does not measure the longest run of 0s or 1s (an implementation quirk of the original that is retained), but it is a potentially interesting statistic.

Parameters:
x : array-like

The input time series.

stretch_what : {'gaps1', 'gaps0'}, optional

Which binary symbol’s gaps to analyze (formerly 'lseq1' and 'lseq0'):

  • ’gaps1’: Analyze gaps between consecutive 1s.

  • ’gaps0’: Analyze gaps between consecutive 0s.

Default is 'gaps1'.

Returns:

The statistic, normalized by the time-series length (0 if the symbol does not occur often enough to define it).

Return type:

float