Skip to content

Conversation

JoeZiminski
Copy link
Collaborator

@JoeZiminski JoeZiminski commented Jun 12, 2024

This PR adds a 'Peaks on Probe' widget that plots the peak locations overlaid on a plot of the probe (I am not a huge fan of the name myself, feel free to suggest others!). This PR closes #2986.

image

This plot has come up a few times in documentation and tutorials so I think could be a handy plotting function to have. A nice future addition would be to color-by-unit but if understand correctly from @samuelgarcia this is not currently possible as peaks do not hold unit. For me it is okay to include as-is and refine later if desired, the main reason I would like it is to import and call it from the motion/drift tutorial in #2879.

Overview

The function works by taking two main inputs, pre-calculated 'peaks' and corresponding 'peak_locations'. This can be either a single one of each or a list of corresponding entries. If multiple peaks / peak locations are passed, they are plot on different column axes of the same plot.

It is optional to select to only plot peaks from a certain segment, or between two times, to restrict the y-axis limits and to handle how peaks are decimated before plotting.

Questions

I think I might be using make_mpl_figure() wrong, I am performing 1 index operation to move the Axes objects to a 1d array here. Is this okay?

@alejoe91 alejoe91 added the widgets Related to widgets module label Jun 12, 2024
@samuelgarcia samuelgarcia added this to the 0.101.0 milestone Jun 12, 2024
@JoeZiminski JoeZiminski marked this pull request as ready for review June 13, 2024 07:52
@JoeZiminski JoeZiminski requested a review from alejoe91 June 13, 2024 07:52
Copy link
Member

@alejoe91 alejoe91 left a comment

Choose a reason for hiding this comment

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

Thanks @JoeZiminski

This is great! I have a few comments to be addressed :)

Copy link
Member

@zm711 zm711 left a comment

Choose a reason for hiding this comment

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

One tiny discussion point and one docstring patch.

@JoeZiminski JoeZiminski force-pushed the add_plot_spikes_on_probe_widget branch from 2603db6 to 8a7c145 Compare June 19, 2024 18:48
@JoeZiminski
Copy link
Collaborator Author

JoeZiminski commented Jun 19, 2024

@alejoe91 @samuelgarcia I squashed all commits into a single one that adds everything, then added a second one that removes the tests. If you are happy to add in this widget alone, the tests can be resurrected after the big refactoring. Assuming its okay to proceed like this, if this PR can be normal merged (not squash-merged) I'll refer to the commit that removes the test in issue #2986 to keep it tracked for posterity (although this is not strictly necessary if its a problem as I have a backup).

@alejoe91 alejoe91 merged commit e431bd6 into SpikeInterface:main Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
widgets Related to widgets module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is there a widget for plotting the 'peak localisation'?
4 participants