Skip to content

Commit 80ba2e5

Browse files
committed
Review suggestions and test with scatter_decimate
1 parent cc550b9 commit 80ba2e5

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/spikeinterface/widgets/motion.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,19 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
232232

233233
dp = to_attr(data_plot)
234234

235-
assert backend_kwargs["axes"] is None, "axes argument is not allowed in MotionWidget"
235+
assert backend_kwargs["axes"] is None, "axes argument is not allowed in DriftRasterMapWidget. Use ax instead."
236236

237237
self.figure, self.axes, self.ax = make_mpl_figure(**backend_kwargs)
238-
fig = self.figure
239238

240239
if dp.times is None:
241-
x = dp.peaks["sample_index"] / dp.sampling_frequency
240+
peak_times = dp.peaks["sample_index"] / dp.sampling_frequency
242241
else:
243-
x = dp.times[dp.peaks["sample_index"]]
242+
peak_times = dp.times[dp.peaks["sample_index"]]
244243

245-
y = dp.peak_locations[dp.direction]
244+
peak_locs = dp.peak_locations[dp.direction]
246245
if dp.scatter_decimate is not None:
247-
x = x[:: dp.scatter_decimate]
248-
y = y[:: dp.scatter_decimate]
249-
y2 = y2[:: dp.scatter_decimate]
246+
peak_times = peak_times[:: dp.scatter_decimate]
247+
peak_locs = peak_locs[:: dp.scatter_decimate]
250248

251249
if dp.color_amplitude:
252250
amps = dp.peak_amplitudes
@@ -271,7 +269,7 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
271269
else:
272270
color_kwargs = dict(color=dp.color, c=None, alpha=dp.alpha)
273271

274-
self.ax.scatter(x, y, s=1, **color_kwargs)
272+
self.ax.scatter(peak_times, peak_locs, s=1, **color_kwargs)
275273
if dp.depth_lim is not None:
276274
self.ax.set_ylim(*dp.depth_lim)
277275
self.ax.set_title("Peak depth")

src/spikeinterface/widgets/tests/test_widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ def test_drift_raster_map(self):
613613
color_amplitude=False,
614614
)
615615
# with analyzer
616-
sw.plot_drift_raster_map(sorting_analyzer=analyzer, color_amplitude=True)
616+
sw.plot_drift_raster_map(sorting_analyzer=analyzer, color_amplitude=True, scatter_decimate=2)
617617

618618
def test_plot_motion_info(self):
619619
motion_info = self.motion_info

0 commit comments

Comments
 (0)