Skip to main content

Segment Rejection Artifact Detection Peer Review

This peer-review walk-through inspects the three artifact cleaning steps that run in our baseline EEG tasks: annotate_noisy_epochs, annotate_uncorrelated_epochs, and detect_dense_oscillatory_artifacts. The goal is to document how each routine behaves, highlight correctness and maintainability findings, and capture practical guidance for operators who must justify these detections to stakeholders.【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L20-L204】【F:src/autoclean/functions/segment_rejection/dense_oscillatory.py†L13-L200】

Segment Rejection Overview

The segment rejection mixin executes three denoising routines in sequence to protect downstream feature extraction and QC dashboards. Together they:
  • Epoch continuous raw EEG into fixed windows shared by all detectors
  • Annotate noisy amplitude dispersion, spatially incoherent segments, and dense oscillatory bursts
  • Persist artifact metadata so reviewers can reconcile automatic flags with technician notes

Baseline flow

Epoch Denoising Bundle

The following sections drill into the three routines that share the epoching scaffold. Treat them as a bundle: tuning one detector’s window or pick set usually means re-validating the others on the same segmentation.
Verify that recording spans cover the chosen epoch durations and that montages load correctly before scheduling batch jobs. When prerequisites fail, the mixin aborts early and silently returns a copy of the input raw object.【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L98-L155】【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L284-L347】

Step-by-step reasoning

Validation checklist

    Deployment playbooks

    Reviewer concerns & follow-up items

    • Introduce optional overlap in the dense oscillatory detector to avoid blind spots; couple with annotation merging to prevent duplicate spans.【F:src/autoclean/functions/segment_rejection/dense_oscillatory.py†L154-L189】
    • Evaluate adding a low-variance branch to annotate_noisy_epochs so flat-lined electrodes are surfaced for technician review.【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L147-L155】
    • Cache montage-derived neighbor indices to reduce the quadratic cost in repeated calls, especially in sliding-window pipelines.【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L493-L518】
    Despite the improvement opportunities, the implementations correctly guard against empty epoch sets, preserve original annotation timing, and serialize metadata for reporting dashboards, making them production-ready once the noted edge cases are addressed.【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L98-L203】【F:src/autoclean/mixins/signal_processing/segment_rejection.py†L349-L384】【F:src/autoclean/functions/segment_rejection/dense_oscillatory.py†L180-L198】