PsychoPy v2021.1.4
Mac OS Catalina v10.15.1
Two questions I have on getting something to output in csv not just log:
In my study I have two conditions - in the first one participants see text cue “VIEW”, see an image, and then respond to a random letter that is either capitalized or lowercase with a 1 = UPPERCASE, 2 = lowercase keypress. To select this random letter each trial, I use the following code:
Begin Routine:
randLetter = random.choice(string.ascii_letters)
Q1: I can see in the resultant log file which letter was and determine the correct answer from that, but struggling to get any of this to be spit out into the csv so I can more easily see on a trial-by-trial basis what participants saw since it will differ for each person. Any suggestions?
Similar for my second condition: they see a series of 6-letters as the cue (instead of ‘VIEW’) and then are to hold the 6-letters in memory until the image disappears. Code:
Begin Experiment:
import random
import string
from string import ascii_uppercase
def choose_letters():
letters = string.ascii_uppercase
return ‘’.join(random.sample(letters, 6))
Begin Routine:
current_list = choose_letters()
Then once the image disappears, they are shown a single letter again (all uppercase this time) and keypress to answer 1 = Yes if the letter is part of 6-letter-string or 2 = No if not. Code:
Begin Routine
randLetter2 = random.choice(string.ascii_uppercase)
Q2: Here I would like to know 1) what the 6-letter string was on that trial (cue) and then 2) what letter was shown that they responded 1 or 2 to. Again so I can infer what correct answer was. I see this data in the log but again I wonder how might I add to code in the loops to have this add to csv?