Skip to content

Commit a43672d

Browse files
committed
multi-kilosort relative path bugfix
1 parent 583b625 commit a43672d

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

preProcessing/PreprocessSpikes.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ function PreprocessSpikes(basepath, varargin)
5454
prePhy = p.Results.prePhy;
5555
datFolder = p.Results.datFolder;
5656
spikeLabels = p.Results.spikeLabels; %spike labels is causing issues even when no bad channels are noted - Heathlarsson 05/29/23
57-
5857
%% 1- extract spike times and waveforms for sorted clusters
5958
cd(basepath);
6059
basename = basenameFromBasepath(pwd);
@@ -72,8 +71,13 @@ function PreprocessSpikes(basepath, varargin)
7271
end
7372

7473
if isfield(session.spikeSorting{1, 1}, 'relativePath') && exist(session.spikeSorting{1, 1}.relativePath, 'dir')
75-
f.name = session.spikeSorting{:}.relativePath;
76-
f.folder = basepath;
74+
f = struct();
75+
for sorting_i = 1:length(session.spikeSorting)
76+
f(sorting_i).name = session.spikeSorting{sorting_i}.relativePath;
77+
f(sorting_i).folder = basepath;
78+
end
79+
% transpose to work with current uses of size
80+
f = f';
7781
else
7882
f = dir('Kilosort*');
7983
if (size(f, 1) ~= 1) && (~multiKilosort)
@@ -87,9 +91,6 @@ function PreprocessSpikes(basepath, varargin)
8791
% Make sure there is only one KiloSort folder before running, unless you
8892
% needed to spike sort probes separately (multiKilosort=1).
8993

90-
% The hippocampal KiloSort folder should be listed first in the session
91-
% folder for organization, but this is not necessary for running
92-
9394
% check if spikes.cellinfo has already been created
9495
pre_exist_spike_files = dir('*spikes*.cellinfo.mat');
9596
if (size(f, 1) > 1) && multiKilosort
@@ -173,7 +174,6 @@ function PreprocessSpikes(basepath, varargin)
173174
'labelsToRead', spikeLabels);
174175
end
175176
end
176-
177177
%% 2 - compute basic cell metrics
178178
if exist([basepath, filesep, 'anatomical_map.csv'], 'file')
179179
channel_mapping;
@@ -206,6 +206,6 @@ function PreprocessSpikes(basepath, varargin)
206206

207207
% GUI to manually curate cell classification
208208
if showCellMet
209-
cell_metrics = CellExplorer('metrics', cell_metrics);
209+
CellExplorer('metrics', cell_metrics);
210+
end
210211
end
211-
end

0 commit comments

Comments
 (0)