find_frequency_peaks

find_frequency_peaks(spect, stimes, sfreqs, varargin)

FIND_FREQUENCY_PEAKS Find per-timepoint peak prominence, frequency, and bandwidth in a multitaper spectrogram

Usage:
[fpeak_proms, fpeak_freqs, fpeak_bandwidths, fpeak_bandwidth_bounds, normalized_spectrogram] = …

find_frequency_peaks(spect, stimes, sfreqs, ‘Name’, Value, …)

Inputs:

spect : TxF double - multitaper spectrogram (time x frequency) – required stimes : 1xT double - spectrogram time axis (s) – required sfreqs : 1xF double - spectrogram frequency axis (Hz) – required

Name-Value Pairs:

‘valid_time_inds’ : 1xT logical - mask of time points to include (default: true(1,T)) ‘norm_method’ : char - ‘percentile’, ‘detrend’, or ‘none’ (default: ‘none’) ‘norm_time_inds’ : 1xT logical - time points used for normalization (default: true(1,T)) ‘peak_freq_range’ : 1x2 double - frequency band for peak selection in Hz (default: [9 17]) ‘findpeaks_freq_range’ : 1x2 double - wider band used by findpeaks in Hz (default: [6 30]) ‘percent_num’ : double - percentile for normalization (default: 3) ‘in_db’ : logical - run findpeaks in dB scale (default: false) ‘smooth_Hz’ : double - spectral smoothing width in Hz (default: 0) ‘local_norm_minutes’ : double - local normalization window in minutes (default: 0) ‘time_range’ : 1x2 double - restrict computation to this time window (default: full record) ‘plot_on’ : logical - draw diagnostic spectra at every time step (default: false) ‘verbose’ : logical - verbose console output (default: true) ‘findpeaks_version’ : char - ‘linear’ (default, linearized path) or ‘par’ (parfor)

Outputs:

fpeak_proms : 1xT double - per-timepoint prominence of the most prominent peak fpeak_freqs : 1xT double - frequency at which that peak was detected (Hz) fpeak_bandwidths : 1xT double - width of the detected peak (Hz) fpeak_bandwidth_bounds : Tx2 double - lower/upper bandwidth bounds of the detected peak (Hz) normalized_spectrogram : TxF double - spectrogram after the requested normalization

Notes

Prominence extraction implicitly handles slow spectral trends, so by default no normalization is applied. The linearized findpeaks path (findpeaks_extents_fpeaks) avoids rounding errors seen on long recordings. Use ‘par’ to run findpeaks per timepoint in parallel.

See also: find_time_peaks, findpeaks_extents_fpeaks, TF_peak_detection

∿∿∿ Prerau Laboratory MATLAB Codebase · sleepEEG.org ∿∿∿