I was working on an experiment in which I wanted to import stimuli lists by randomly selecting a stimuli file and have been looking for a way around the fact that OSWeb does not currently support the file source method for sequence objects.
The method consists in emulating a list of stimuli file by using memory array within the task itself.https://forum.cogsci.nl/uploads/715/BOFVBOCMQEIH.png
I'm sharing the outcome in case this can be of help other users. It's just a workaround method, and there probably are more elegant methods, but it works when running the experiment online with JATOS.
Please suggest improvements if you see things that can work more effectively!
OS allows loops to be populated with values imported from a file (whether fixed or randomly selected). This is especially useful when stimuli sequences must follow a very specific order and fulfil conditions that are best set up outside the task itself. However, OSWeb, at present, does not support this file source method.
Note: For a list of features not currently (March 31th 2021) supported in OSWeb see:
BRIEF DESCRIPTION OF THE METHOD
This task illustrates a method to select a stimulus set at random from a list of stimulus sets that will work in a browser.
Uploading a csv (or some other file) from the server is not an easy task and security settings may prevent it. Hence, a different method is proposed here.
The method developed here consists in defining arrays to store the stimuli sets in memory. That is, all of the possible stimuli sets are loaded in memory at the onset of the task. The task then joins these arrays in a meta array, from which it'll pick one element at random to constitute the array that will serve as the stimuli list to be used in the test trials of the experiment. No-longer needed arrays are then deleted to free memory.
In this example, this method is applied to the test trials of the task. Practice trials are defined manually in the practice_loop using a table.
In this task, 5 stimuli arrays are loaded in memory, one of which will be used in the task. The arrays for the test trials information contain 48 rows and 3 columns. These correspond to the 48 trials to be presented across 4 blocks of 12 trials each. Hence, the test trials sequence is nested within a loop running 4 times. For that reason, the test_trials loop contains 12 rows (which will be populated from the array as the task runs).
The number of arrays, their dimensions, the number of blocks can be edited as needed. One constrain, however, is that the (number of test trials per block) x (the number of test trial blocks) should be equal or inferior to the number of rows in each array. If it is inferior, some test trials will remain undefined and the task will stop because it cannot find then necessary information in the test_trials loop. If it is equal, then all trials from the selected array will be presented. If it is inferior, some trials defined in the selected array will remain unused.
Based on the tests I carried out, with this method it seems necessary to format the table in the test_trials loop so that it contains the appropriate number of rows and the columns with the appropriate variable names.
BRIEF DESCRIPTION OF THE TASK
In this example, the task simply presents a fixation cross, a tone, followed by an arrow pointing left or right.
The task implements a method to keep the inter-trial interval to a fix value. That is, the target stimulus (arrow) remains on the screen even if a response is detected and the sum duration of the target on screen before response and of the target on screen after response is constant.
Some information appears on the screen and in the console for easy monitoring of what's going on. Also, the arrows alternate from left to right predictably on purpose: to make it easy to purposely produce correct and incorrect responses while checking that the task is scoring everything correctly.
There may well exist alternative and more elegant ways of achieving the same aim. If you use this program or parts of it, please make sure to check your task thoroughly before deploying it to collect actual data. This task is provided "as is".