-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathThresholderNupMdown.j
69 lines (45 loc) · 1.56 KB
/
ThresholderNupMdown.j
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
/*
This file is part of FrACT10, a vision test battery.
Copyright © 2024 Michael Bach, bach@uni-freiburg.de, <https://michaelbach.de>
ThresholderNupMdown.j
Implementation of a n-up-m-down staircase
2024-05-26 begun
*/
@import "Thresholder.j";
@implementation ThresholderNupMdown : CPObject {
float appliedStimStored;
BOOL wasCorrectStored;
}
- (id)initWithNumAlternatives: (int) numAlternatives { //console.info("ThresholderNupMdown>init");
self = [super init];
if (self) {
}
return self;
}
- (void) unitTest {
for (let i = 0; i < 10; ++i) {
const stim = [self nextStim2apply];
console.info(i + " " + stim);
[self enterTrialOutcomeWithAppliedStim: stim wasCorrect: NO];
}
}
- (float) nextStim2apply { //console.info("ThresholderNupMdown>nextStim2apply");
return [self nextStimGivenAppliedStim: appliedStimStored wasCorrect: wasCorrectStored];
}
- (void) enterTrialOutcomeWithAppliedStim: (float) appliedStim wasCorrect: (BOOL) wasCorrect {
//console.info("ThresholderNupMdown>enterTrialOutcomeWithAppliedStim ", wasCorrect);
appliedStimStored = appliedStim;
wasCorrectStored = wasCorrect;
}
- (float) nextStimGivenAppliedStim: (float) appliedStim wasCorrect: (BOOL) wasCorrect {
const intStim = [self externalStim2internalStimGiven: appliedStim];
const retVal = [self internalStim2externalStimGiven: intStim];
return retVal;
}
- (int) externalStim2internalStimGiven: (float) extStim {
return extStim;
}
- (float) internalStim2externalStimGiven: (int) intStim {
return intStim;
}
@end