def delboeuf_display(parameters=None): """ """ n.circle(x=parameters["Position_Left"], size=parameters["Size_Outer_Left"], fill_color=parameters["Background_Color"], line_color="black", thickness=0.05) n.circle(x=parameters["Position_Left"], size=parameters["Size_Inner_Left"], fill_color="red", line_color="white") n.circle(x=parameters["Position_Right"], size=parameters["Size_Outer_Right"], fill_color=parameters["Background_Color"], line_color="black", thickness=0.05) n.circle(x=parameters["Position_Right"], size=parameters["Size_Inner_Right"], fill_color="red", line_color="white")
data = {"Trial": [], "Stimulus": [], "ISI":[], "RT":[], "Response":[]} for trial in range(5): # Iterate over the number of trials stimulus = random.choice(["green", "red"]) # Select a stimulus type ISI = random.randrange(start=500, stop=2000, step=500) # Select the inter-stimuli interval (ISI) n.newpage("grey") # Fill the screen n.write("+") # Fixation cross n.refresh() # Diplay it on screen n.time.wait(ISI) # Wait n.circle(size=2, fill_color=stimulus) # Display the stimulus (filled with the color selected above) n.refresh() # Diplay it on screen response, RT = n.response(time_max=1500) # Wait until 1.5s and collect the response and its time # Categorize the response if response == "SPACE" and stimulus == "green": response_type = "HIT" # Hit if response != "SPACE" and stimulus == "green": response_type = "MISS" # Miss if response == "SPACE" and stimulus == "red": response_type = "FA" # False Alarm if response != "SPACE" and stimulus == "red": response_type = "CR" # Correct Rejection # Store data by appending each item to its list data["Trial"].append(trial)
"Stimulus": [], "ISI":[], "RT":[], "Response":[]} n_trials = 10 # Number of trials for trial in range(n_trials): # Iterate over the number of trials stimulus = random.choice(["green", "green", "green", "red"]) # Select a stimulus type ISI = random.randrange(start=250, stop=1250, step=250) # Select the inter-stimuli interval (ISI) n.newpage("grey") # Fill the screen n.write("+") # Fixation cross n.refresh() # Diplay it on screen n.time.wait(ISI) # Wait n.circle(size=2, fill_color=stimulus) # Display the stimulus (filled with the color selected above) n.refresh() # Diplay it on screen response, RT = n.response(time_max=1000) # Wait until 1 s and collect the response and its time # Categorize the response if response == "SPACE" and stimulus == "green": response_type = "HIT" # Hit if response != "SPACE" and stimulus == "green": response_type = "MISS" # Miss if response == "SPACE" and stimulus == "red": response_type = "FA" # False Alarm if response != "SPACE" and stimulus == "red": response_type = "CR" # Correct Rejection # Store data by appending each item to its list data["Trial"].append(trial)