MneExperiment.make_bad_channels_neighbor_correlation(r, epoch=None, add_bads=True, save=True, **state)

Iteratively exclude bad channels based on low average neighbor-correlation

  • r (float) – Minimum admissible neighbor correlation. Any channel whose average correlation with its neighbors is below this value is added to the list of bad channels (e.g., 0.3).

  • epoch (Optional[str]) – Epoch to use for computing neighbor-correlation (by default, the whole session is used).

  • add_bads (bool) – Reject bad channels first.

  • save (bool) –

    Save the bad channels to the bad channel specification file. Set save=False to examine the result without actually changing the

    bad channels.

  • ... – State parameters.

Return type

(NDVar, List[str])


  • neighbor_correlation – Head-map with the neighbor correlation for each sensor.

  • bad_channels – Channels that are excluded based on criteria.



  1. Load the corresponding data

  2. Calculate the pairwise correlation between each neighboring sensor pair

  3. Assign to each sensor the average correlation with its neighbors

  4. If the sensor with the lowest correlation is < r, exclude it and go back to 2.


Data is loaded for the currently specified raw setting, but bad channels apply to all raw settings equally. Hence, when using this method with multiple subjects, it is important to set raw to the same value.