I am currently working on a source memory task where I’m pairing an image with a word during study. During test, participants are shown all image options on the screen and are presented with new and old words and need to click a key corresponding to what image the word was paired to (or new).
The task runs fine and there are no issues with that, however, there are a couple of things left I need to do for some data to be added to the data file.
The study image is recorded into the data file but in the long path to the actual image file.
-Here I want to add something into the routine that will also include a single letter to correspond to
the source (e.g. ‘x’) individuals in the images.
2. The test data is added to the output file (the word and then the key
response)
-Here I want to have something that will auto-grade the response. So, if the participant’s source response was correct, a misattribution, false alarm, or correct rejection.
I didn’t know what would be helpful to include, but I attached the overall task code, study code, and test code. Also, the stimuli file I fed in has two columns, a word list, and an image list.
Thanks in advance and let me know if there is more information you need!
I’m a bit confused about what you’re trying to do, but I’ll try my best to help from what I understand:
So you’re saying that the output for the images has the entire folder/file name, but you want just the file name, correct? If so, you can treat the output name as a string and call to the last few letters in the string. For example, if your file name is html/resources/image1.png and you want the output entry to say image1.png, you can write:
oldFileName = html/resources/image1.png #but call to the variable that you were originally saving
fileNameStart = 15 #the position of the 'i' in the oldFileName that I got from just counting (this is assuming all of the images are in the same folder)
imageName = oldFileName[fileNameStart:]
#imageName = "image1.png"
If you’re just trying to make a correct/incorrect column in the output file, you can simply make a correctResponse variable that corresponds to the correct key response for that trial, check the ‘store correct’ box in the keyboard component, and enter $correctResponse in the box as the correct answer. Psychopy will then automatically make you a correct/incorrect column called keyboardResponse.corr.
I also want to check if you’re running this code locally or plan to run it on Pavlovia. If you’re using Pavlovia, you’re using quite a few functions in your code that won’t translate to javascript, which will make running it online a huge ordeal. I just like to point this out when I see it because fixing the code took so much time and I wish someone would’ve told me before beginning. If you’re running your experiment locally, you’re good and you can ignore this.
Anyway, I hope I understood your questions correctly and that I was able to help!