Skip to content

Commit

Permalink
Merge pull request #2737 from alejoe91/add_events_on_traces
Browse files Browse the repository at this point in the history
Extend capabilities of plot_traces and spikes_on_traces
  • Loading branch information
samuelgarcia committed May 21, 2024
2 parents ce1deaf + d320dc8 commit 265b62e
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 69 deletions.
5 changes: 2 additions & 3 deletions src/spikeinterface/widgets/spikes_on_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def __init__(
self.check_extensions(sorting_analyzer, "unit_locations")

sorting: BaseSorting = sorting_analyzer.sorting
recording: BaseRecording = sorting_analyzer.recording

if unit_ids is None:
unit_ids = sorting.get_unit_ids()
Expand Down Expand Up @@ -219,9 +218,9 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):

nbefore = nafter = int(dp.spike_width_ms / 2 * sorting_analyzer.sampling_frequency / 1000)
waveform_idxs = spike_frames_to_plot[:, None] + np.arange(-nbefore, nafter) - frame_range[0]
waveform_idxs = np.clip(waveform_idxs, 0, len(traces_widget.data_plot["times"]) - 1)
waveform_idxs = np.clip(waveform_idxs, 0, len(traces_widget.data_plot["times_in_range"]) - 1)

times = traces_widget.data_plot["times"][waveform_idxs]
times = traces_widget.data_plot["times_in_range"][waveform_idxs]

# discontinuity
times[:, -1] = np.nan
Expand Down

0 comments on commit 265b62e

Please sign in to comment.