Skip to content

Handle ASR calibrations that cannot form a stable RMS fit - #527

Merged
suraj-ranganath merged 8 commits into
developfrom
cursor/fix-short-asr-calibration-524-5a24
Nov 5, 2026
Merged

suraj-ranganath merged 8 commits into
developfrom
cursor/fix-short-asr-calibration-524-5a24

Conversation

@suraj-ranganath

@suraj-ranganath suraj-ranganath commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

pop_clean_rawdata warns and leaves the burst stage unchanged when calibration is shorter than one 0.5 s RMS window or yields fewer than two windows. With reference selection on, clean_asr.m:144-153 falls back to the whole recording, asr_calibrate.m:160-161 and 189-204 then error, and clean_artifacts.m:270-275 returns before window removal at line 318 and before restoring srate at line 311. Issue 466 only skipped a non-monotonic spectral filter. A requested window stage still runs here.

Two or three RMS windows are a different case. With reference selection off, clean_asr.m:155-157 uses the whole recording and asr_calibrate.m:180 calibrates it. asr_calibrate.m:201 builds the windows with round(1:N*(1-window_overlap):S-N). For 89 samples at 128 Hz, N is 64 and that colon is two windows. asr_calibrate.m:206 calls the local fit, and asr_calibrate.m:392-395 indexes X(m,:) at m=0, the same invalid index as fit_eeg_distribution.m:112-115. clean_artifacts.m:270-275 catches that and returns the input. EEGPrep skips the non-positive widths and still cleans. The fuzz harness treats that unchanged EEGLAB result as the known difference, using the existing clean_asr tolerance.

Distance='riemannian' warns and skips the same way. clean_artifacts.m:267-268 calls Riemannian clean_asr outside the try/catch at lines 270-275, so EEGLAB lets that error propagate. Both calibrators raise ASRCalibrationError and name the function, the sample counts, and the choice to record more data or set BurstCriterion off. The old phrases Not enough calibration data and Fewer than 2 calibration windows stay in the messages.

Fixes #524
Fixes #526

Open in Web Open in Cursor 

@claude

claude Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

@cursor cursor Bot changed the title Skip ASR when calibration is shorter than one RMS window Handle ASR calibrations that cannot form a stable RMS fit Nov 3, 2026
@cursor
cursor Bot force-pushed the cursor/fix-short-asr-calibration-524-5a24 branch from 1eaea83 to 39b1fc2 Compare November 4, 2026 20:34
cursoragent and others added 6 commits November 4, 2026 21:24
pop_clean_rawdata warns and leaves the burst stage unchanged when the
recording cannot form two calibration windows. clean_asr still raises.

Co-authored-by: Suraj Ranganath <[email protected]>
pop_clean_rawdata still cleans two or three RMS windows. EEGLAB indexes a rounded width of zero and returns the recording unchanged.

Co-authored-by: Suraj Ranganath <[email protected]>
A synthetic dataset used while shrinking has no pnts field. The zero-width check read that field before deciding the case was not a short calibration.

Co-authored-by: Suraj Ranganath <[email protected]>
Name the function, the sample counts, and the longer-recording fix in both calibrators.

Co-authored-by: Suraj Ranganath <[email protected]>
A constant recording makes the mixing-matrix eigendecomposition fail on Windows before the short-calibration error is raised.

Co-authored-by: Suraj Ranganath <[email protected]>
A constant recording now raises ASRCalibrationError instead of failing in the eigendecomposition.

Co-authored-by: Suraj Ranganath <[email protected]>
@cursor
cursor Bot force-pushed the cursor/fix-short-asr-calibration-524-5a24 branch from beabc17 to 0f44b0a Compare November 4, 2026 21:25
cursoragent and others added 2 commits November 4, 2026 23:22
A parallel OpenBLAS reduction on Windows moved the recorded relative gap by 1.4e-9, past the existing 1e-9 lock. The absolute gap and the calibration were unchanged.

Co-authored-by: Suraj Ranganath <[email protected]>
@suraj-ranganath
suraj-ranganath marked this pull request as ready for review November 5, 2026 02:25

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@suraj-ranganath
suraj-ranganath merged commit 0bda20d into develop Nov 5, 2026
10 of 11 checks passed
@claude

claude Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 0s —— View job


I'll analyze this and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fuzz] pop_clean_rawdata|numeric|9e1 [fuzz] pop_clean_rawdata|python-only:ValueError|na

2 participants