-
Notifications
You must be signed in to change notification settings - Fork 223
Add peaks_on_probe widget. #3022
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
Add peaks_on_probe widget. #3022
Conversation
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.
Thanks @JoeZiminski
This is great! I have a few comments to be addressed :)
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.
One tiny discussion point and one docstring patch.
2603db6
to
8a7c145
Compare
@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). |
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.
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 theAxes
objects to a 1d array here. Is this okay?