maad.rois.find_rois_cwt

maad.rois.find_rois_cwt(s, fs, flims, tlen, th=0, display=False, save_df=False, savefilename='rois.csv', **kwargs)[source]

Find region of interest using known estimates of signal length and frequency limits.

The general approach is based on continous wavelet transform following a three step process

  1. Filter the signal with a bandpass sinc filter

  2. Smoothing the signal by convolving it with a Mexican hat wavelet (Ricker wavelet) [1]

  3. Binarize the signal applying a linear threshold

Parameters:
sndarray

input signal

fsfloat

frequency sampling of the signal, used to keep track of temporal information of the signal

flimsint

upper and lower frequencies (in Hz)

tlenint

temporal length of signal searched (in s)

thfloat, optional

threshold to binarize the output

display: boolean, optional, default is False

plot results if set to True, default is False

save_dfboolean, optional

save results to csv file

savefilenamestr, optional

Name of the file to save the table as comma separatd values (csv)

Returns:
roispandas DataFrame

an table with temporal and frequencial limits of regions of interest

References

[1]

Pan Du, Warren A. Kibbe, Simon M. Lin, Improved peak detection in mass spectrum by incorporating continuous wavelet transform-based pattern matching, Bioinformatics, Volume 22, Issue 17, 1 September 2006, Pages 2059–2065, DOI: 10.1093/bioinformatics/btl355

Examples

>>> from maad import sound, rois
>>> s, fs = sound.load('../data/spinetail.wav')
>>> rois.find_rois_cwt(s, fs, flims=(4500,8000), tlen=2, th=0, display=True)
    min_f     min_t   max_f     max_t
0  4500.0   0.74304  8000.0   2.50776
1  4500.0   5.10839  8000.0   7.33751
2  4500.0  11.23846  8000.0  13.37469
3  4500.0  16.16109  8000.0  18.29732