bycycle.utils.rename_extrema_df

bycycle.utils.rename_extrema_df(center_extrema, df_features, return_samples=True)[source]

Rename a dataframe based on the centered extrema.

Parameters:
center_extrema{‘trough’, ‘peak’}

Which extrema is centered.

df_featurespandas.DataFrames

Bycycle dataframes to rename, given the centered extrema.

return_samplesbool, optional, default: True

Whether to rename sample columns if returns_samples is True when computing df_features using compute_features().

Returns:
df_featurespandas.DataFrames

Updated dataframes.

Examples

Convert the column labels of a peak-centered dataframe to a trough-centered dataframe:

>>> from neurodsp.sim import sim_bursty_oscillation
>>> from bycycle.features import compute_features
>>> fs = 500
>>> sig = sim_bursty_oscillation(10, fs, freq=10)
>>> sig = -sig  # invert the signal, flipping peaks and troughs
>>> df_features = compute_features(sig, fs, f_range=(8, 12), center_extrema='peak')
>>> df_features = rename_extrema_df('trough', df_features)