-
Notifications
You must be signed in to change notification settings - Fork 163
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
Extend capabilities of plot_traces and spikes_on_traces #2737
Extend capabilities of plot_traces and spikes_on_traces #2737
Conversation
…add_events_on_traces
…face into add_events_on_traces
Here's a screencast of the new features :) Screencast.from.14-05-2024.17.03.22.webm@samuelgarcia good to merge on my side! |
src/spikeinterface/widgets/traces.py
Outdated
if not rec0.has_time_vector(): | ||
self.times = None | ||
t_start = 0 | ||
t_end = rec0.get_duration(segment_index=segment_index) | ||
else: | ||
self.times = rec0.get_times(segment_index=segment_index) | ||
t_start = self.times[0] | ||
t_end = self.times[-1] |
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.
This will not work when you have multiple segment and you use ipywidget because you can switch segment with a dropdone menu
We should have a list instead.
Am I wrong ?
Did you try with multi segment and several t_start and or times vector ?
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.
And more importantly we should not have attribute setting sin the init. Everything should be done with the data_plot.
@@ -203,6 +217,8 @@ def __init__( | |||
else: | |||
raise TypeError(f"'clim' can be None, tuple, or dict! Unsupported type {type(clim)}") | |||
|
|||
self.cb = None |
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.
To support multiple backend we have to avoid self in the init.
Put this in the data_plot.
ChannelSelector, | ||
ScaleWidget, | ||
) | ||
from .utils_ipywidgets import check_ipywidget_backend, TimeSlider, ChannelSelector, ScaleWidget, EventSelector |
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.
Having attributes settings here is OK.
@@ -422,20 +472,31 @@ def _mode_changed(self, change=None): | |||
else: | |||
self._update_plot() | |||
|
|||
def _event_changed(self, change=None): |
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.
You should handle the segment here.
src/spikeinterface/widgets/traces.py
Outdated
if self.times is not None: | ||
time_range = np.array([self.times[start_frame], self.times[end_frame]]) | ||
else: | ||
time_range = np.array([start_frame, end_frame]) / self.rec0.sampling_frequency |
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.
Same here you should handle the segment
This is cool. |
@samuelgarcia fixed now for multi-segments! Screencast.from.16-05-2024.15.40.44.webm |
times
when presentevents
on top of the traces (super useful to check artifacts, LFP responses, etc.)