-
Notifications
You must be signed in to change notification settings - Fork 190
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 subwidget parameters for UnitSummaryWidget #3242
Add subwidget parameters for UnitSummaryWidget #3242
Conversation
Maybe @samuelgarcia would feel differently, but I would actually like the idea of a nested dict instead of multiple dicts. Maybe @h-mayorquin would also like to weigh in on the design choice. So it would be something like widget_param_dict = dict(amplitude_params=xx, etc) And then if None you make an empty dict and just iterate through the keys to create your sub dictionaries. That way if we changes the widgets it would be easy to change that internally without breaking the external API. |
…orian6973/spikeinterface into florian6973_unitsummarywidget
for more information, see https://pre-commit.ci
Thanks for your feedback! I just did the change to a nested dict :) |
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 @florian6973
I have a suggestion on the naming of the additional params
Thanks for your suggestion! Just implemented the changes. Example: import spikeinterface.full as si
import spikeinterface.widgets as sw
rec, sort = si.generate_ground_truth_recording(num_channels=4)
sa = si.create_sorting_analyzer(sort, rec)
sa.compute(["random_spikes", "templates", "spike_amplitudes", "waveforms"])
sw.plot_unit_summary(sa, 0, widget_params=dict(unit_waveforms={"plot_channels": True}, amplitudes={"bins": 5})) |
@@ -70,6 +81,13 @@ def plot_matplotlib(self, data_plot, **backend_kwargs): | |||
unit_colors = dp.unit_colors | |||
sparsity = dp.sparsity | |||
|
|||
widget_params = defaultdict(lambda: dict(), dp.widget_params) |
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.
cool! I did not know about that defaultdict
. Might be adding a quick comment like # Returns an empty dict if the key is not in passed in dp.widget_params
, but maybe this is quite widely known and doesn't need the comment
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.
Just added a comment :)
Hey @florian6973 this is really cool! I played around with it and it was working well. I had one small point above and two below, please feel free to ignore them they are minor.
|
Thanks for your feedback! Just pushed some changes to rename the variables and add a clearer error message for this edge case. import spikeinterface.full as si
import spikeinterface.widgets as sw
rec, sort = si.generate_ground_truth_recording(num_channels=4)
sa = si.create_sorting_analyzer(sort, rec)
sa.compute(["random_spikes", "templates", "spike_amplitudes", "waveforms"])
sw.plot_unit_summary(sa, 0, unit_colors=['r'], subwidget_kwargs=dict(unit_waveforms={"plot_channels": True}, amplitudes={"bins": 5}))
from matplotlib import pyplot as plt
plt.show() |
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.
Add space before colon
Oh so sorry! Thank you for adding them again |
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 Florent!
Hi,
As discussed in #3222, here is a very small PR to add this feature. Please let me know if you would like any changes before merging.
To test:
Best,