experanto.filters.common_filters.nan_filter

nan_filter(vicinity=0.05)[source]

Create a filter that excludes time regions around NaN values.

Returns a closure that, given a SequenceInterpolator, identifies all time points containing NaN in any channel and marks a symmetric window of vicinity seconds around each as invalid.

Parameters:

vicinity (float, optional) – Half-width of the exclusion window in seconds around each NaN time point. Default is 0.05.

Returns:

A function that takes a SequenceInterpolator and returns a list of TimeInterval representing the valid (NaN-free) portions of the recording.

Return type:

callable