@decidables/accumulable-elements 0.1.3 → 0.2.1
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 +28 -0
- package/README.md +72 -33
- package/lib/accumulableElements.esm.js +733 -415
- package/lib/accumulableElements.esm.js.map +1 -1
- package/lib/accumulableElements.esm.min.js +300 -125
- package/lib/accumulableElements.esm.min.js.map +1 -1
- package/lib/accumulableElements.umd.js +733 -415
- package/lib/accumulableElements.umd.js.map +1 -1
- package/lib/accumulableElements.umd.min.js +301 -126
- package/lib/accumulableElements.umd.min.js.map +1 -1
- package/package.json +8 -8
- package/src/components/accumulable-control.js +4 -4
- package/src/components/accumulable-response.js +6 -24
- package/src/components/ddm-fit-worker.js +2 -2
- package/src/components/ddm-fit.js +6 -4
- package/src/components/ddm-model.js +130 -62
- package/src/components/ddm-parameters.js +61 -4
- package/src/equations/azv2pc.js +35 -8
- package/src/equations/azvt02m.js +44 -10
- package/src/examples/human.js +156 -71
- package/src/examples/interactive.js +39 -9
- package/src/examples/model.js +95 -93
package/src/examples/model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
import DDMMath from '@decidables/accumulable-math';
|
|
3
3
|
|
|
4
4
|
import DDMExample from './ddm-example';
|
|
5
5
|
|
|
@@ -63,10 +63,10 @@ export default class DDMExampleModel extends DDMExample {
|
|
|
63
63
|
this.colors = ['none', 'measure', 'outcome', 'all'];
|
|
64
64
|
this.color = 'outcome';
|
|
65
65
|
|
|
66
|
-
this.a =
|
|
67
|
-
this.z =
|
|
68
|
-
this.v =
|
|
69
|
-
this.t0 =
|
|
66
|
+
this.a = DDMMath.a.DEFAULT;
|
|
67
|
+
this.z = DDMMath.z.DEFAULT;
|
|
68
|
+
this.v = DDMMath.v.DEFAULT;
|
|
69
|
+
this.t0 = DDMMath.t0.DEFAULT;
|
|
70
70
|
|
|
71
71
|
this.accumulableControl = null;
|
|
72
72
|
this.rdkTask = null;
|
|
@@ -93,70 +93,58 @@ export default class DDMExampleModel extends DDMExample {
|
|
|
93
93
|
this.accumulableTable = this.querySelector('accumulable-table');
|
|
94
94
|
|
|
95
95
|
if (this.accumulableControl) {
|
|
96
|
-
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.ddmModel.trials = this.trialCount;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (this.accumulableResponse) {
|
|
152
|
-
this.accumulableResponse.reset();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (this.accumulableTable) {
|
|
156
|
-
// this.accumulableTable.clear();
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
96
|
+
this.accumulableControl.addEventListener('accumulable-control-trials', (event) => {
|
|
97
|
+
this.trials = event.detail.trials;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
this.accumulableControl.addEventListener('accumulable-control-duration', (event) => {
|
|
101
|
+
this.duration = event.detail.duration;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
this.accumulableControl.addEventListener('accumulable-control-color', (event) => {
|
|
105
|
+
this.color = event.detail.color;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
this.accumulableControl.addEventListener('accumulable-control-run', (/* event */) => {
|
|
109
|
+
if (this.rdkTask) {
|
|
110
|
+
this.rdkTask.running = true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (this.ddmModel) {
|
|
114
|
+
this.ddmModel.resumeTrial();
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
this.accumulableControl.addEventListener('accumulable-control-pause', (/* event */) => {
|
|
119
|
+
if (this.rdkTask) {
|
|
120
|
+
this.rdkTask.running = false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (this.ddmModel) {
|
|
124
|
+
this.ddmModel.pauseTrial();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
this.accumulableControl.addEventListener('accumulable-control-reset', (/* event */) => {
|
|
129
|
+
this.trialCount = 0;
|
|
130
|
+
this.signal = undefined;
|
|
131
|
+
|
|
132
|
+
if (this.rdkTask) {
|
|
133
|
+
this.rdkTask.reset();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (this.ddmModel) {
|
|
137
|
+
this.ddmModel.trials = this.trialCount;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (this.accumulableResponse) {
|
|
141
|
+
this.accumulableResponse.reset();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (this.accumulableTable) {
|
|
145
|
+
// this.accumulableTable.clear();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
160
148
|
}
|
|
161
149
|
|
|
162
150
|
if (this.rdkTask) {
|
|
@@ -225,22 +213,20 @@ export default class DDMExampleModel extends DDMExample {
|
|
|
225
213
|
this.requestUpdate();
|
|
226
214
|
});
|
|
227
215
|
|
|
228
|
-
|
|
229
|
-
this.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
});
|
|
243
|
-
}
|
|
216
|
+
this.ddmModel.addEventListener('accumulable-response', (event) => {
|
|
217
|
+
if (this.accumulableResponse) {
|
|
218
|
+
const response = (event.detail.outcome === 'correct')
|
|
219
|
+
? this.signal
|
|
220
|
+
: (this.signal === 'left')
|
|
221
|
+
? 'right'
|
|
222
|
+
: 'left';
|
|
223
|
+
this.accumulableResponse.responded(response);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
this.data = event.detail.data;
|
|
227
|
+
this.model = event.detail.model;
|
|
228
|
+
this.requestUpdate();
|
|
229
|
+
});
|
|
244
230
|
}
|
|
245
231
|
|
|
246
232
|
this.requestUpdate();
|
|
@@ -254,10 +240,18 @@ export default class DDMExampleModel extends DDMExample {
|
|
|
254
240
|
}
|
|
255
241
|
|
|
256
242
|
if (this.accumulableControl) {
|
|
257
|
-
this.accumulableControl.trials = this.trials
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this.accumulableControl.
|
|
243
|
+
this.accumulableControl.trials = (this.accumulableControl.trials != null)
|
|
244
|
+
? this.trials
|
|
245
|
+
: undefined;
|
|
246
|
+
this.accumulableControl.duration = (this.accumulableControl.duration != null)
|
|
247
|
+
? this.duration
|
|
248
|
+
: undefined;
|
|
249
|
+
this.accumulableControl.coherence = (this.accumulableControl.coherence != null)
|
|
250
|
+
? this.coherence
|
|
251
|
+
: undefined;
|
|
252
|
+
this.accumulableControl.color = (this.accumulableControl.color != null)
|
|
253
|
+
? this.color
|
|
254
|
+
: undefined;
|
|
261
255
|
}
|
|
262
256
|
|
|
263
257
|
if (this.rdkTask) {
|
|
@@ -267,10 +261,18 @@ export default class DDMExampleModel extends DDMExample {
|
|
|
267
261
|
}
|
|
268
262
|
|
|
269
263
|
if (this.ddmParameters) {
|
|
270
|
-
this.ddmParameters.a = this.a
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this.ddmParameters.
|
|
264
|
+
this.ddmParameters.a = (this.ddmParameters.a != null)
|
|
265
|
+
? this.a
|
|
266
|
+
: undefined;
|
|
267
|
+
this.ddmParameters.z = (this.ddmParameters.z != null)
|
|
268
|
+
? this.z
|
|
269
|
+
: undefined;
|
|
270
|
+
this.ddmParameters.v = (this.ddmParameters.a != null)
|
|
271
|
+
? this.v
|
|
272
|
+
: undefined;
|
|
273
|
+
this.ddmParameters.t0 = (this.ddmParameters.t0 != null)
|
|
274
|
+
? this.t0
|
|
275
|
+
: undefined;
|
|
274
276
|
}
|
|
275
277
|
|
|
276
278
|
if (this.ddmModel) {
|