Skip to content

Commit 2670f5a

Browse files
committed
Use SpikeSortingLoader instead of load_spike_sorting_fast
1 parent 0d80f27 commit 2670f5a

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

brainbox/io/one.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ class SpikeSortingLoader:
599599
This class can be instantiated in several manners
600600
- With Alyx database probe id:
601601
SpikeSortingLoader(pid=pid, one=one)
602-
- With Alyx database eic and probe name:
602+
- With Alyx database eid and probe name:
603603
SpikeSortingLoader(eid=eid, pname='probe00', one=one)
604604
- From a local session and probe name:
605605
SpikeSortingLoader(session_path=session_path, pname='probe00')

ibllib/plots/figures.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from brainbox.behavior.dlc import SAMPLING, plot_trace_on_frame, plot_wheel_position, plot_lick_hist, \
2727
plot_lick_raster, plot_motion_energy_hist, plot_speed_hist, plot_pupil_diameter_hist
2828
from brainbox.ephys_plots import image_lfp_spectrum_plot, image_rms_plot, plot_brain_regions
29-
from brainbox.io.one import load_spike_sorting_fast
29+
from brainbox.io.one import SpikeSortingLoader
3030
from brainbox.behavior import training
3131
from iblutil.numerical import ismember
3232
from ibllib.plots.misc import Density
@@ -360,11 +360,12 @@ def plot_driftmap(self, spikes, clusters, channels, collection):
360360
if all_here and len(output_files) == len(spike_sorting_runs):
361361
return output_files
362362
logger.info(self.output_directory)
363-
for run in spike_sorting_runs:
364-
collection = str(Path(run).parent.as_posix())
365-
spikes, clusters, channels = load_spike_sorting_fast(
366-
eid=self.eid, probe=self.pname, one=self.one, nested=False, collection=collection,
367-
dataset_types=['spikes.depths'], brain_regions=self.brain_regions)
363+
ss = SpikeSortingLoader(
364+
one=self.one, pid=self.pid, eid=self.eid, pname=self.pname, session_path=self.session_path)
365+
for run in map(self.session_path.joinpath, spike_sorting_runs):
366+
sorter = run.without_revision().relative_to(self.session_path / f'alf/{self.pname}')
367+
collection = run.relative_to(self.session_path).parent.as_posix()
368+
spikes, clusters, channels = ss.load_spike_sorting(spike_sorter=sorter, revision=run.revision or None)
368369

369370
if 'atlas_id' not in channels.keys():
370371
channels = self.get_channels('channels', collection)

ibllib/plots/snapshot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from one.api import ONE
99
from one.alf.spec import is_uuid
10+
from one.alf.path import ensure_alf_path
1011
from ibllib.pipes import tasks
1112
from one.alf.exceptions import ALFObjectNotFound
1213
from neuropixel import trace_header, TIP_SIZE_UM
@@ -70,7 +71,7 @@ def __init__(self, pid, session_path=None, one=None, brain_regions=None, brain_a
7071
self.content_type = 'probeinsertion'
7172
self.pid = pid
7273
self.eid, self.pname = self.one.pid2eid(self.pid)
73-
self.session_path = session_path or self.one.eid2path(self.eid)
74+
self.session_path = ensure_alf_path(session_path or self.one.eid2path(self.eid))
7475
self.output_directory = self.session_path.joinpath('snapshot', self.pname)
7576
self.output_directory.mkdir(exist_ok=True, parents=True)
7677
self.histology_status = None

0 commit comments

Comments
 (0)