Skip to content

Fix Maxwell routed channel mapping - #1909

Open
Arthur031221 wants to merge 2 commits into
NeuralEnsemble:masterfrom
Arthur031221:fix-maxwell-routed-mapping-s75
Open

Arthur031221 wants to merge 2 commits into
NeuralEnsemble:masterfrom
Arthur031221:fix-maxwell-routed-mapping-s75

Conversation

@Arthur031221

@Arthur031221 Arthur031221 commented Oct 4, 2026 •

Copy link
Copy Markdown

Maxwell recordings with repeated mapping channel IDs failed to load because the reader created duplicate signal IDs. The reader now follows routed channel order and keeps IDs with a single mapping entry, excluding repeated and unmapped IDs from headers and sample reads. It warns about repeated channel IDs. HDF5 buffer selection runs once so the remaining sample columns match the headers.

Picks up #1703 by @LeMuellerGuy and fixes #1702.

Added synthetic regressions for duplicate, missing and reordered mappings, empty wells, selected-channel reads and the legacy format. Tested with pytest -q neo/test/rawiotest/test_maxwellrawio.py::TestMaxwellRawIOSynthetic neo/test/rawiotest/test_baserawio.py.

Co-authored-by: Lennart 107409831+LeMuellerGuy@users.noreply.github.com

@alejoe91 alejoe91 self-assigned this Oct 5, 2026
@alejoe91 alejoe91 added this to the 0.14.6 milestone Oct 5, 2026
@zm711 zm711 removed this from the 0.14.6 milestone Oct 12, 2026
@Arthur031221
Arthur031221 force-pushed the fix-maxwell-routed-mapping-s75 branch from 1a880aa to 79afd99 Compare October 15, 2026 16:38
Comment thread neo/rawio/baserawio.py
else:
raise RuntimeError("Should never happen")

if buffer_slice is not None:

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.

I think we will need a discussion about this. We typically don't have folks edit the baserawio unless there is an obvious bug. Could you explain why we need to delete this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two deleted lines are the first of two identical selections. In the HDF5 branch of _get_analogsignal_chunk, raw_sigs[:, buffer_slice] runs, then the shared code after the if/elif chain (# this is a pre slicing when the stream does not contain all channels in the buffer) runs it again on the already selected array. That's harmless for None or slice(None), but slice(0, -1), an index array or a boolean mask fails or returns too few columns.

Nothing hits this today because maxwellrawio.py is the only HDF5 buffer reader and it sets _stream_buffer_slice[stream_id] to slice(None) for every stream. This PR drops repeated and unmapped channel IDs from the header, so it has to drop the matching raw rows through _stream_buffer_slice, which makes it the first to set a real selection there.

With h5py data through BaseRawWithBufferApiIO, test_baserawio.py from this branch fails 6 subtests on current master, for time_axis 0 and 1. slice(0, -1) gives (3, 3) instead of (3, 4), and the index array and boolean mask raise IndexError. With the three lines put back here, 7 of the 15 Maxwell synthetic subtests fail.

If you'd rather keep this PR to maxwellrawio.py, I can move the baserawio.py change and its test into a separate PR and rebase this one on it.

Restores the original single-line formatting of the sig_channels.append
call.

Co-authored-by: Lennart <107409831+LeMuellerGuy@users.noreply.github.com>

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.

Maxwell/MaxTwo header reading

3 participants