Skip to content

Commit b62e02b

Browse files
committed
export_report without waveforms
1 parent 65d4b1e commit b62e02b

1 file changed

Lines changed: 26 additions & 18 deletions

File tree

src/spikeinterface/widgets/unit_summary.py

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,18 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
107107
# and use custum grid spec
108108
fig = self.figure
109109
nrows = 2
110-
ncols = 3
110+
ncols = 2
111111
if sorting_analyzer.has_extension("correlograms") or sorting_analyzer.has_extension("spike_amplitudes"):
112112
ncols += 1
113+
if sorting_analyzer.has_extension("waveforms"):
114+
ncols += 1
113115
if sorting_analyzer.has_extension("spike_amplitudes"):
114116
nrows += 1
115117
gs = fig.add_gridspec(nrows, ncols)
118+
col_counter = 0
116119

117120
if sorting_analyzer.has_extension("unit_locations"):
118-
ax1 = fig.add_subplot(gs[:2, 0])
121+
ax1 = fig.add_subplot(gs[:2, col_counter])
119122
# UnitLocationsPlotter().do_plot(dp.plot_data_unit_locations, ax=ax1)
120123
w = UnitLocationsWidget(
121124
sorting_analyzer,
@@ -126,6 +129,7 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
126129
ax=ax1,
127130
**unitlocationswidget_kwargs,
128131
)
132+
col_counter = col_counter + 1
129133

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

139-
ax2 = fig.add_subplot(gs[:2, 1])
143+
ax2 = fig.add_subplot(gs[:2, col_counter])
140144
w = UnitWaveformsWidget(
141145
sorting_analyzer,
142146
unit_ids=[unit_id],
143147
unit_colors=unit_colors,
144148
plot_templates=True,
149+
plot_waveforms=sorting_analyzer.has_extension("waveforms"),
145150
same_axis=True,
146151
plot_legend=False,
147152
sparsity=sparsity,
148153
backend="matplotlib",
149154
ax=ax2,
150155
**unitwaveformswidget_kwargs,
151156
)
157+
col_counter = col_counter + 1
152158

153159
ax2.set_title(None)
154160

155-
ax3 = fig.add_subplot(gs[:2, 2])
156-
UnitWaveformDensityMapWidget(
157-
sorting_analyzer,
158-
unit_ids=[unit_id],
159-
unit_colors=unit_colors,
160-
use_max_channel=True,
161-
same_axis=False,
162-
backend="matplotlib",
163-
ax=ax3,
164-
**unitwaveformdensitymapwidget_kwargs,
165-
)
166-
ax3.set_ylabel(None)
161+
if sorting_analyzer.has_extension("waveforms"):
162+
ax3 = fig.add_subplot(gs[:2, col_counter])
163+
UnitWaveformDensityMapWidget(
164+
sorting_analyzer,
165+
unit_ids=[unit_id],
166+
unit_colors=unit_colors,
167+
use_max_channel=True,
168+
same_axis=False,
169+
backend="matplotlib",
170+
ax=ax3,
171+
**unitwaveformdensitymapwidget_kwargs,
172+
)
173+
ax3.set_ylabel(None)
174+
col_counter = col_counter + 1
167175

168176
if sorting_analyzer.has_extension("correlograms"):
169-
ax4 = fig.add_subplot(gs[:2, 3])
177+
ax4 = fig.add_subplot(gs[:2, col_counter])
170178
AutoCorrelogramsWidget(
171179
sorting_analyzer,
172180
unit_ids=[unit_id],
@@ -180,8 +188,8 @@ def plot_matplotlib(self, data_plot, **backend_kwargs):
180188
ax4.set_yticks([])
181189

182190
if sorting_analyzer.has_extension("spike_amplitudes"):
183-
ax5 = fig.add_subplot(gs[2, :3])
184-
ax6 = fig.add_subplot(gs[2, 3])
191+
ax5 = fig.add_subplot(gs[2, :col_counter])
192+
ax6 = fig.add_subplot(gs[2, col_counter])
185193
axes = np.array([ax5, ax6])
186194
AmplitudesWidget(
187195
sorting_analyzer,

0 commit comments

Comments
 (0)