psychopy.org | Reference | Downloads | Github

Image names not being presented in output datafile

OS (Win10):
PsychoPy version (2021.2.3):
Standard Standalone? (y)
What are you trying to achieve?:

Modify data output file to include stimulus name along with keypress responses.

What did you try to make it work?:
I have read through the psychopy.data documentation. I have also utilized different experimental building settings.

What specifically went wrong when you tried that?:
Hi everyone, I do not have an error to show for this question as the experiment does not have one and runs without error.

I am using the shuffle command prior the experimental loop in a routine I call “shuffler”

random.Random(seed).shuffle(target)

The experimental loop is a picture naming paradigm and called PNT_1 and contains three components in the following order:

  1. Code: “pnt_code”
  2. Image: image_PNT
  3. Keyboard: “pnt_code”

pnt_code provides the experiment with the shuffled data as follows.

Begin Experiment:

#Item counter
curr_item = -1

Begin Routine

#increment item counter by 1
#starting at negative 1 makes python chose first item with the beload code
curr_item += 1

#update the item variables as we progress through list
pnt_items = target[curr_item]

The images component is formatted as follows:
image

The keyboard routine is here:
image

I get accuracy, response time data, etc. But I do not get the item’s name as an output. At the begining of the experiment when I run the shuffle command I do output a csv of the items so that the experimenter will know which item is coming next. So one thing I could do is merge the dataframes, but I have to believe I can do this in pytorch and not with external code.

Any help would be greatly appreciated!

Please let me know if I can provide anymore information.

I had difficulties getting it up on pavlovia and one of the commands isnt java compatable so here is a link to the gitlab with all of the files.

Perhaps another way to ask this question would be, does anyone know if I can append data to the output csv file from the experiment itself?

The keypresses are being saved for each trial; however, the stimulus assosciated with the trial is not. So I would like to make sure this is included in the output data file.

thisExp.addData('ColumnName',value)

Thanks for this, a definite step in the right direction.

To keep consistent with the provided code, when I include this in experiment I have added thisExp.addData(‘columnName’, target) to the begin routine block. It certainly does print out all the items, but as a list of all items rather than the item being delivered. For example, I have 175 trials within the routine and each value under the columnName variable is a list of the 175 trials.

Any thought son how to modify how to save just the item being delivered for each item?

If not, I could add the code to the experiment block and then transpose the list.

What code are you using to save the target to the data file?

What are you using to present the target?

It sounds like you are saving a list.

In case we need this, my experiment looks as follows:

I load data in the stim loader. THen I shuffle the data manually with python. The reason i did this is because the people that will be administering this test, wanted to see what items were going to be presented ahead of time. Totally aware i can shuffle within the trial, but I could not figure out a way to print the list prior to admission with the builder randomizer.

In regard to the question at han d, i just figured out the answer. It works as follows:

Within the pnt_trials i present the stimulus to be delivered during the experiment, and the components look as follows:

image

As @wakecarter suggested, I utilized thisExp.addData(‘ColumnName’,value)

I inserted the following code within the pnt_code component under the each frame section:

Note that within the value component I have inserted pnt_items which is the name of the data being provided to image_PNT.

thisExp.addData('Target_name', pnt_items)`