Skip to content
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

Merged
merged 3 commits into from
Jul 27, 2023

Conversation

hornauerp
Copy link
Contributor

@hornauerp hornauerp commented Jul 24, 2023

Fix for issue https://github.com/SpikeInterface/spikeinterface/issues/1691 that shuffled channels when selecting and concatenating channels from MaxWell recordings with different mappings.

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
@samuelgarcia
Copy link
Contributor

Thank you for the patch.

@alejoe91 : can you check this ?

@alejoe91
Copy link
Contributor

Thanks @hornauerp!

Could you add a plot with the behavior before and after the fix? :)

Comment on lines 186 to 188
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])
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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 ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

@hornauerp
Copy link
Contributor Author

hornauerp commented Jul 24, 2023

Before fix as shown in the original issue.

After fix (different recording though):
grafik

@apdavison apdavison merged commit 479c86f into NeuralEnsemble:master Jul 27, 2023
1 check passed
@apdavison apdavison added this to the 0.13.0 milestone Jul 27, 2023
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.

4 participants