Repository navigation
Fix Maxwell routed channel mapping - #1909
Arthur031221 wants to merge 2 commits into
Conversation
1a880aa to
79afd99
Compare
| else: | ||
| raise RuntimeError("Should never happen") | ||
|
|
||
| if buffer_slice is not None: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
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