Module signal

operalib.signal implements signal preprocessing routines such as period detection usefull for periodic kernels.

operalib.signal.autocorrelation(data)[source]

Autocorrelation routine.

Compute the autocorrelation of a given signal ‘data’.

Parameters:
data : darray

1D signal to compute the autocorrelation.

Returns:
ndarray

the autocorrelation of the signal x.

operalib.signal.get_period(inputs, targets, thres=0.05, min_dist=2)[source]

Period detection routine.

Finds the period in targets by taking its autocorrelation and its first order difference. By using thres and min_dist parameters, it is possible to reduce the number of detected peaks. targets must be signed.

Parameters:
inputs : ndarray

support of targets.

targets : ndarray (signed)

1D amplitude data to search for peaks.

thres : float between [0., 1.]

Normalized threshold. Only the peaks with amplitude higher than the threshold will be detected.

min_dist : int

Minimum distance between each detected peak. The peak with the highest amplitude is preferred to satisfy this constraint.

Returns:
float

a period estimation of the signal targets = f(inputs).

operalib.signal.indexes(targets, thres=0.05, min_dist=2)[source]

Peak detection routine.

Finds the peaks in y by taking its first order difference. By using thres and min_dist parameters, it is possible to reduce the number of detected peaks. y must be signed.

Parameters:
targets : array, (signed)

1D amplitude data to search for peaks.

thres : float, (between [0., 1.])

Normalized threshold. Only the peaks with amplitude higher than the threshold will be detected.

min_dist : int

Minimum distance between each detected peak. The peak with the highest amplitude is preferred to satisfy this constraint.

Returns:
ndarray

Array containing the indexes of the peaks that were detected