Skip to content

Phase 1 figure polish: y-axis clipping for stages 00-02, cleanline-skip stamp #28

@neuromechanist

Description

@neuromechanist

Carved out of the Phase 1 re-run QA review (PR #28, eeg-qa-neuroscientist findings).

Problem

After the 1 Hz high-pass filter, any channel whose data goes near-numerically-zero (e.g., the Cz reference, or a single dead electrode that had been carrying mostly DC) is rendered by spectopo with a log-power floor at ~-250 dB. On the stage 00 raw PSD it sits at ~-130 dB (visible but not dominating); on stages 01 (HPF) and 02 (cleanline, no-op at 100 Hz) it gets driven to ~-250 dB, blowing out the y-axis and visually washing out the 1-40 Hz band of interest. The same channels are correctly rejected at stage 03, so the rendered chanreject PSDs are clean.

Evidence: every subject's stage-01-hpf and stage-02-cleanline PSDs in derivatives/preproc/sub-*/figures/ show one or two outlier traces at ~-250 dB that are absent from the chanreject panel. Pipeline behavior is correct; only the visualization is hard to read.

Additionally, when cleanline is skipped under the Nyquist gate, the stage-02 figure is byte-for-byte similar to stage-01 except for the title. A figure-body stamp like cleanline disabled at srate<500 would help readers scanning thumbnails distinguish the two.

Proposed fix in src/matlab/+hbn/save_psd_figure.m

  1. Clip the y-axis to the data-bearing range (e.g., -50 to 30 dB) so flat-channel artifacts don't dominate the panel. Make it a name-value option so 500 Hz runs can override if needed.
  2. When cleanline_status == \"skipped_nyquist\", add a centered annotation to the figure body in addition to the title text.

Re-run phase1_preprocess(SmokeSubjectCount=3) and replace the 12 committed PSDs after the fix.

Out of scope

Filter design or rejection thresholds. The pipeline is doing the right thing; this issue is purely about how the result is rendered.

Refs #1, #2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    matlabMATLAB / EEGLAB pipelinephaseIndividual phase of an epic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions