-
Notifications
You must be signed in to change notification settings - Fork 0
/
OPTARGS.m
56 lines (43 loc) · 2.01 KB
/
OPTARGS.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
function Opt = gfmOptargs(varargin)
% Main optional argumeent structure for my overaching analyses
ip = inputParser;
% Characteristics of spikes/behavior data
ip.addParameter('unit', 'multiunit'); % spikes (curated firings) / Multiunit (uncurated firings)
ip.addParameter('upsample', false); % upsample behavior?
% Filtration
ip.addParameter('behFilter', 'abs($velVec) > 4'); % query to apply to all behavior
ip.addParameter('taskFilter', "string($type)==""run"""); % query epochs
ip.addParameter('cellFilter', 'ismember(string($area), ["CA1","PFC"]) & string($tag) ~= "artifcat" & $numspikes > 150'); %
% Shuffle and null distributions
ip.addParameter('shuffleStruct', []) % struct of shuffling instructions (Reruns all analyses requested with sequences of shuffles specified here)
ip.addParameter('nullMethod', []);
% Shortcut varargin into shuffleStruct options
ip.addParameter('nShuffle', []); % number of shuffles to generate
ip.addParameter('skipShuffled', []); % whether to skip already computed shuffles
% Analyses
ip.addParameter('analyses', ["jercog", "sarel", "dotson"]);
ip.addParameter('shift', -1:0.1:1);
% Checkpointing
ip.addParameter('checkpoint', 10); % checkpoints if > 1, where number for loops
% is how often,
% if logical, skip checkpoints in loops, but
% checkpoint everywhere else
ip.parse(varargin{:})
Opt = ip.Results;
% Shuffle struct specific modifications
if isempty(Opt.shuffleStruct)
Opt.shuffleStruct = units.shuffle.inputParser();
Opt.shuffleStruct.parse(varargin{:});
Opt.shuffleStruct = Opt.shuffleStruct.Results;
end
% Shortcuts
if isempty(Opt.nShuffle)
Opt.nShuffle = Opt.shuffleStruct.nShuffle;
end
if isempty(Opt.skipShuffled)
Opt.skipShuffled = Opt.shuffleStruct.skipShuffled;
end
% Taylor shuffle struture to the options above
Opt.shuffleStruct.query = Opt.behFilter;
% Convert Analyses to string, if not already
Opt.analyses = string(Opt.analyses);