Skip to content

Commit 7e53523

Browse files
author
Nikhil Chandra
committed
Removed unnecessary list comprehensions and downstream array operations.
1 parent 6661cc9 commit 7e53523

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

src/spikeinterface/sorters/external/kilosort4.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -388,22 +388,23 @@ def _setup_json_probe_map(cls, recording, sorter_output_folder):
388388
"""Create a JSON probe map file for Kilosort4."""
389389
from kilosort.io import save_probe
390390
import numpy as np
391-
391+
392392
groups = recording.get_channel_groups()
393393
positions = np.array(recording.get_channel_locations())
394394
if positions.shape[1] != 2:
395395
raise RuntimeError("3D 'location' are not supported. Set 2D locations instead.")
396-
397-
nchan = recording.get_num_channels()
398-
xcoords = ([p[0] for p in positions],)
399-
ycoords = ([p[1] for p in positions],)
400-
kcoords = (groups,)
401-
396+
397+
n_chan = recording.get_num_channels()
398+
chanMap = np.arange(n_chan)
399+
xc = positions[:, 0]
400+
yc = positions[:, 1]
401+
kcoords = groups.astype(float)
402+
402403
probe = {
403-
'chanMap': np.arange(nchan),
404-
'xc': np.array(xcoords[0]).astype(float).squeeze(),
405-
'yc': np.array(ycoords[0]).astype(float).squeeze(),
406-
'kcoords': np.array(kcoords).astype(float).squeeze(),
407-
'n_chan': nchan,
404+
'chanMap': chanMap,
405+
'xc': xc,
406+
'yc': yc,
407+
'kcoords': kcoords,
408+
'n_chan': n_chan,
408409
}
409-
save_probe(probe, str(sorter_output_folder / "chanMap.json"))
410+
save_probe(probe, str(sorter_output_folder / "chanMap.json"))

0 commit comments

Comments
 (0)