The results file
We will bring improvements to our task later, but our current script is already functional and our participants’ pressing of the F vs J key already informs us on (i) which picture was chosen, and (ii) how long it took them to make their choice, which is what we’re interested in.
If you tested your experiment before, you should now be seeing two files under results in your project: one is named raw_results and the other one is named results. If you can’t see them, try clicking refresh. If nothing happens, test your experiment until your reach the submission confirmation message and click refresh again.
We will work with the file results, which is a comma-separated-value (CSV) file (the file raw_results stores the same data in a JSON format). Click on results to see its content.
The lines starting with # are comments providing information on how and when the data was collected, and on what the values separated by commas in the lines below represent. You don’t have to spend time on it for now.
You should see only two non-comment lines for now (that is, one pair of lines not starting with # for each time you tested your experiment). The third value from the end is Start in the first line, and End in the second line. The next value (second from the end) is the timestamp corresponding to the event. Subtract the timestamps to measure how long the trial (i.e. the whole experiment so far) lasted, in milliseconds.
If you are looking at lines generated before you added in the key element, the difference should be very small, since the end of the trial was reached almost immediately after the experiment started. Scroll down to find lines generated after you added the key element (take the experiment again and refresh the file if you have no such pair of lines yet) and measure the difference. If should be in the order of hundreds or thousands of milliseconds now, depending on how long it took you to press a key.
PennController automatically logs when a trial starts and when it ends, but you have to explicitly tell it what other information you want to collect. In our case, we are interested in what is captured by the key element. PennController has a command that logs element-related events: .settings.log. All we need to do in order to see a line reporting key presses appear in our results file is use this command within the newKey block, like this:
PennController( newText("The fish swim in a tank which is perfectly round") .print() , newImage("two", "2fishRoundTank.png") .settings.size(200,200) , newImage("one", "1fishSquareTank.png") .settings.size(200,200) , newCanvas(450,200) .settings.add( 0 , 0 , getImage("two") ) .settings.add( 250 , 0 , getImage("one") ) .print() , newKey("FJ") .settings.log() .wait() )
A new look at the results file
Test your experiment again after adding
.settings.log() and refresh the results file. Make sure to scroll down to see the newly generated lines. You should now see a new line containing Key between the Start and the End lines.
The third value from the end, next to Key, is a keycode number representing the key that was pressed (keycodes make it possible to represent so-to-speak invisible keys such as the Shift key). In our case, the keycode for the F key is 70 and the keycode for J is 74. You can use the interface on this webpage to press keys and see what keycode they are associated with.
The next value (second from the end) is the timestamp of the event again. Subtract if from the timestamp of the Start line to get the response time. When you have multiple trials, you can use this method to compare response times for trials with and without an -s on the verb.
This was a quick overview of the results file. As you collect more data, you will want to automatize the analysis process. We will come back to it later, but for now let us see how we can add a crucial piece of information to our results file: an ID associating each results line to its participant.