psychopy 2024.2.4__py3-none-any.whl → 2024.2.5__py3-none-any.whl

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.

Potentially problematic release.


This version of psychopy might be problematic. Click here for more details.

Files changed (63) hide show
  1. psychopy/.DS_Store +0 -0
  2. psychopy/CHANGELOG.txt +204 -0
  3. psychopy/GIT_SHA +1 -1
  4. psychopy/VERSION +1 -1
  5. psychopy/app/locale/ar_001/.DS_Store +0 -0
  6. psychopy/app/locale/ar_001/LC_MESSAGE/.DS_Store +0 -0
  7. psychopy/app/locale/ar_001/LC_MESSAGE/messages.po +1511 -3256
  8. psychopy/app/runner/runner.py +18 -8
  9. psychopy/experiment/_experiment.py +32 -7
  10. psychopy/iohub/client/__init__.py +17 -0
  11. psychopy/iohub/client/keyboard.py +5 -0
  12. psychopy/iohub/devices/mouse/linux2.py +4 -0
  13. psychopy/iohub/devices/mouse/win32.py +5 -0
  14. psychopy/tests/data/test_loaded_namespace/test_counterbalance.psyexp +142 -0
  15. psychopy/tests/data/test_loaded_namespace/test_custom_missing.psyexp +129 -0
  16. psychopy/tests/data/test_loaded_namespace/test_missing_counterbalance.psyexp +116 -0
  17. psychopy/tests/data/test_loaded_namespace/test_mix_exp.psyexp +181 -0
  18. psychopy/tests/data/test_loaded_namespace/test_mix_missing.psyexp +140 -0
  19. psychopy/tests/data/test_loaded_namespace/test_mix_name_calibration.psyexp +164 -0
  20. psychopy/tests/test_experiment/test_experiment.py +96 -0
  21. {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/METADATA +1 -1
  22. {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/RECORD +25 -55
  23. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.mo +0 -0
  24. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN.po +0 -6127
  25. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.mo +0 -0
  26. psychopy/app/locale/zh_CN/LC_MESSAGE/zh_CN_allFlagged.po +0 -7366
  27. psychopy/demos/builder/Design Templates/randomisedBlocks/html/index.html +0 -23
  28. psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks-legacy-browsers.js +0 -423
  29. psychopy/demos/builder/Design Templates/randomisedBlocks/html/randomisedBlocks.js +0 -427
  30. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/chooseBlock.xlsx +0 -0
  31. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/facesBlock.xlsx +0 -0
  32. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/housesBlock.xlsx +0 -0
  33. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face01.jpg +0 -0
  34. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face02.jpg +0 -0
  35. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/face03.jpg +0 -0
  36. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house01.jpg +0 -0
  37. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house02.jpg +0 -0
  38. psychopy/demos/builder/Design Templates/randomisedBlocks/html/resources/stims/house03.jpg +0 -0
  39. psychopy/demos/builder/Design Templates/randomisedBlocks/randomisedBlocks.py +0 -330
  40. psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xml +0 -298
  41. psychopy/demos/builder/Feature Demos/eyetracking/eyetracking.xsd +0 -120
  42. psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.psyexp +0 -323
  43. psychopy/demos/builder/Tools/gammaCalibration/gamma_correction_visual.py +0 -562
  44. psychopy/demos/builder/Tools/gammaCalibration/questStairs.xlsx +0 -0
  45. psychopy/demos/builder/Tools/gammaCalibration/readme.md +0 -0
  46. psychopy/demos/builder/Tools/gammaCalibration/resources/low_contrast.png +0 -0
  47. psychopy/demos/builder/Tools/gammaCalibration/resources/make_2nd_order_tex.py +0 -59
  48. psychopy/demos/builder/Tools/gammaCalibration/resources/second_order_tex.png +0 -0
  49. psychopy/demos/coder/stimuli/radialGratingContracting.py +0 -29
  50. psychopy/hardware/serialport.py +0 -51
  51. psychopy/tests/data/__test.png +0 -0
  52. psychopy/tests/data/corrFullRandom_local.csv +0 -16
  53. psychopy/tests/data/corrFullRandom_local.tsv +0 -6
  54. psychopy/tests/data/testLoopsBlocks.psyexp_local.py +0 -328
  55. psychopy/tests/data/text2_height.png +0 -0
  56. psychopy/tests/data/text2_normAddBlend.png +0 -0
  57. psychopy/tests/data/text2_normHexbackground.png +0 -0
  58. psychopy/tests/data/text2_stencil.png +0 -0
  59. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1206.csv +0 -9
  60. psychopy/tests/test_app/test_builder/data/_2021_ 5_03_1324.csv +0 -9
  61. {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/WHEEL +0 -0
  62. {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/entry_points.txt +0 -0
  63. {psychopy-2024.2.4.dist-info → psychopy-2024.2.5.dist-info}/licenses/LICENSE +0 -0
@@ -1,427 +0,0 @@
1
- /*************************
2
- * Randomisedblocks Test *
3
- *************************/
4
-
5
- import { core, data, sound, util, visual } from './lib/psychojs-2022.2.0.js';
6
- const { PsychoJS } = core;
7
- const { TrialHandler, MultiStairHandler } = data;
8
- const { Scheduler } = util;
9
- //some handy aliases as in the psychopy scripts;
10
- const { abs, sin, cos, PI: pi, sqrt } = Math;
11
- const { round } = util;
12
-
13
-
14
- // store info about the experiment session:
15
- let expName = 'randomisedBlocks'; // from the Builder filename that created this script
16
- let expInfo = {'session': '001', 'participant': `subj${(Math.random() * 100000)}`};
17
-
18
- // Start code blocks for 'Before Experiment'
19
- // init psychoJS:
20
- const psychoJS = new PsychoJS({
21
- debug: true
22
- });
23
-
24
- // open window:
25
- psychoJS.openWindow({
26
- fullscr: true,
27
- color: new util.Color([0, 0, 0]),
28
- units: 'height',
29
- waitBlanking: true
30
- });
31
- // schedule the experiment:
32
- psychoJS.schedule(psychoJS.gui.DlgFromDict({
33
- dictionary: expInfo,
34
- title: expName
35
- }));
36
-
37
- const flowScheduler = new Scheduler(psychoJS);
38
- const dialogCancelScheduler = new Scheduler(psychoJS);
39
- psychoJS.scheduleCondition(function() { return (psychoJS.gui.dialogComponent.button === 'OK'); }, flowScheduler, dialogCancelScheduler);
40
-
41
- // flowScheduler gets run if the participants presses OK
42
- flowScheduler.add(updateInfo); // add timeStamp
43
- flowScheduler.add(experimentInit);
44
- const blocksLoopScheduler = new Scheduler(psychoJS);
45
- flowScheduler.add(blocksLoopBegin(blocksLoopScheduler));
46
- flowScheduler.add(blocksLoopScheduler);
47
- flowScheduler.add(blocksLoopEnd);
48
- flowScheduler.add(quitPsychoJS, '', true);
49
-
50
- // quit if user presses Cancel in dialog box:
51
- dialogCancelScheduler.add(quitPsychoJS, '', false);
52
-
53
- psychoJS.start({
54
- expName: expName,
55
- expInfo: expInfo,
56
- });
57
-
58
- psychoJS.experimentLogger.setLevel(core.Logger.ServerLevel.EXP);
59
-
60
-
61
- var frameDur;
62
- async function updateInfo() {
63
- expInfo['date'] = util.MonotonicClock.getDateStr(); // add a simple timestamp
64
- expInfo['expName'] = expName;
65
- expInfo['psychopyVersion'] = '2022.2.0dev3';
66
- expInfo['OS'] = window.navigator.platform;
67
-
68
- psychoJS.experiment.dataFileName = (("." + "/") + `data/${expInfo["participant"]}_${expName}_${expInfo["date"]}`);
69
-
70
- // store frame rate of monitor if we can measure it successfully
71
- expInfo['frameRate'] = psychoJS.window.getActualFrameRate();
72
- if (typeof expInfo['frameRate'] !== 'undefined')
73
- frameDur = 1.0 / Math.round(expInfo['frameRate']);
74
- else
75
- frameDur = 1.0 / 60.0; // couldn't get a reliable measure so guess
76
-
77
- // add info from the URL:
78
- util.addInfoFromUrl(expInfo);
79
-
80
- return Scheduler.Event.NEXT;
81
- }
82
-
83
-
84
- var readyMessageClock;
85
- var textbox;
86
- var trialClock;
87
- var image;
88
- var globalClock;
89
- var routineTimer;
90
- async function experimentInit() {
91
- // Initialize components for Routine "readyMessage"
92
- readyMessageClock = new util.Clock();
93
- textbox = new visual.TextBox({
94
- win: psychoJS.window,
95
- name: 'textbox',
96
- text: '',
97
- font: 'Open Sans',
98
- pos: [0, 0], letterHeight: 0.05,
99
- size: [0.4, 0.4], units: undefined,
100
- color: 'white', colorSpace: 'rgb',
101
- fillColor: undefined, borderColor: undefined,
102
- bold: false, italic: false,
103
- opacity: 1.0,
104
- padding: undefined,
105
- editable: false,
106
- multiline: true,
107
- anchor: 'center',
108
- depth: 0.0
109
- });
110
-
111
- // Initialize components for Routine "trial"
112
- trialClock = new util.Clock();
113
- image = new visual.ImageStim({
114
- win : psychoJS.window,
115
- name : 'image', units : 'height',
116
- image : undefined, mask : undefined,
117
- ori : 0, pos : [0, 0], size : [0.5, 0.5],
118
- color : new util.Color([1, 1, 1]), opacity : 1,
119
- flipHoriz : false, flipVert : false,
120
- texRes : 128, interpolate : true, depth : 0.0
121
- });
122
- // Create some handy timers
123
- globalClock = new util.Clock(); // to track the time since experiment started
124
- routineTimer = new util.CountdownTimer(); // to track time remaining of each (non-slip) routine
125
-
126
- return Scheduler.Event.NEXT;
127
- }
128
-
129
-
130
- var blocks;
131
- var currentLoop;
132
- function blocksLoopBegin(blocksLoopScheduler, snapshot) {
133
- return async function() {
134
- TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
135
-
136
- // set up handler to look after randomisation of conditions etc
137
- blocks = new TrialHandler({
138
- psychoJS: psychoJS,
139
- nReps: 2, method: TrialHandler.Method.RANDOM,
140
- extraInfo: expInfo, originPath: undefined,
141
- trialList: 'chooseBlock.xlsx',
142
- seed: undefined, name: 'blocks'
143
- });
144
- psychoJS.experiment.addLoop(blocks); // add the loop to the experiment
145
- currentLoop = blocks; // we're now the current loop
146
-
147
- // Schedule all the trials in the trialList:
148
- for (const thisBlock of blocks) {
149
- const snapshot = blocks.getSnapshot();
150
- blocksLoopScheduler.add(importConditions(snapshot));
151
- blocksLoopScheduler.add(readyMessageRoutineBegin(snapshot));
152
- blocksLoopScheduler.add(readyMessageRoutineEachFrame());
153
- blocksLoopScheduler.add(readyMessageRoutineEnd());
154
- const trialsLoopScheduler = new Scheduler(psychoJS);
155
- blocksLoopScheduler.add(trialsLoopBegin(trialsLoopScheduler, snapshot));
156
- blocksLoopScheduler.add(trialsLoopScheduler);
157
- blocksLoopScheduler.add(trialsLoopEnd);
158
- blocksLoopScheduler.add(endLoopIteration(blocksLoopScheduler, snapshot));
159
- }
160
-
161
- return Scheduler.Event.NEXT;
162
- }
163
- }
164
-
165
-
166
- var trials;
167
- function trialsLoopBegin(trialsLoopScheduler, snapshot) {
168
- return async function() {
169
- TrialHandler.fromSnapshot(snapshot); // update internal variables (.thisN etc) of the loop
170
-
171
- // set up handler to look after randomisation of conditions etc
172
- trials = new TrialHandler({
173
- psychoJS: psychoJS,
174
- nReps: 1, method: TrialHandler.Method.RANDOM,
175
- extraInfo: expInfo, originPath: undefined,
176
- trialList: condsFile,
177
- seed: undefined, name: 'trials'
178
- });
179
- psychoJS.experiment.addLoop(trials); // add the loop to the experiment
180
- currentLoop = trials; // we're now the current loop
181
-
182
- // Schedule all the trials in the trialList:
183
- for (const thisTrial of trials) {
184
- const snapshot = trials.getSnapshot();
185
- trialsLoopScheduler.add(importConditions(snapshot));
186
- trialsLoopScheduler.add(trialRoutineBegin(snapshot));
187
- trialsLoopScheduler.add(trialRoutineEachFrame());
188
- trialsLoopScheduler.add(trialRoutineEnd());
189
- trialsLoopScheduler.add(endLoopIteration(trialsLoopScheduler, snapshot));
190
- }
191
-
192
- return Scheduler.Event.NEXT;
193
- }
194
- }
195
-
196
-
197
- async function trialsLoopEnd() {
198
- psychoJS.experiment.removeLoop(trials);
199
-
200
- return Scheduler.Event.NEXT;
201
- }
202
-
203
-
204
- async function blocksLoopEnd() {
205
- psychoJS.experiment.removeLoop(blocks);
206
-
207
- return Scheduler.Event.NEXT;
208
- }
209
-
210
-
211
- var t;
212
- var frameN;
213
- var continueRoutine;
214
- var readyMessageComponents;
215
- function readyMessageRoutineBegin(snapshot) {
216
- return async function () {
217
- TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
218
-
219
- //--- Prepare to start Routine 'readyMessage' ---
220
- t = 0;
221
- readyMessageClock.reset(); // clock
222
- frameN = -1;
223
- continueRoutine = true; // until we're told otherwise
224
- routineTimer.add(1.000000);
225
- // update component parameters for each repeat
226
- textbox.setText(readyMsg);
227
- // keep track of which components have finished
228
- readyMessageComponents = [];
229
- readyMessageComponents.push(textbox);
230
-
231
- for (const thisComponent of readyMessageComponents)
232
- if ('status' in thisComponent)
233
- thisComponent.status = PsychoJS.Status.NOT_STARTED;
234
- return Scheduler.Event.NEXT;
235
- }
236
- }
237
-
238
-
239
- var frameRemains;
240
- function readyMessageRoutineEachFrame() {
241
- return async function () {
242
- //--- Loop for each frame of Routine 'readyMessage' ---
243
- // get current time
244
- t = readyMessageClock.getTime();
245
- frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
246
- // update/draw components on each frame
247
-
248
- // *textbox* updates
249
- if (t >= 0.0 && textbox.status === PsychoJS.Status.NOT_STARTED) {
250
- // keep track of start time/frame for later
251
- textbox.tStart = t; // (not accounting for frame time here)
252
- textbox.frameNStart = frameN; // exact frame index
253
-
254
- textbox.setAutoDraw(true);
255
- }
256
-
257
- frameRemains = 0.0 + 1.0 - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
258
- if (textbox.status === PsychoJS.Status.STARTED && t >= frameRemains) {
259
- textbox.setAutoDraw(false);
260
- }
261
- // check for quit (typically the Esc key)
262
- if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
263
- return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
264
- }
265
-
266
- // check if the Routine should terminate
267
- if (!continueRoutine) { // a component has requested a forced-end of Routine
268
- return Scheduler.Event.NEXT;
269
- }
270
-
271
- continueRoutine = false; // reverts to True if at least one component still running
272
- for (const thisComponent of readyMessageComponents)
273
- if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
274
- continueRoutine = true;
275
- break;
276
- }
277
-
278
- // refresh the screen if continuing
279
- if (continueRoutine && routineTimer.getTime() > 0) {
280
- return Scheduler.Event.FLIP_REPEAT;
281
- } else {
282
- return Scheduler.Event.NEXT;
283
- }
284
- };
285
- }
286
-
287
-
288
- function readyMessageRoutineEnd() {
289
- return async function () {
290
- //--- Ending Routine 'readyMessage' ---
291
- for (const thisComponent of readyMessageComponents) {
292
- if (typeof thisComponent.setAutoDraw === 'function') {
293
- thisComponent.setAutoDraw(false);
294
- }
295
- }
296
- return Scheduler.Event.NEXT;
297
- };
298
- }
299
-
300
-
301
- var trialComponents;
302
- function trialRoutineBegin(snapshot) {
303
- return async function () {
304
- TrialHandler.fromSnapshot(snapshot); // ensure that .thisN vals are up to date
305
-
306
- //--- Prepare to start Routine 'trial' ---
307
- t = 0;
308
- trialClock.reset(); // clock
309
- frameN = -1;
310
- continueRoutine = true; // until we're told otherwise
311
- routineTimer.add(1.500000);
312
- // update component parameters for each repeat
313
- image.setImage(stimFile);
314
- // keep track of which components have finished
315
- trialComponents = [];
316
- trialComponents.push(image);
317
-
318
- for (const thisComponent of trialComponents)
319
- if ('status' in thisComponent)
320
- thisComponent.status = PsychoJS.Status.NOT_STARTED;
321
- return Scheduler.Event.NEXT;
322
- }
323
- }
324
-
325
-
326
- function trialRoutineEachFrame() {
327
- return async function () {
328
- //--- Loop for each frame of Routine 'trial' ---
329
- // get current time
330
- t = trialClock.getTime();
331
- frameN = frameN + 1;// number of completed frames (so 0 is the first frame)
332
- // update/draw components on each frame
333
-
334
- // *image* updates
335
- if (t >= 0.5 && image.status === PsychoJS.Status.NOT_STARTED) {
336
- // keep track of start time/frame for later
337
- image.tStart = t; // (not accounting for frame time here)
338
- image.frameNStart = frameN; // exact frame index
339
-
340
- image.setAutoDraw(true);
341
- }
342
-
343
- frameRemains = 0.5 + 1.0 - psychoJS.window.monitorFramePeriod * 0.75; // most of one frame period left
344
- if (image.status === PsychoJS.Status.STARTED && t >= frameRemains) {
345
- image.setAutoDraw(false);
346
- }
347
- // check for quit (typically the Esc key)
348
- if (psychoJS.experiment.experimentEnded || psychoJS.eventManager.getKeys({keyList:['escape']}).length > 0) {
349
- return quitPsychoJS('The [Escape] key was pressed. Goodbye!', false);
350
- }
351
-
352
- // check if the Routine should terminate
353
- if (!continueRoutine) { // a component has requested a forced-end of Routine
354
- return Scheduler.Event.NEXT;
355
- }
356
-
357
- continueRoutine = false; // reverts to True if at least one component still running
358
- for (const thisComponent of trialComponents)
359
- if ('status' in thisComponent && thisComponent.status !== PsychoJS.Status.FINISHED) {
360
- continueRoutine = true;
361
- break;
362
- }
363
-
364
- // refresh the screen if continuing
365
- if (continueRoutine && routineTimer.getTime() > 0) {
366
- return Scheduler.Event.FLIP_REPEAT;
367
- } else {
368
- return Scheduler.Event.NEXT;
369
- }
370
- };
371
- }
372
-
373
-
374
- function trialRoutineEnd() {
375
- return async function () {
376
- //--- Ending Routine 'trial' ---
377
- for (const thisComponent of trialComponents) {
378
- if (typeof thisComponent.setAutoDraw === 'function') {
379
- thisComponent.setAutoDraw(false);
380
- }
381
- }
382
- return Scheduler.Event.NEXT;
383
- };
384
- }
385
-
386
-
387
- function endLoopIteration(scheduler, snapshot) {
388
- // ------Prepare for next entry------
389
- return async function () {
390
- if (typeof snapshot !== 'undefined') {
391
- // ------Check if user ended loop early------
392
- if (snapshot.finished) {
393
- // Check for and save orphaned data
394
- if (psychoJS.experiment.isEntryEmpty()) {
395
- psychoJS.experiment.nextEntry(snapshot);
396
- }
397
- scheduler.stop();
398
- } else {
399
- const thisTrial = snapshot.getCurrentTrial();
400
- if (typeof thisTrial === 'undefined' || !('isTrials' in thisTrial) || thisTrial.isTrials) {
401
- psychoJS.experiment.nextEntry(snapshot);
402
- }
403
- }
404
- return Scheduler.Event.NEXT;
405
- }
406
- };
407
- }
408
-
409
-
410
- function importConditions(currentLoop) {
411
- return async function () {
412
- psychoJS.importAttributes(currentLoop.getCurrentTrial());
413
- return Scheduler.Event.NEXT;
414
- };
415
- }
416
-
417
-
418
- async function quitPsychoJS(message, isCompleted) {
419
- // Check for and save orphaned data
420
- if (psychoJS.experiment.isEntryEmpty()) {
421
- psychoJS.experiment.nextEntry();
422
- }
423
- psychoJS.window.close();
424
- psychoJS.quit({message: message, isCompleted: isCompleted});
425
-
426
- return Scheduler.Event.QUIT;
427
- }