@decidables/detectable-elements 0.2.15 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +150 -14
- package/lib/detectableElements.esm.js +4412 -3673
- package/lib/detectableElements.esm.js.map +1 -1
- package/lib/detectableElements.esm.min.js +833 -530
- package/lib/detectableElements.esm.min.js.map +1 -1
- package/lib/detectableElements.umd.js +4413 -3673
- package/lib/detectableElements.umd.js.map +1 -1
- package/lib/detectableElements.umd.min.js +833 -530
- package/lib/detectableElements.umd.min.js.map +1 -1
- package/package.json +5 -5
- package/src/components/detectable-control.js +8 -6
- package/src/components/detectable-response.js +24 -0
- package/src/components/index.js +4 -3
- package/src/components/roc-space.js +15 -11
- package/src/components/sdt-model.js +101 -98
- package/src/components/sdt-parameters.js +163 -0
- package/src/equations/dc2far.js +28 -7
- package/src/equations/dc2hr.js +29 -7
- package/src/equations/facr2far.js +19 -3
- package/src/equations/hfa2ppv.js +19 -3
- package/src/equations/hm2hr.js +19 -3
- package/src/equations/hmfacr2acc.js +31 -5
- package/src/equations/hrfar2c.js +29 -5
- package/src/equations/hrfar2d.js +29 -5
- package/src/equations/mcr2fomr.js +19 -3
- package/src/examples/double-interactive.js +1 -1
- package/src/examples/human.js +221 -89
- package/src/examples/interactive.js +226 -88
- package/src/examples/model.js +222 -97
- package/src/examples/multiple.js +1 -1
package/src/examples/model.js
CHANGED
|
@@ -8,61 +8,136 @@ import SDTExample from './sdt-example';
|
|
|
8
8
|
<sdt-example-model>
|
|
9
9
|
*/
|
|
10
10
|
export default class SDTExampleModel extends SDTExample {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
trials: {
|
|
14
|
+
attribute: 'trials',
|
|
15
|
+
type: Number,
|
|
16
|
+
reflect: true,
|
|
17
|
+
},
|
|
18
|
+
duration: {
|
|
19
|
+
attribute: 'duration',
|
|
20
|
+
type: Number,
|
|
21
|
+
reflect: true,
|
|
22
|
+
},
|
|
23
|
+
coherence: {
|
|
24
|
+
attribute: 'coherence',
|
|
25
|
+
type: Number,
|
|
26
|
+
reflect: true,
|
|
27
|
+
},
|
|
28
|
+
color: {
|
|
29
|
+
attribute: 'color',
|
|
30
|
+
type: String,
|
|
31
|
+
reflect: true,
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
d: {
|
|
35
|
+
attribute: 'd',
|
|
36
|
+
type: Number,
|
|
37
|
+
reflect: true,
|
|
38
|
+
},
|
|
39
|
+
c: {
|
|
40
|
+
attribute: 'c',
|
|
41
|
+
type: Number,
|
|
42
|
+
reflect: true,
|
|
43
|
+
},
|
|
44
|
+
s: {
|
|
45
|
+
attribute: 's',
|
|
46
|
+
type: Number,
|
|
47
|
+
reflect: true,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
h: {
|
|
51
|
+
attribute: false,
|
|
52
|
+
type: Number,
|
|
53
|
+
reflect: false,
|
|
54
|
+
},
|
|
55
|
+
m: {
|
|
56
|
+
attribute: false,
|
|
57
|
+
type: Number,
|
|
58
|
+
reflect: false,
|
|
59
|
+
},
|
|
60
|
+
fa: {
|
|
61
|
+
attribute: false,
|
|
62
|
+
type: Number,
|
|
63
|
+
reflect: false,
|
|
64
|
+
},
|
|
65
|
+
cr: {
|
|
66
|
+
attribute: false,
|
|
67
|
+
type: Number,
|
|
68
|
+
reflect: false,
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
hr: {
|
|
72
|
+
attribute: false,
|
|
73
|
+
type: Number,
|
|
74
|
+
reflect: false,
|
|
75
|
+
},
|
|
76
|
+
far: {
|
|
77
|
+
attribute: false,
|
|
78
|
+
type: Number,
|
|
79
|
+
reflect: false,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
constructor() {
|
|
85
|
+
super();
|
|
86
|
+
|
|
87
|
+
this.trials = 10;
|
|
88
|
+
this.duration = 2000;
|
|
89
|
+
this.coherence = 0.5;
|
|
90
|
+
this.color = 'all';
|
|
91
|
+
|
|
92
|
+
this.d = SDTMath.s.DEFAULT;
|
|
93
|
+
this.c = SDTMath.s.DEFAULT;
|
|
94
|
+
this.s = SDTMath.s.DEFAULT;
|
|
95
|
+
|
|
96
|
+
this.h = 0;
|
|
97
|
+
this.m = 0;
|
|
98
|
+
this.fa = 0;
|
|
99
|
+
this.cr = 0;
|
|
100
|
+
|
|
101
|
+
this.hr = 0.5;
|
|
102
|
+
this.far = 0.5;
|
|
103
|
+
|
|
104
|
+
this.detectableControl = null;
|
|
105
|
+
this.detectableResponse = null;
|
|
106
|
+
this.detectableTable = null;
|
|
107
|
+
this.rdkTask = null;
|
|
108
|
+
this.rocSpace = null;
|
|
109
|
+
this.sdtModel = null;
|
|
110
|
+
this.sdtParameters = null;
|
|
111
|
+
}
|
|
112
|
+
|
|
11
113
|
connectedCallback() {
|
|
12
114
|
super.connectedCallback();
|
|
13
115
|
|
|
14
|
-
this.count = 1;
|
|
15
|
-
|
|
16
116
|
this.detectableControl = this.querySelector('detectable-control');
|
|
17
|
-
this.rdkTask = this.querySelector('rdk-task');
|
|
18
|
-
this.sdtModel = this.querySelector('sdt-model');
|
|
19
117
|
this.detectableResponse = this.querySelector('detectable-response');
|
|
20
118
|
this.detectableTable = this.querySelector('detectable-table');
|
|
119
|
+
this.rdkTask = this.querySelector('rdk-task');
|
|
21
120
|
this.rocSpace = this.querySelector('roc-space');
|
|
121
|
+
this.sdtModel = this.querySelector('sdt-model');
|
|
122
|
+
this.sdtParameters = this.querySelector('sdt-parameters');
|
|
22
123
|
|
|
23
|
-
if (this.detectableControl
|
|
24
|
-
this.detectableControl.addEventListener('detectable-control-
|
|
25
|
-
|
|
26
|
-
this.sdtModel.color = event.detail.color;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (this.detectableTable) {
|
|
30
|
-
this.detectableTable.color = event.detail.color;
|
|
31
|
-
}
|
|
124
|
+
if (this.detectableControl) {
|
|
125
|
+
this.detectableControl.addEventListener('detectable-control-trials', (event) => {
|
|
126
|
+
this.trials = event.detail.trials;
|
|
32
127
|
});
|
|
33
|
-
}
|
|
34
128
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (this.rdkTask) {
|
|
38
|
-
this.rdkTask.duration = event.detail.duration;
|
|
39
|
-
this.rdkTask.wait = event.detail.duration;
|
|
40
|
-
this.rdkTask.iti = event.detail.duration;
|
|
41
|
-
}
|
|
129
|
+
this.detectableControl.addEventListener('detectable-control-coherence', (event) => {
|
|
130
|
+
this.coherence = event.detail.coherence;
|
|
42
131
|
});
|
|
43
|
-
}
|
|
44
132
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (this.rdkTask) {
|
|
48
|
-
this.rdkTask.trials = event.detail.trials;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (this.detectableResponse) {
|
|
52
|
-
this.detectableResponse.trialTotal = event.detail.trials;
|
|
53
|
-
}
|
|
133
|
+
this.detectableControl.addEventListener('detectable-control-duration', (event) => {
|
|
134
|
+
this.duration = event.detail.duration;
|
|
54
135
|
});
|
|
55
|
-
}
|
|
56
136
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (this.rdkTask) {
|
|
60
|
-
this.rdkTask.coherence = event.detail.coherence;
|
|
61
|
-
}
|
|
137
|
+
this.detectableControl.addEventListener('detectable-control-color', (event) => {
|
|
138
|
+
this.color = event.detail.color;
|
|
62
139
|
});
|
|
63
|
-
}
|
|
64
140
|
|
|
65
|
-
if (this.detectableControl && this.detectableControl.hasAttribute('run')) {
|
|
66
141
|
this.detectableControl.addEventListener('detectable-control-run', (/* event */) => {
|
|
67
142
|
if (this.rdkTask) {
|
|
68
143
|
this.rdkTask.running = true;
|
|
@@ -71,9 +146,7 @@ export default class SDTExampleModel extends SDTExample {
|
|
|
71
146
|
this.sdtModel.resumeTrial();
|
|
72
147
|
}
|
|
73
148
|
});
|
|
74
|
-
}
|
|
75
149
|
|
|
76
|
-
if (this.detectableControl && this.detectableControl.hasAttribute('pause')) {
|
|
77
150
|
this.detectableControl.addEventListener('detectable-control-pause', (/* event */) => {
|
|
78
151
|
if (this.rdkTask) {
|
|
79
152
|
this.rdkTask.running = false;
|
|
@@ -82,9 +155,7 @@ export default class SDTExampleModel extends SDTExample {
|
|
|
82
155
|
this.sdtModel.pauseTrial();
|
|
83
156
|
}
|
|
84
157
|
});
|
|
85
|
-
}
|
|
86
158
|
|
|
87
|
-
if (this.detectableControl && this.detectableControl.hasAttribute('reset')) {
|
|
88
159
|
this.detectableControl.addEventListener('detectable-control-reset', (/* event */) => {
|
|
89
160
|
if (this.rdkTask) {
|
|
90
161
|
this.rdkTask.reset();
|
|
@@ -98,31 +169,16 @@ export default class SDTExampleModel extends SDTExample {
|
|
|
98
169
|
this.sdtModel.reset();
|
|
99
170
|
}
|
|
100
171
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.detectableTable.cr = 0;
|
|
106
|
-
}
|
|
172
|
+
this.h = 0;
|
|
173
|
+
this.m = 0;
|
|
174
|
+
this.fa = 0;
|
|
175
|
+
this.cr = 0;
|
|
107
176
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.count += 1;
|
|
111
|
-
this.rocSpace.set(0.5, 0.5, `point${this.count}`, '', 1);
|
|
112
|
-
} else {
|
|
113
|
-
this.rocSpace.hr = 0.5;
|
|
114
|
-
this.rocSpace.far = 0.5;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
177
|
+
this.hr = 0.5;
|
|
178
|
+
this.far = 0.5;
|
|
117
179
|
});
|
|
118
180
|
}
|
|
119
181
|
|
|
120
|
-
if (this.rdkTask) {
|
|
121
|
-
if (this.detectableResponse) {
|
|
122
|
-
this.detectableResponse.trialTotal = this.rdkTask.trials;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
182
|
if (this.rdkTask) {
|
|
127
183
|
this.rdkTask.addEventListener('rdk-trial-start', (event) => {
|
|
128
184
|
if (this.detectableResponse) {
|
|
@@ -138,25 +194,19 @@ export default class SDTExampleModel extends SDTExample {
|
|
|
138
194
|
);
|
|
139
195
|
}
|
|
140
196
|
});
|
|
141
|
-
}
|
|
142
197
|
|
|
143
|
-
|
|
144
|
-
this.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
149
|
-
}
|
|
198
|
+
// this.rdkTask.addEventListener('rdk-trial-middle', (/* event */) => {
|
|
199
|
+
// if (this.sdtModel) {
|
|
200
|
+
// this.sdtModel.trial(event.detail.trial, event.detail.signal);
|
|
201
|
+
// }
|
|
202
|
+
// });
|
|
150
203
|
|
|
151
|
-
if (this.rdkTask) {
|
|
152
204
|
this.rdkTask.addEventListener('rdk-trial-end', (/* event */) => {
|
|
153
205
|
if (this.detectableResponse) {
|
|
154
206
|
this.detectableResponse.stop();
|
|
155
207
|
}
|
|
156
208
|
});
|
|
157
|
-
}
|
|
158
209
|
|
|
159
|
-
if (this.rdkTask) {
|
|
160
210
|
this.rdkTask.addEventListener('rdk-block-end', (/* event */) => {
|
|
161
211
|
if (this.detectableControl) {
|
|
162
212
|
this.detectableControl.complete();
|
|
@@ -170,36 +220,111 @@ export default class SDTExampleModel extends SDTExample {
|
|
|
170
220
|
this.detectableResponse.responded(event.detail.response);
|
|
171
221
|
}
|
|
172
222
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this.detectableTable.cr = event.detail.cr;
|
|
178
|
-
}
|
|
223
|
+
this.h = event.detail.h;
|
|
224
|
+
this.m = event.detail.m;
|
|
225
|
+
this.fa = event.detail.fa;
|
|
226
|
+
this.cr = event.detail.cr;
|
|
179
227
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
this.rocSpace.far = SDTMath.faCr2Far((event.detail.fa), (event.detail.cr));
|
|
183
|
-
}
|
|
228
|
+
this.hr = SDTMath.hM2Hr(this.h, this.m);
|
|
229
|
+
this.far = SDTMath.faCr2Far(this.fa, this.cr);
|
|
184
230
|
});
|
|
185
|
-
}
|
|
186
231
|
|
|
187
|
-
if (this.sdtModel) {
|
|
188
232
|
this.sdtModel.addEventListener('sdt-model-change', (event) => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.detectableTable.fa = event.detail.fa;
|
|
193
|
-
this.detectableTable.cr = event.detail.cr;
|
|
194
|
-
}
|
|
233
|
+
this.d = event.detail.d;
|
|
234
|
+
this.c = event.detail.c;
|
|
235
|
+
this.s = event.detail.s;
|
|
195
236
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
237
|
+
this.h = event.detail.h;
|
|
238
|
+
this.m = event.detail.m;
|
|
239
|
+
this.fa = event.detail.fa;
|
|
240
|
+
this.cr = event.detail.cr;
|
|
241
|
+
|
|
242
|
+
this.hr = SDTMath.hM2Hr(this.h, this.m);
|
|
243
|
+
this.far = SDTMath.faCr2Far(this.fa, this.cr);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (this.sdtParameters) {
|
|
248
|
+
this.sdtParameters.addEventListener('sdt-parameters-d', (event) => {
|
|
249
|
+
this.d = event.detail.d;
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
this.sdtParameters.addEventListener('sdt-parameters-c', (event) => {
|
|
253
|
+
this.c = event.detail.c;
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
this.sdtParameters.addEventListener('sdt-parameters-s', (event) => {
|
|
257
|
+
this.s = event.detail.s;
|
|
200
258
|
});
|
|
201
259
|
}
|
|
202
260
|
}
|
|
261
|
+
|
|
262
|
+
update(changedProperties) {
|
|
263
|
+
super.update(changedProperties);
|
|
264
|
+
|
|
265
|
+
if (this.detectableControl) {
|
|
266
|
+
this.detectableControl.trials = (this.detectableControl.trials !== undefined)
|
|
267
|
+
? this.trials
|
|
268
|
+
: undefined;
|
|
269
|
+
this.detectableControl.coherence = (this.detectableControl.coherence !== undefined)
|
|
270
|
+
? this.coherence
|
|
271
|
+
: undefined;
|
|
272
|
+
this.detectableControl.duration = (this.detectableControl.duration !== undefined)
|
|
273
|
+
? this.duration
|
|
274
|
+
: undefined;
|
|
275
|
+
this.detectableControl.color = (this.detectableControl.color !== undefined)
|
|
276
|
+
? this.color
|
|
277
|
+
: undefined;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (this.detectableResponse) {
|
|
281
|
+
this.detectableResponse.trialTotal = this.trials;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (this.detectableTable) {
|
|
285
|
+
this.detectableTable.color = this.color;
|
|
286
|
+
|
|
287
|
+
this.detectableTable.h = this.h;
|
|
288
|
+
this.detectableTable.m = this.m;
|
|
289
|
+
this.detectableTable.cr = this.cr;
|
|
290
|
+
this.detectableTable.fa = this.fa;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (this.rdkTask) {
|
|
294
|
+
this.rdkTask.trials = this.trials;
|
|
295
|
+
|
|
296
|
+
this.rdkTask.duration = this.duration;
|
|
297
|
+
this.rdkTask.wait = this.duration;
|
|
298
|
+
this.rdkTask.iti = this.duration;
|
|
299
|
+
|
|
300
|
+
this.rdkTask.coherence = this.coherence;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (this.rocSpace) {
|
|
304
|
+
this.rocSpace.hr = this.hr;
|
|
305
|
+
this.rocSpace.far = this.far;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (this.sdtModel) {
|
|
309
|
+
this.sdtModel.color = this.color;
|
|
310
|
+
|
|
311
|
+
this.sdtModel.d = this.d;
|
|
312
|
+
this.sdtModel.c = this.c;
|
|
313
|
+
this.sdtModel.s = this.s;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (this.sdtParameters) {
|
|
317
|
+
this.sdtParameters.d = (this.sdtParameters.d != null)
|
|
318
|
+
? this.d
|
|
319
|
+
: undefined;
|
|
320
|
+
this.sdtParameters.c = (this.sdtParameters.c != null)
|
|
321
|
+
? this.c
|
|
322
|
+
: undefined;
|
|
323
|
+
this.sdtParameters.s = (this.sdtParameters.s != null)
|
|
324
|
+
? this.s
|
|
325
|
+
: undefined;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
203
328
|
}
|
|
204
329
|
|
|
205
330
|
customElements.define('sdt-example-model', SDTExampleModel);
|