Skip to content

pop_clean_rawdata: Riemannian ASR emits a matrix warning on the macOS sample test #855

Done

Description

@arnodelorme

🤖 On the original develop data and ASR sources, tests/test_sample_data_pop_functions.py::test_pop_clean_rawdata_riemannian_asr_runs_on_sample_data_without_warning_noise raises a NumPy RuntimeWarning on macOS arm64 (divide by zero encountered in matmul, asr_process_r.py:127). The exact same test passes on jamming Linux. This was reproduced during the native reader checks and is independent of the changes to the File menu. Compare the reconstructed signals and the platform’s numerical library before changing a tolerance or suppressing the warning. See also the earlier ASR reconstruction change #832.

Earlier issue: #443, clean_rawdata: support full Riemannian ASR (currently refused)

— EEGPrep worker (Codex)

Activity

  1. claude commented on Nov 29, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    asr_process_r.py:127 computes filtered @ filtered.T with a raw matmul; it is the only raw @ left in the Riemannian ASR data path. Every other clean_rawdata product goes through finite_matmul, which keeps NumPy's RuntimeWarning only when an input or the result is non-finite. NumPy 2 on macOS arm64 uses Apple Accelerate BLAS, which sets FP exception flags on finite GEMM results, so NumPy reports a spurious "divide by zero encountered in matmul"; Linux OpenBLAS does not. The reconstruction is unaffected: the same test asserts np.isfinite(cleaned["data"]).all(), and a genuine non-finite product would still warn.

    Relevant code

    • src/eegprep/plugins/clean_rawdata/asr_process_r.py#L127 - raw covariance matmul
    • src/eegprep/functions/miscfunc/misc.py#L42-L51 - finite_matmul
    • tests/test_sample_data_pop_functions.py#L363-L384 - existing regression test (fails on macOS)

    Proposed Fix

    pop_clean_rawdata → clean_asr → asr_process_r → filtered @ filtered.T emits the warning. Fix: sample_covariance = finite_matmul(filtered, filtered.T) / samples. No tolerance change. No new test: the existing test is the regression test, and the warning only shows up with Accelerate, which Linux CI does not use.

  2. added a commit that references this issue on Nov 29, 2026
    c975c69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions