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

Extend capabilities of plot_traces and spikes_on_traces #2737

Merged
merged 15 commits into from
May 21, 2024

Conversation

alejoe91
Copy link
Member

@alejoe91 alejoe91 commented Apr 19, 2024

  • use times when present
  • option to plot events on top of the traces (super useful to check artifacts, LFP responses, etc.)
  • add widget for event navigation
  • add checkbox to show/hide colorbar

@alejoe91 alejoe91 added the widgets Related to widgets module label Apr 19, 2024
@alejoe91 alejoe91 marked this pull request as ready for review May 2, 2024 08:18
@alejoe91
Copy link
Member Author

Here's a screencast of the new features :)

Screencast.from.14-05-2024.17.03.22.webm

@samuelgarcia good to merge on my side!

Comment on lines 123 to 130
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]
Copy link
Member

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 ?

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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):
Copy link
Member

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.

Comment on lines 487 to 490
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
Copy link
Member

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

@samuelgarcia
Copy link
Member

This is cool.
I made a few comments camarade.
We need to handle the multisegment times.
And also we must totally avoid the self.attr = value in the init.
Every thing must go into the data_plot.

@alejoe91
Copy link
Member Author

@samuelgarcia fixed now for multi-segments!

Screencast.from.16-05-2024.15.40.44.webm

@samuelgarcia samuelgarcia merged commit 265b62e into SpikeInterface:main May 21, 2024
11 checks passed
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.

None yet

3 participants