bycycle.plts.plot_cyclepoints_df

bycycle.plts.plot_cyclepoints_df(df_samples, sig, fs, plot_sig=True, plot_extrema=True, plot_zerox=True, xlim=None, ax=None, **kwargs)[source]

Plot extrema and/or zero-crossings from a DataFrame.

Parameters:
df_samplespandas.DataFrame

Dataframe output of compute_cyclepoints().

sig1d array

Time series to plot.

fsfloat

Sampling rate, in Hz.

plot_sigbool, optional, default: True

Whether to also plot the raw signal.

plot_extremabool, optional, default: True

Whether to plots the peaks and troughs.

plot_zeroxbool, optional, default: True

Whether to plots the zero-crossings.

xlimtuple of (float, float), optional

Start and stop times.

axmatplotlib.Axes, optional

Figure axes upon which to plot.

**kwargs

Keyword arguments to pass into plot_time_series.

Notes

Default keyword arguments include:

  • figsize: tuple of (float, float), default: (15, 3)

  • xlabel: str, default: ‘Time (s)’

  • ylabel: str, default: ‘Voltage (uV)

Examples

Plot cyclepoints using a dataframe from compute_cyclepoints():

>>> from bycycle.features import compute_cyclepoints
>>> from neurodsp.sim import sim_bursty_oscillation
>>> fs = 500
>>> sig = sim_bursty_oscillation(10, fs, freq=10)
>>> df_samples = compute_cyclepoints(sig, fs, f_range=(8, 12))
>>> plot_cyclepoints_df(df_samples, sig, fs)