Skip to content

Commit

Permalink
Merge pull request #2148 from zm711/export-phy
Browse files Browse the repository at this point in the history
Change phy exporter to not save `template_ind` in the case of dense waveform_extractor
  • Loading branch information
alejoe91 authored Nov 2, 2023
2 parents 40210c8 + 211208b commit 144945d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/spikeinterface/exporters/to_phy.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,16 @@ def export_to_phy(
"argument to enforce sparsity (see compute_sparsity())"
)

save_sparse = True
if waveform_extractor.is_sparse():
used_sparsity = waveform_extractor.sparsity
assert sparsity is None
if sparsity is not None:
warnings.warn("If the waveform_extractor is sparse the 'sparsity' argument is ignored")
elif sparsity is not None:
used_sparsity = sparsity
else:
used_sparsity = ChannelSparsity.create_dense(waveform_extractor)
save_sparse = False
# convenient sparsity dict for the 3 cases to retrieve channl_inds
sparse_dict = used_sparsity.unit_id_to_channel_indices

Expand Down Expand Up @@ -200,7 +203,8 @@ def export_to_phy(
template_similarity = compute_template_similarity(waveform_extractor, method="cosine_similarity")

np.save(str(output_folder / "templates.npy"), templates)
np.save(str(output_folder / "template_ind.npy"), templates_ind)
if save_sparse:
np.save(str(output_folder / "template_ind.npy"), templates_ind)
np.save(str(output_folder / "similar_templates.npy"), template_similarity)

channel_maps = np.arange(num_chans, dtype="int32")
Expand Down

0 comments on commit 144945d

Please sign in to comment.