biosppy.features.frequency

biosppy.features.frequency

This module provides methods to extract frequency features.

copyright:
  1. 2015-2026 by Instituto de Telecomunicacoes

license:

BSD 3-clause, see LICENSE for more details.

Functions

compute_fbands([frequencies, power, fband])

Compute frequency bands.

frequency([signal, sampling_rate, fbands])

Compute spectral metrics describing the signal.

spectral_features([freqs, power, sampling_rate])

Compute spectral features.

biosppy.features.frequency.compute_fbands(frequencies=None, power=None, fband=None)[source]

Compute frequency bands.

Parameters:
  • frequencies (array) – Frequency values.

  • power (array) – Power values.

  • fband (dict) – Frequency bands to compute the features, where the keys are the names of the bands and the values are two-element lists/tuples with the lower and upper frequency bounds (in Hz) of the bands.

Returns:

  • total_power (float) – Total power of the signal.

  • {fband}_power (float) – Power of the frequency band.

  • {fband}_rel_power (float) – Relative power of the frequency band.

  • {fband}_peak (float) – Peak frequency of the frequency band.

biosppy.features.frequency.frequency(signal=None, sampling_rate=1000.0, fbands=None)[source]

Compute spectral metrics describing the signal.

Parameters:
  • signal (array) – Input signal.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

  • fbands (dict) – Frequency bands to compute the features, where the keys are the names of the bands and the values are the frequency ranges (in Hz) of the bands.

Returns:

feats (ReturnTuple object) – Frequency features of the signal.

Notes

For the list of available features, check: - biosppy.signals.tools.signal_stats - biosppy.features.frequency.spectral_features - biosppy.features.frequency.compute_fbands

biosppy.features.frequency.spectral_features(freqs=None, power=None, sampling_rate=1000.0)[source]

Compute spectral features.

Parameters:
  • freqs (array) – Frequency values.

  • power (array) – Power values.

  • sampling_rate (int, float, optional) – Sampling frequency (Hz).

Returns:

  • fundamental_frequency (float) – Fundamental frequency. The frequency with the highest power.

  • sum_harmonics (float) – Sum of harmonics.

  • roll_on (float) – Spectral roll on. The frequency where 95% of the total power is reached.

  • roll_off (float) – Spectral roll off. The frequency where 5% of the total power is reached.

  • centroid (float) – Spectral centroid. The weighted mean of the frequencies.

  • slope (float) – Spectral slope. The slope of the linear regression of the power spectrum.

  • spread (float) – Spectral spread. The standard deviation of the power spectrum.