-
Notifications
You must be signed in to change notification settings - Fork 0
/
RewardsSection.m
49 lines (33 loc) · 1.46 KB
/
RewardsSection.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
function [] = RewardsSection(obj, action)
GetSoloFunctionArgs;
switch action
case 'init',
SoloParamHandle(obj, 'pstruct');
SoloParamHandle(obj, 'LastTrialEvents', 'value', []);
case 'trial_finished',
% Make sure we've collected up to the latest events from the RT machine:
RewardsSection(obj, 'update');
% Parse the events from the last trial:
pstruct.value = parse_trial(value(LastTrialEvents), RealTimeStates);
% % Parse the events from the last trial:
% pstruct.value = parse_trial(value(LastTrialEvents), RealTimeStates,...
% {'statename_list', 'all'}, {'parse_pokes', false});
% Take the current raw events and push them into the history:
push_history(LastTrialEvents); LastTrialEvents.value = [];
if rows(pstruct.extra_iti)>0 | rows(pstruct.miss)>0
hit = 0;
else
hit = 1;
end
hit_history.value = [hit_history(:) ; hit];
case 'update',
Event = GetParam('rpbox', 'event', 'user');
LastTrialEvents.value = [value(LastTrialEvents) ; Event];
case 'reinit',
% Delete all SoloParamHandles who belong to this object and whose
% fullname starts with the name of this mfile:
delete_sphandle('owner', ['^@' class(obj) '$'], ...
'fullname', ['^' mfilename]);
% Reinitialise
feval(mfilename, obj, 'init');
end;