Repository navigation
[eegprep-lean] Fix edge cases in reading a store's electrode positions - #627
Conversation
There was a problem hiding this comment.
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.
|
Claude finished @neuromechanist's task in 48s —— View job Code review
BlockingNone. ImportantNone. NitsNone. Test gapsNone. Each new case has a test:
EEGLAB parity notesNone. This is reader-side code in Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance. I could not re-run the lean test suites here because running commands was not permitted in this job; the counts in the PR body come from the author's run. |
The eegprep-lean pin moves to the merge commit of sccn/eegprep pull request 627 on develop. The reader now reads a store whose integer coordinate is past binary64 (a position-less channel, digested like every other store), records the named refusal ElectrodePositionsNotAnObject for a non-object positions attribute, and reads every zero as +0.0 so the reader hands what the digest names. All thirteen locations vectors, the huge-integer one included, now reproduce through the reader's own parser. Tests and docs follow the new behavior; no version moves because no image was published at the pre-release version; tests and CI green.
Follow-up to #626, from review of the code that consumes the electrode-positions reader. Three edge cases of a store root's electrode_positions now follow NEMAR's locations digest, which is defined on binary64 values.
A coordinate that is an integer too large for a float (400 digits, or any integer from 2^1024 minus 2^970) raised OverflowError and failed the whole read; it is now a channel without a position. The root is parsed with parse_int=float, as JSON.parse reads it. That also removes the 4300-digit limit, which raised ValueError before any entry existed, so an entry-level catch alone could not cover it. A small OverflowError guard stays for from_attributes called with Python integers.
Every zero is now +0.0 whatever its sign or spelling, as the digest hashes it. Before, -0.0 was kept and the integer -0 was not, and the sign of a zero set the sign of Y and theta (180 or -180). The BIDS import is unchanged and keeps -0.0 for a minus-signed zero in a float column of an electrodes.tsv (an all-integer column reads -0 as +0.0), so for such a file Y and theta can differ in sign between the two routes. The 13-pair route-equality test still passes, and a new one checks that a store's -0.0 gives what the import gives for 0.0.
A non-object electrode_positions still raises, because the digest refuses it too, but as ElectrodePositionsNotAnObject (an IndexError_), so a caller records the reason by type. A test now pins an attributes of [] or null as no attributes.
Each case has tests and a mutation check. Lean suites in the root, zarr, plot, both and combined environments pass (368, 353, 327, 373 and 414).