fitgrid.epochs module

Data structure for validating and efficiently slicing fixed-length segments of typically multichannel time-series data.

class fitgrid.epochs.Epochs(epochs_table, time, epoch_id, channels)[source]

Bases: object

Container class used for storing epochs tables and exposing statsmodels.

Parameters
  • epochs_table (pandas DataFrame) – long form dataframe containing epochs with equal indices

  • time (str) – time column name

  • epoch_id (str) – epoch identifier column name

  • channels (list of str) – list of channel names to serve as dependent variables

Returns

epochs – epochs object

Return type

Epochs

distances()[source]

Return scaled Euclidean distances of epochs from the “mean” epoch.

Returns

distances – Series or DataFrame with epoch distances

Return type

pandas Series or DataFrame

Notes

Distances are scaled by dividing by the max.

plot_averages(channels=None, negative_up=True)[source]

Plot grand mean averages for each channel, negative up by default.

Parameters
  • channels (list of str, optional, defaults to all channels) – list of channel names to plot the averages

  • negative_up (bool, optional, default True) – by convention, ERPs are plotted negative voltage up

Returns

  • fig (matplotlib.figure.Figure) – figure containing plots

  • axes (numpy.ndarray of matplotlib.axes.Axes) – axes objects