-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleanWrapper2.m
49 lines (42 loc) · 2.07 KB
/
cleanWrapper2.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
%% Wrapper 2
% Before running, make sure you have:
% 1. bhv2 file from the ML computer AND
% 2. Outputs from Facemap/DLC (pupil and motSVD)
% If using FM, convert outputs with jupyter notebook
% (Open anaconda prompt, type jupyter notebook, adjust filepath in facemap processing, run - comment out pupil if only doing motSVD)
%% Get BHV paths to find stimuli/response onsets/offsets
root ='Z:\AFdata\2p2019\Experiments\W10'; %% as character
ext = '.bhv2';
bhvdirs = findFILE(root,ext);
bhvPath = bhvdirs(:);
bhvPath = cellDirs(5:end);
for ii=1:length(bhvPath);
[~]= bhv2Convert(bhvPath{ii},'Z:\AFdata\2p2019'); %% MAKE SURE THERE IS A RUN # in THE .bhv2 FILE NAME (A 001 or 002 etc) IN THERE
end % config file (.txt with MonkeyLogic Conditions) should be in the 2p data folder
% configfile=fullfile(which([cname,'.txt']));'Z:\AFdata\2p2019\FC_baselinerand_200211.txt'
%% find stim times from nidaq output pulses
% ext1 = 'bhv.mat';
% bhvdirs = findFILE(root,ext1);
% bhvPath=bhvdirs(:);
%
% bhvPath=bhvdirs;
% for ii=1:length(bhvPath);
Stim=stimTimes(bhvPath{ii});
% end
%% plots of behavior (pupil, running, etc) during trials w/ stim
ext = '_stim';
stimdirs = findFILE(root,ext);
stimDirs=stimdirs(9);
time_window=90;
for ii=1:length(stimDirs) %should this go back to looking for dsnidaq? If there is no stim... skip behavior plots?
behaviorPlots(stimDirs{ii},time_window,'FC App Day 3') % last is custom label (useful for labeling behavioral day ex: FC)
end %still needs some cleaning/optimization (such as adding graphing fxn?)
%%%%%%%%%%%%%%%%%%%%%%%%%%%
trialLength=min(Stim.trialoffsets-Stim.trialonsets);
n=trialLength;
pos1Idx=Stim.trialonsets(Stim.condition==1)
pos2Idx=Stim.trialonsets(Stim.condition==2)
pos3Idx=Stim.trialonsets(Stim.condition==3)
pos4Idx=Stim.trialonsets(Stim.condition==4)
pos5Idx=Stim.trialonsets(Stim.condition==5)
pos6Idx=Stim.trialonsets(Stim.condition==6)