Save separate data file (not trial-by-trial)

URL of experiment:

Description of the problem:
In addition to the trial-by-trial data that will be stored by default, I also need a separate csv file to be stored for each subject. In my experiment, every subject gets a different set of rock images sampled from a stimulus pool, and the rock images are randomly arranged in a grid display that is unique for each subject. I want to save the spatial arrangement of the images in a csv file, where the columns are the spatial coordinates and the category and token indices for each rock image. The total number of rows should be equal to the total number of rock images sampled for each subject.