Skip to content

Fix Plexon analog block offsets when block sizes differ - #1980

Open
evadiva3 wants to merge 2 commits into
NeuralEnsemble:masterfrom
evadiva3:fix/1976-plexon-block-offsets
Open

evadiva3 wants to merge 2 commits into
NeuralEnsemble:masterfrom
evadiva3:fix/1976-plexon-block-offsets

Conversation

@evadiva3

@evadiva3 evadiva3 commented Nov 20, 2026 •

Copy link
Copy Markdown

Closes #1976.

The Plexon reader calculates each analog block's start using the current block's sample count. When consecutive blocks have different sizes, this shifts the offsets and can return the wrong samples. Accumulate the preceding block's sample count instead.

Following review, the regression now uses plexon/File_plexon_3.plx in the existing TestPlexonRawIO class. The generated file and its setup are removed. This recording has 5,007 signal blocks with sample counts of 120 and 86. The original parser places the last block at sample 600686 instead of 600720. The test checks all block starts and compares a read across the final boundary with the stored samples. The read ends inside the last block to keep it independent of #1971.

The real-recording regression fails without the fix and passes with it. It was run directly against the downloaded fixture; Datalad setup was not run locally. The Plexon/core pytest run reports 651 passed, 14 skipped, 1 warning. Black passes for the source and test files, and Flake8 passes for the updated test file.

OpenAI Codex assisted with investigation, the test changes, real-recording validation, and this description.

@zm711 zm711 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.

Thanks @evadiva3. I believe that @h-mayorquin has more experience with plexon so I'll leave him to also give this a read. In general we do not allow for generated file regression tests as the goal of the library is to be tested on real data. It would be better for you to write a test based on plexon/File_plexon_3.plx.

@evadiva3

Copy link
Copy Markdown
Author

Thanks, I've replaced the generated file with a test using File_plexon_3.plx in the existing test class. It catches the final block starting 34 samples early and checks a read across that boundary against the stored samples. It fails before the fix and passes after.

This branch has not been deployed

No deployments
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.

Plexon reader: each block's start offset is computed from its own size instead of the previous block's, so offsets are wrong when block sizes differ

2 participants