-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess_Intan2KiloSort.m
More file actions
63 lines (53 loc) · 1.78 KB
/
Process_Intan2KiloSort.m
File metadata and controls
63 lines (53 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
function Process_Intan2KiloSort(fbasename,varargin)
% Pprocesses raw data from Intan, renames files and folders, concatenates
% dat files (if multiple) and runs KiloSort.
%
% USAGE
%
% Process_Intan2KiloSort(filebasename,<optional>mergename)
%
% filebasename a cell array of filebasenames (with or without '.dat' extenstion)
% mergename final concatenated file and folder name (if omitted,
% mergename will be the name of the current folder.
%
% Dependencies: KiloSortWrapper, KiloSort
% Copyright (C) 2016 Adrien Peyrache
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%% Parameters
%script in development to re-reference channels. Be cautious, may lacks
%dependencies
removeNoise = 0;
if isempty(varargin)
[~,mergename,~] = fileparts(pwd);
else
mergename = varargin{1};
end
fprintf('Processing %s...\n',mergename);
%% Rename and copy Intant folders
recList = Process_RenameCopyIntan(fbasename,mergename);
if isempty(recList)
error('No data folders!')
end
%% Re-reference data if needed, USE WITH PRECAUTIOUS
if removeNoise
for ii=1:length(recList)
Process_RemoveMuscleArtifactsFromDat(recList{ii},64,1:64,1:64)
end
end
%% Concatenate Data for Kilosort (or others)
Process_ConcatenateDatFiles(recList,mergename)
%% Copy files to new final directory
if length(recList)>1
mkdir(mergename)
end
movefile([mergename '.dat'],mergename,'f')
copyfile([recList{1} '.xml'],[mergename '.xml'],'f')
movefile([mergename '.xml'],mergename,'f')
%%Go to final folder and launch Kilosort
cd(mergename)
UpdateXml_SpkGrps(mergename)
KiloSortWrapper()