Skip to content

AMICA parameter file writes min_dll and min_grad_norm as integers (the binary gets 0) #619

Closed

Description

@neuromechanist

src/eegprep/functions/sigprocfunc/runamica.py writes min_dll and min_grad_norm to the AMICA parameter file as integers, so the amica15 binary receives 0 for both instead of the defaults eegprep declares.

Where: _AMICA_DEFAULTS holds min_dll = 1e-9 and min_grad_norm = 1e-7, but both names are listed in _INT_PARAMS, and the writer does f.write(f"{key} {int(val):d}\n") for those names, so 1e-9 and 1e-7 are written as 0.

Effect: with use_min_dll or use_grad_norm switched on, the binary's likelihood-decrease and gradient-norm stop checks run against a threshold of 0, which is not the threshold eegprep documents. With both switches at their default (off) nothing changes, which is why this stayed invisible.

Found while reviewing the pAMICA backend pull request (#617); pAMICA's own torch engine keeps the 1e-7 gradient-norm threshold, so a like-for-like comparison of the two engines with those switches on would differ for this reason alone.

Suggested fix: move min_dll and min_grad_norm to the scientific-notation set (_SCI_PARAMS), and add a test that reads the written parameter file back and checks both values.
Not verified: the exact way the Fortran program reads those two keys (it reads them as real numbers in the upstream parameter file).

Activity

  1. claude commented on Nov 14, 2026

    @claude
    Contributor

    🤖 Plan:

    • Confirm root cause: min_dll/min_grad_norm are in _INT_PARAMS (src/eegprep/functions/sigprocfunc/runamica.py#L172-L173), writer does int(val) (#L311-L312), so 1e-9/1e-7 become 0.
    • Add failing test in tests/test_runamica.py reading back input.param
    • Move both keys to _SCI_PARAMS
    • pre-commit + tests, open PR: [AMICA] Write min_dll and min_grad_norm as real numbers #620
    • CI green
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