forked from restrepd-zz/dropc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdropcDoesMouseRespondNow_hfcm.m
134 lines (112 loc) · 4.6 KB
/
dropcDoesMouseRespondNow_hfcm.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
function didMouseRespond=dropcDoesMouseRespondNow_hf(handles)
% Does the mouse respond?
% didMouseRespond=1; Mouse responded
%
% didMouseRespond=0; Mouse did not respond
%
% didMouseRespond=2; This was a short
%First take animal through the short time
noSamples=0;
noSamplesMouseOn=0;
start_toc=toc;
didMousePoke=1;
% while toc-start_toc<handles.dropcProg.shortTime
% %noSamples=noSamples+1;
% if dropcNosePokeNow(handles)==1
% %noSamplesMouseOn=noSamplesMouseOn+1;
% didMousePoke=1;
% end
% end
%if (noSamplesMouseOn/noSamples) > 0.2
if didMousePoke==1
%Now take the animal through the RA
% isLicking = 0;
% dt_ra=0;
% % if handles.dropcProg.typeOfOdor==4
% %This is a begin session
% group=floor((handles.dropcData.trialIndex-1)/20)+1;
% if (group<=2)
% reqSegments=1;
% dt_ra=0.1*handles.dropcProg.dt_ra;
% else
% if (group<=4)
% reqSegments=1+(handles.dropcProg.noRAsegments-1)/3;
% dt_ra=0.25*handles.dropcProg.dt_ra;
% else
% if (group<=6)
% reqSegments=1+2*(handles.dropcProg.noRAsegments-1)/3;
% dt_ra=0.7*handles.dropcProg.dt_ra;
% else
% reqSegments=handles.dropcProg.noRAsegments;
% dt_ra=handles.dropcProg.dt_ra;
% end
% end
% end
%
% else
% %Otherwise the required number of segments is noRAsegments
% reqSegments=handles.dropcProg.noRAsegments;
% end
dt_ra=handles.dropcProg.dt_ra;
didLick=zeros(1,handles.dropcProg.noRAsegments);
for ii=1:handles.dropcProg.noRAsegments
end_toc=toc+dt_ra;
this_toc=toc;
while (this_toc<end_toc)
%lickStatus=dropcGetLickStatus(handles);
handles.dropcData.ii_lick(handles.dropcData.trialIndex)=handles.dropcData.ii_lick(handles.dropcData.trialIndex)+1;
handles.dropcData.lick_toc(handles.dropcData.trialIndex,handles.dropcData.ii_lick(handles.dropcData.trialIndex))=toc;
if (sum(getvalue(handles.dio.Line(25:32)))~=handles.dropcProg.sumNoLick)
%sum(handles.dropcProg.noLick))
%Mouse licked!
didLick(ii)=1;
handles.dropcData.lick(handles.dropcData.trialIndex,handles.dropcData.ii_lick(handles.dropcData.trialIndex))=1;
else
handles.dropcData.lick(handles.dropcData.trialIndex,handles.dropcData.ii_lick(handles.dropcData.trialIndex))=0;
end
this_toc=toc;
end
end
if sum(didLick)>=reqSegments
didMouseRespond=1;
%Notify odor on
handles.dropcData.eventIndex=handles.dropcData.eventIndex+1;
handles.dropcData.eventTime(handles.dropcData.eventIndex)=toc;
handles.dropcData.event(handles.dropcData.eventIndex)=3;
else
didMouseRespond=0;
%Notify odor on
handles.dropcData.eventIndex=handles.dropcData.eventIndex+1;
handles.dropcData.eventTime(handles.dropcData.eventIndex)=toc;
handles.dropcData.event(handles.dropcData.eventIndex)=4;
end
else
%This is a short
didMouseRespond=2;
%Notify odor on
handles.dropcData.eventIndex=handles.dropcData.eventIndex+1;
handles.dropcData.eventTime(handles.dropcData.eventIndex)=toc;
handles.dropcData.event(handles.dropcData.eventIndex)=5;
if handles.dropcProg.sendShorts==1
%Send a short
% handles.dropcDigOut.draqPortStatus=handles.dropcDraqOut.short_after+handles.dropcDraqOut.draq_trigger;
% dropcUpdateDraqPort(handles);
%
% start_toc=toc;
% while toc-start_toc<0.2
% end
%
%Extremely important. If you do not do this you do not transfer all
%trials to the draq computer
handles.dropcData.shortTime(handles.dropcData.shortIndex)=toc;
handles.dropcData.shortType(handles.dropcData.shortIndex)=2;
handles.dropcData.shortIndex(handles.dropcData.shortIndex)=handles.dropcData.shortIndex(handles.dropcData.shortIndex)+1;
handles.dropcDigOut.draqPortStatus=handles.dropcDraqOut.short_after;
dropcUpdateDraqPort(handles);
start_toc=toc;
while (toc-start_toc<0.3)
end
dropcStartDraq(handles)
end
pause(handles.dropcProg.timePerTrial)
end