-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildWL_2pad.m
53 lines (45 loc) · 2.18 KB
/
buildWL_2pad.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 buildWL_2pad(whisker_d, rInMm, varargin)
p = inputParser;
p.addRequired('whisker_d', @ischar);
p.addRequired('rInMm', @isnumeric);
p.addParameter('b_session', [], @(x) isa(x,'Solo.BehavTrial2padArray'));
p.addParameter('touchKappaSTDthreshold', 2, @isnumeric);
p.addParameter('whiskingAmpThreshold', 2.5, @isnumeric);
p.addParameter('stdHistogramThreshold', 3, @isnumeric);
p.addParameter('distanceHistogramBin', 0.2, @isnumeric);
p.addParameter('touchBoundaryThickness', 0.25, @isnumeric);
p.addParameter('touchBoundaryBuffer', 0.1, @isnumeric);
p.addParameter('maxPointsNearHyperplane', 10, @isnumeric);
p.parse(whisker_d, rInMm,varargin{:});
cd(whisker_d)
wstFnList = dir('*_WST.mat');
wstTrialFn = cell(length(wstFnList),1);
for i = 1 : length(wstFnList)
wstTrialFn{i} = wstFnList(i).name(1:end-8);
end
% wlFnList = dir('*_WL_2pad.mat');
% wlTrialFn = cell(length(wlFnList),1);
% for i = 1 : length(wlFnList)
% wlTrialFn{i} = wlFnList(i).name(1:end-12);
% end
% fnind = find(~ismember(wstTrialFn, wlTrialFn));
% wstTrialFn = wstTrialFn(fnind);
% load(wstFnList(1).name)
%
% loadfn = [ws.mouseName, ws.sessionName, '_touch_hp.mat'];
hpfn = dir('*_touch_hp.mat');
if length(hpfn) == 1
load(hpfn(1).name)
elseif length(hpfn) == 0
error('No touch hp file')
else
error('Too many hp files')
end
if ~isempty(p.Results.b_session)
Whisker.makeAllDirectory_WhiskerTrialLite_2pad(whisker_d, 'include_files', wstTrialFn, 'calc_forces', false, 'rInMm', rInMm, ...
'behavior', p.Results.b_session, 'hp_peaks', hp_peaks, 'touch_hp', touch_hp, 'psi1', psi1, 'psi2', psi2, ...
'servo_distance_pair', servo_distance_pair, 'touchKappaSTDthreshold', p.Results.touchKappaSTDthreshold, 'whiskingAmpThreshold', p.Results.whiskingAmpThreshold, 'stdHistogramThreshold', p.Results.stdHistogramThreshold, ...
'distanceHistogramBin', p.Results.distanceHistogramBin, 'touchBoundaryThickness', p.Results.touchBoundaryThickness, 'touchBoundaryBuffer', p.Results.touchBoundaryBuffer, 'maxPointsNearHyperplane', p.Results.maxPointsNearHyperplane);
else
Whisker.makeAllDirectory_WhiskerTrialLite_2pad(whisker_d, 'include_files', wstTrialFn, 'calc_forces', false, 'rInMm', rInMm);
end