-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed bug in maxwellrawio.py that shuffled channels #1310
Conversation
Fix for issue SpikeInterface/spikeinterface#1691 that reshuffled channels when selecting and concatenating channels from MaxWell recordings.
Fixed bug in maxwellrawio.py that shuffled channels
Thank you for the patch. @alejoe91 : can you check this ? |
Thanks @hornauerp! Could you add a plot with the behavior before and after the fix? :) |
neo/rawio/maxwellrawio.py
Outdated
sorted_channel_indexes = np.sort(channel_indexes) | ||
resorted_indexes = np.array( | ||
[list(channel_indexes).index(ch) for ch in sorted_channel_indexes]) | ||
[list(sorted_channel_indexes).index(ch) for ch in channel_indexes]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hornauerp I think there is a better implementation.
Can you try if this gives the same result:
order_f = np.argsort(channel_indexes)
sorted_channel_idxeses = channel_indexes[order_f]
# use argsort again on order_f to obtain resorted_indexes
resorted_indexes = np.argsort(order_f)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, same outcome, but slightly faster. (17 vs 50 us)
I just wanted to stick to the original code as much as possible to facilitate the review process, but yours is definitely the more optimal implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, can you use the second implementation then?
Let's refresh the code ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
Fix for issue https://github.com/SpikeInterface/spikeinterface/issues/1691 that shuffled channels when selecting and concatenating channels from MaxWell recordings with different mappings.