-
Notifications
You must be signed in to change notification settings - Fork 2
/
OlfactoryShapingV2.sc
74 lines (61 loc) · 1.61 KB
/
OlfactoryShapingV2.sc
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Name: OlfactoryShaping
%%
%% Purpose: Runs a task where the animal must hold its nose
%% in the nosepoke for an extended period of time to
%% receive a reward from a reward well
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%port variables
int reward_port = 1
%poke variables
int nose_in = 0
int nose_check_interval = 100
int nose_held_time
int nose_held_time_start
%reward variables
int reward_delivery_time = 500
int rewards_earned = 0
%loop variables
int not_exit_condition = 1;
function 1
not_exit_condition=1
while not_exit_condition == 1 do every nose_check_interval
if nose_in == 1 do
nose_held_time = clock() - nose_held_time_start
end
<<<<<<< HEAD
if (nose_held_time >=250) && (nose_in == 1) do
=======
if (nose_held_time >=500) && (nose_in == 1) do
>>>>>>> 57450bfdae4431b2475a81101d25d503a83338f0
disp('Nose held time is acceptable.')
disp(nose_held_time)
portout[reward_port] = 1
not_exit_condition = 0
rewards_earned = rewards_earned + 1
disp(rewards_earned)
do in reward_delivery_time
portout[reward_port] = 0
disp('reward off')
end
end
end
end;
% Nose Poke Callback
callback portin[1] up
disp('Nose Poke!')
nose_in = 1
nose_held_time_start = clock()
trigger(1)
end;
% Nose Out Callback
callback portin[1] down
disp('Nose out!')
disp(nose_held_time)
nose_held_time = 0
nose_in = 0
not_exit_condition = 0
end;