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

Allow export_report to run without waveforms #3493

Merged
merged 4 commits into from
Nov 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions src/spikeinterface/widgets/unit_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,18 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
# and use custum grid spec
fig = self.figure
nrows = 2
ncols = 3
ncols = 2
chrishalcrow marked this conversation as resolved.
Show resolved Hide resolved
if sorting_analyzer.has_extension("correlograms") or sorting_analyzer.has_extension("spike_amplitudes"):
ncols += 1
if sorting_analyzer.has_extension("waveforms"):
chrishalcrow marked this conversation as resolved.
Show resolved Hide resolved
ncols += 1
if sorting_analyzer.has_extension("spike_amplitudes"):
nrows += 1
gs = fig.add_gridspec(nrows, ncols)
col_counter = 0

if sorting_analyzer.has_extension("unit_locations"):
ax1 = fig.add_subplot(gs[:2, 0])
ax1 = fig.add_subplot(gs[:2, col_counter])
chrishalcrow marked this conversation as resolved.
Show resolved Hide resolved
# UnitLocationsPlotter().do_plot(dp.plot_data_unit_locations, ax=ax1)
w = UnitLocationsWidget(
sorting_analyzer,
Expand All @@ -126,6 +129,7 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
ax=ax1,
**unitlocationswidget_kwargs,
)
col_counter = col_counter + 1

unit_locations = sorting_analyzer.get_extension("unit_locations").get_data(outputs="by_unit")
unit_location = unit_locations[unit_id]
Expand All @@ -136,37 +140,41 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
ax1.set_xlabel(None)
ax1.set_ylabel(None)

ax2 = fig.add_subplot(gs[:2, 1])
ax2 = fig.add_subplot(gs[:2, col_counter])
w = UnitWaveformsWidget(
sorting_analyzer,
unit_ids=[unit_id],
unit_colors=unit_colors,
plot_templates=True,
plot_waveforms=sorting_analyzer.has_extension("waveforms"),
chrishalcrow marked this conversation as resolved.
Show resolved Hide resolved
same_axis=True,
plot_legend=False,
sparsity=sparsity,
backend="matplotlib",
ax=ax2,
**unitwaveformswidget_kwargs,
)
col_counter = col_counter + 1

ax2.set_title(None)

ax3 = fig.add_subplot(gs[:2, 2])
UnitWaveformDensityMapWidget(
sorting_analyzer,
unit_ids=[unit_id],
unit_colors=unit_colors,
use_max_channel=True,
same_axis=False,
backend="matplotlib",
ax=ax3,
**unitwaveformdensitymapwidget_kwargs,
)
ax3.set_ylabel(None)
if sorting_analyzer.has_extension("waveforms"):
ax3 = fig.add_subplot(gs[:2, col_counter])
UnitWaveformDensityMapWidget(
sorting_analyzer,
unit_ids=[unit_id],
unit_colors=unit_colors,
use_max_channel=True,
same_axis=False,
backend="matplotlib",
ax=ax3,
**unitwaveformdensitymapwidget_kwargs,
)
ax3.set_ylabel(None)
col_counter = col_counter + 1
chrishalcrow marked this conversation as resolved.
Show resolved Hide resolved

if sorting_analyzer.has_extension("correlograms"):
ax4 = fig.add_subplot(gs[:2, 3])
ax4 = fig.add_subplot(gs[:2, col_counter])
AutoCorrelogramsWidget(
sorting_analyzer,
unit_ids=[unit_id],
Expand All @@ -180,8 +188,8 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
ax4.set_yticks([])

if sorting_analyzer.has_extension("spike_amplitudes"):
ax5 = fig.add_subplot(gs[2, :3])
ax6 = fig.add_subplot(gs[2, 3])
ax5 = fig.add_subplot(gs[2, :col_counter])
ax6 = fig.add_subplot(gs[2, col_counter])
axes = np.array([ax5, ax6])
AmplitudesWidget(
sorting_analyzer,
Expand Down