mne.stats.erp.compute_frac_area_latency#
- mne.stats.erp.compute_frac_area_latency(evoked, frac=0.5, start=None, stop=None, picks='all', mode='abs', average=False)[source]#
Compute the latency at which a fraction of the total area is reached.
- Parameters:
- evokedinstance of
Evoked The evoked response object.
- frac
float The fraction of the area at which to compute the latency. Defaults to 0.5.
- start, stop
float Start and end time of the ERP computation window in seconds. Defaults to
NoneandNone, which corresponds to the entire Evoked object.- picks
str| array_like |slice|None Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g.,
['meg', 'eeg']) will pick channels of those types, channel name strings (e.g.,['MEG0111', 'MEG2623']will pick the given channels. Can also be the string values'all'to pick all channels, or'data'to pick data channels. None (default) will pick all channels. Bad channels are included by default. Note that channels ininfo['bads']will be included if their names or indices are explicitly provided.- mode
str Specifies how the area should be computed. Can be one of:
'abs'The absolute value of the data is used.
'neg'Only negative values are considered.
'pos'Only positive values are considered.
'intg'The integral of the data is computed without rectification.
Defaults to
'abs'.- averagebool
If True, the fractional area latency is computed by averaging the data across channels before finding the latency. Defaults to False.
- evokedinstance of
- Returns:
- frac_area_df
pandas.DataFrame A DataFrame with columns ‘channel’, ‘fractional_area_latency’, and ‘area’ containing the latency at which the area under the curve reaches the fractional threshold. If
average=True, contains a single row whose ‘channel’ value is'Average'.
- frac_area_df
Notes
With
mode='intg'the running signed area is not guaranteed to increase monotonically, so for a channel whose positive and negative portions nearly cancel, the reported latency may not correspond to any visually meaningful point in the waveform. Only a channel whose total area is exactly zero is guarded against (yieldingNaN); a total area that is merely small relative to the channel’s overall activity is not. The earliest sample satisfying the fractional threshold is returned.