# -*- coding: utf-8 -*- ''' Generates .csv files for experimental stimuli (composite images). The .csv file contains 4 columns: attentive category name, binary category number, image 1 used in the composite image and image 2 used in the composite image (strings of file directories to the images). ''' # Imports import os import random from settings import script_path_init script_path = script_path_init() os.chdir(script_path) from experimentFunctions import createIndices, closeWin closeWin() #### Global variables #### global blockIdx global imgIdx subjID_prep = '01' numRuns = 6 # E.g. 6 runs creates 6*8*50 = 2400 composite images indices (string of path to directories of images) # Different combinations of attentive versus non-attentive categories. Four in total. catComb1 = [['male', 'female', 'indoor', 'outdoor'], ['indoor', 'outdoor', 'male', 'female']] catComb2 = [['male', 'female', 'outdoor', 'indoor'],
import csv import pandas as pd from PIL import Image import random from random import sample from pylsl import StreamInfo, StreamOutlet, StreamInlet, resolve_stream, resolve_byprop from randomizeParticipants import assign_subject, add_avail_feedback_sub, gen_group_fname from psychopy import visual, core, data, event, monitors, logging import settings # Initialize paths and variables data_path = settings.data_path_init() subject_path = settings.subject_path_init() script_path = settings.script_path_init() os.chdir(subject_path) ###### Global variables (changes over the time course of the experiment) ###### global blockIdx global imgIdx blockIdx = 1 imgIdx = 0 ###### Data frames for logging ###### df_imgIdxSave = pd.DataFrame( columns=['attentive_cat', 'binary_cat', 'img1', 'img2']) # For createIndices function. Columns: