forked from supratimray/GaborRFMap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGRFTooFastState.m
63 lines (51 loc) · 1.43 KB
/
GRFTooFastState.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
//
// GRFTooFastState.m
// Experiment
//
// Copyright (c) 2006. All rights reserved.
//
#import "GRFTooFastState.h"
#import "UtilityFunctions.h"
#import "GRFUtilities.h"
#define alpha 2.5
#define kBeta 2.0
@implementation GRFTooFastState
- (void)stateAction;
{
float prob100;
int tooFastMS;
LLGabor *gabor;
[[task dataDoc] putEvent:@"tooFast"];
tooFastMS = [[task defaults] integerForKey:GRFTooFastMSKey];
expireTime = [LLSystemUtil timeFromNow:tooFastMS];
// Here we instruct the fake monkey to respond, using appropriate psychophysics.
prob100 = 100.0 - 50.0 * exp(-exp(log(trial.orientationChangeDeg / alpha) * kBeta));
if ((rand() % 100) < prob100) {
gabor = [stimuli taskGabor];
[[task synthDataDevice] setEyeTargetOn:NSMakePoint([gabor azimuthDeg], [gabor elevationDeg])];
}
}
- (NSString *)name {
return @"GRFTooFast";
}
- (LLState *)nextState {
if ([task mode] == kTaskIdle) { // switched to idle
eotCode = kMyEOTQuit;
return [[task stateSystem] stateNamed:@"Endtrial"];;
}
if (![[task defaults] boolForKey:GRFFixateKey]) {
eotCode = kMyEOTCorrect;
return [[task stateSystem] stateNamed:@"Endtrial"];;
}
else {
if (![GRFUtilities inWindow:fixWindow]) { // too fast reaction
eotCode = kMyEOTBroke;
return [[task stateSystem] stateNamed:@"GRFSaccade"];;
}
}
if ([LLSystemUtil timeIsPast:expireTime]) {
return [[task stateSystem] stateNamed:@"GRFReact"];
}
return nil;
}
@end