mne_hfo.match_detected_annotations#

mne_hfo.match_detected_annotations(ytrue_annot_df, ypred_annot_df, ch_names=None, label=None, sec_margin=1.0, method='match-true')[source]#

Given two annotations.tsv DataFrames, match HFO detection overlaps.

Parameters:
ytrue_annot_dfpd.DataFrame

The reference annotations DataFrame containing the HFO events that are considered “ground-truth” in this comparison.

ypred_annot_dfpd.DataFrame

The estimated annotations DataFrame containing the HFO events that are estimated using a Detector.

ch_nameslist | str | None

Which channels to match. If None (default), then will match all available channels in both dataframes. If str, then must be a single channel name available in the ytrue_annot_df. If list of strings, then must be a list of channel names available in the ytrue_annot_df.

labelstr | None

The HFO label to use. If None (default) will consider all rows in both input DataFrames as an HFO event. If a string, then it must match to an element of label column in the dataframes.

sec_marginfloat

Number of seconds to consider a valid checking window. Default = 1.

methodstr

Type of strategy for matching HFO events. Must be one of match-true, match-pred, or match-total. If “match-true”, will return a dataframe of all true indices and matching predicted indices if they exist. If “match-pred”, will return a dataframe of all predicted indices and matching true indices if they exist. If “match-total”, will return the concatenation of the two. See Notes for more information.

Returns:
matched_dfpd.DataFrame

A DataFrame with the columns pred_index and true_index, which corresponds to indices.