Skip to content

Commit

Permalink
Bug fixed #80. Updated docs and removed sampling frequency conversion…
Browse files Browse the repository at this point in the history
… to integer on maximum power spectrum feature
  • Loading branch information
mbarandas committed Mar 17, 2021
1 parent ae74f7c commit c86d85c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions tsfel/feature_extraction/calc_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def calc_features(wind_sig, dict_features, fs, **kwargs):
Input from which features are computed, window
dict_features : dict
Dictionary with features
fs : int or None
fs : float or None
Sampling frequency
\**kwargs:
* *features_path* (``string``) --
Expand Down Expand Up @@ -330,7 +330,7 @@ def calc_window_features(dict_features, signal_window, fs, verbose=1, single_win
Dictionary with features
signal_window: pandas DataFrame
Input from which features are computed, window
fs : int
fs : float
Sampling frequency
verbose : int
Level of function communication
Expand Down
44 changes: 22 additions & 22 deletions tsfel/feature_extraction/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def total_energy(signal, fs):
----------
signal : nd-array
Signal from which total energy is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -320,7 +320,7 @@ def auc(signal, fs):
----------
signal : nd-array
Input from which the area under the curve is computed
fs : int
fs : float
Sampling Frequency
Returns
-------
Expand Down Expand Up @@ -846,7 +846,7 @@ def spectral_distance(signal, fs):
----------
signal : nd-array
Signal from which spectral distance is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -878,7 +878,7 @@ def fundamental_frequency(signal, fs):
----------
signal : nd-array
Input from which fundamental frequency is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -915,7 +915,7 @@ def max_power_spectrum(signal, fs):
----------
signal : nd-array
Input from which maximum power spectrum is computed
fs : scalar
fs : float
Sampling frequency
Returns
Expand All @@ -925,9 +925,9 @@ def max_power_spectrum(signal, fs):
"""
if np.std(signal) == 0:
return float(max(scipy.signal.welch(signal, int(fs), nperseg=len(signal))[1]))
return float(max(scipy.signal.welch(signal, fs, nperseg=len(signal))[1]))
else:
return float(max(scipy.signal.welch(signal / np.std(signal), int(fs), nperseg=len(signal))[1]))
return float(max(scipy.signal.welch(signal / np.std(signal), fs, nperseg=len(signal))[1]))


@set_domain("domain", "spectral")
Expand All @@ -940,7 +940,7 @@ def max_frequency(signal, fs):
----------
signal : nd-array
Input from which maximum frequency is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1033,7 +1033,7 @@ def spectral_decrease(signal, fs):
----------
signal : nd-array
Signal from which spectral decrease is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1074,7 +1074,7 @@ def spectral_kurtosis(signal, fs):
----------
signal : nd-array
Signal from which spectral kurtosis is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1105,7 +1105,7 @@ def spectral_skewness(signal, fs):
----------
signal : nd-array
Signal from which spectral skewness is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def spectral_spread(signal, fs):
----------
signal : nd-array
Signal from which spectral spread is computed.
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1173,7 +1173,7 @@ def spectral_slope(signal, fs):
----------
signal : nd-array
Signal from which spectral slope is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1215,7 +1215,7 @@ def spectral_variation(signal, fs):
----------
signal : nd-array
Signal from which spectral variation is computed.
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1248,7 +1248,7 @@ def spectral_positive_turning(signal, fs):
----------
signal : nd-array
Input from which the number of positive turning points of the fft magnitude are computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1281,7 +1281,7 @@ def spectral_roll_off(signal, fs):
----------
signal : nd-array
Signal from which spectral roll-off is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1310,7 +1310,7 @@ def spectral_roll_on(signal, fs):
----------
signal : nd-array
Signal from which spectral roll-on is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1340,7 +1340,7 @@ def human_range_energy(signal, fs):
----------
signal : nd-array
Signal from which human range energy ratio is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1381,7 +1381,7 @@ def mfcc(signal, fs, pre_emphasis=0.97, nfft=512, nfilt=40, num_ceps=12, cep_lif
----------
signal : nd-array
Input from which MEL coefficients is computed
fs : int
fs : float
Sampling frequency
pre_emphasis : float
Pre-emphasis coefficient for pre-emphasis filter application
Expand Down Expand Up @@ -1431,7 +1431,7 @@ def power_bandwidth(signal, fs):
----------
signal : nd-array
Input from which the power bandwidth computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -1474,7 +1474,7 @@ def fft_mean_coeff(signal, fs, nfreq=256):
----------
signal : nd-array
Input from which fft mean coefficients are computed
fs : int
fs : float
Sampling frequency
nfreq : int
The number of frequencies
Expand Down Expand Up @@ -1540,7 +1540,7 @@ def spectral_entropy(signal, fs):
----------
signal : nd-array
Input from which spectral entropy is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down
4 changes: 2 additions & 2 deletions tsfel/feature_extraction/features_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def calc_fft(signal, fs):
----------
signal : nd-array
The input signal from which fft is computed
fs : int
fs : float
Sampling frequency
Returns
Expand Down Expand Up @@ -68,7 +68,7 @@ def filterbank(signal, fs, pre_emphasis=0.97, nfft=512, nfilt=40):
----------
signal : nd-array
Input from which filterbank is computed
fs : int
fs : float
Sampling frequency
pre_emphasis : float
Pre-emphasis coefficient for pre-emphasis filter application
Expand Down

0 comments on commit c86d85c

Please sign in to comment.