-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCRSTooFastState.m
63 lines (51 loc) · 1.43 KB
/
CRSTooFastState.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
//
// CRSTooFastState.m
// Experiment
//
// Copyright (c) 2006. All rights reserved.
//
#import "CRSTooFastState.h"
#import "UtilityFunctions.h"
#import "CRSUtilities.h"
#define alpha 2.5
#define kBeta 2.0
@implementation CRSTooFastState
- (void)stateAction;
{
float prob100;
int tooFastMS;
LLGabor *gabor;
[[task dataDoc] putEvent:@"tooFast"];
tooFastMS = [[task defaults] integerForKey:CRSTooFastMSKey];
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 @"CRSTooFast";
}
- (LLState *)nextState {
if ([task mode] == kTaskIdle) { // switched to idle
eotCode = kMyEOTQuit;
return [[task stateSystem] stateNamed:@"Endtrial"];;
}
if (![[task defaults] boolForKey:CRSFixateKey]) {
eotCode = kMyEOTCorrect;
return [[task stateSystem] stateNamed:@"Endtrial"];;
}
else {
if (![CRSUtilities inWindow:fixWindow]) { // too fast reaction
eotCode = kMyEOTBroke;
return [[task stateSystem] stateNamed:@"CRSSaccade"];;
}
}
if ([LLSystemUtil timeIsPast:expireTime]) {
return [[task stateSystem] stateNamed:@"CRSReact"];
}
return nil;
}
@end