You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AMICA parameter file writes min_dll and min_grad_norm as integers (the binary gets 0) #619
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).
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
Activity
claude commentedon Nov 14, 2026
🤖 Plan:
min_dll/min_grad_normare in_INT_PARAMS(src/eegprep/functions/sigprocfunc/runamica.py#L172-L173), writer doesint(val)(#L311-L312), so 1e-9/1e-7 become0.tests/test_runamica.pyreading backinput.param_SCI_PARAMS