Skip to content

basesorting.py get_spike_trains method #3946

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
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
12 changes: 12 additions & 0 deletions src/spikeinterface/core/basesorting.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,18 @@ def to_spike_vector(

return spikes

def get_spike_trains(self):
"""
spike trains of sorter in recording time (seconds) of all units

Returns: dictionary with unit_id as keys and spike train in seconds as values
"""
spike_trains = {}
for unit_id in self.get_unit_ids():
spike_trains[unit_id] = self.get_unit_spike_train(unit_id) / self.sampling_frequency
# self.spike_trains = spike_trains
return spike_trains

def to_numpy_sorting(self, propagate_cache=True):
"""
Turn any sorting in a NumpySorting.
Expand Down