Removing Electrode Pops

Initialize NeuroAnalyzer
using NeuroAnalyzer
eeg = load("files/eeg.hdf")

EEG electrode pops refer to sudden, transient voltage spikes or pops that appear in EEG recordings. These artifacts are typically caused by loose or poor electrode connections, sudden movements, or skin-electrode impedance changes. They can distort the signal and interfere with analysis.

Identifying Electrode Pops

  • Appearance: Sharp, fast deflections in the EEG trace (often resembling spikes or pops).
  • Duration: Usually very brief (milliseconds).
  • Frequency: Can occur sporadically or in bursts.

Causes

  • Loose electrode contact
  • Sudden subject movement (e.g., eye blinks, muscle twitches)
  • Electrode gel drying out or poor skin-electrode impedance
  • Environmental electrical interference

Detection Methods

  • Visual Inspection: Plot raw EEG data and look for sudden spikes.
  • Automated Detection: Use peak detection algorithms with amplitude thresholds.
  • Thresholding: Set a threshold (e.g., ±100 µV) to flag extreme values.

Correction/Removal Strategies

  • Interpolation: Replace the popped channel with interpolated data from neighboring channels (if the pop is isolated to one channel).
  • Replacement: Replace the popped segment with the mean/median of adjacent time points.
  • Artifact Removal: Use regression-based or ICA-based methods to remove pops if they are widespread.
  • Re-reference: Rereference the data to reduce the impact of localized pops.

Best Practices

  • Always check electrode impedance before recording.
  • Ensure electrodes are securely attached and gel is evenly applied.
  • Use high-pass filtering to reduce slow drifts that may mask pops.

Removing Electrode Pops

Automated repair:

remove_pops(eeg;
            ch = "Fp1")

Do not repair, just detect:

remove_pops(eeg;
            ch = "Fp1",
            repair = false)

Use 2-second window:

remove_pops(eeg;
            ch = "Fp1",
            window = 2.0)

Use 10-sample detection segments:

remove_pops(eeg;
            ch = "Fp1",
            r = 10)

remove_pops() and remove_pops!() must be applied to a continuous (non-epoched signal).

Tip: It is recommended do demean (remove_dc()) the signal prior to removing pops.

Both remove_pops() and remove_pops!() return the list of detected pops:

eeg_clean, pl, ls, rs = remove_pops(eeg;
                                    ch = "eeg")

pl contains the indices of detected pops, with a shape of (channel, sample number).

ls and rs define the lengths of segments—before and after each pop—that start at zero-crossings.

Repairs are applied within these defined segments.