-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspikemonger.m
73 lines (55 loc) · 1.1 KB
/
spikemonger.m
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
63
64
65
66
67
68
69
70
71
72
function spikemonger(rootdir, varargin)
% spikemonger(rootdir)
%% parse varargin
% ================
REGRESSED = false;
PRE_MERGE = false;
POST_MERGE = false;
try
if nargin>1
if any(ismember({'regressed'}, varargin))
REGRESSED = true;
end
if any(ismember({'pre-merge'}, varargin))
PRE_MERGE = true;
end
if any(ismember({'post-merge'}, varargin))
POST_MERGE = true;
end
end
catch
end
%% initialise rootdir
% ======================
setpath;
if nargin==0
rootdir = pwd;
end
% put into structure
dirs = struct;
dirs.root = fixpath(rootdir);
% does the rootdir exist
n.files_in_dir = L(dir(dirs.root));
if n.files_in_dir == 0
error('input:error','no such rootdir');
end
% fix
dirs = fix_dirs_struct(dirs.root);
%% run on data set
% ====================
t0 = clock;
args = {};
if REGRESSED
args = [args, 'regressed'];
end
if PRE_MERGE
args = [args, 'pre-merge'];
elseif POST_MERGE
args = [args, 'post-merge'];
end
A1_convert_datafiles(dirs, args{:});
if ~PRE_MERGE
A2_autocut_clusters(dirs);
A3_analyse_clusters(dirs,'clusters_pentatrodes');
end
end