Task_blocks Module
- class ActionObservation(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the ActionObservation task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class Affective(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Display instructions for the affective task.
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the affective task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class AuditoryNarrative(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the AuditoryNarrative task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class DemandGrid(info, screen, ttl_clock, const, subj_id)
Bases:
Task- create_grid(sequence=None, position='center', grid_size=(3, 4))
Creates the grid of squares for the DemandGrid task, lighting up specific squares blue if a sequence is given, and positions the grid left, right, or center.
- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the DemandGrid task with two boxes lighting up at a time
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class FauxPas(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the Theory of Mind task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class FingerRhythmic(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the Finger Rhythmic task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class FingerSequence(info, screen, ttl_clock, const, subj_id)
Bases:
TaskFinger sequence task
- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the finger sequence task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class FlexionExtension(info, screen, ttl_clock, const, subj_id)
Bases:
TaskFlexion extension of toes! No particular feedback.
- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class Movie(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class NBack(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- infer_n_back()
Derive the numeric n-back level (used only for the instruction text).
The level lives in the ‘condition’ column as an ‘N-back’ label (e.g. ‘2-back’), so a hand-made task file only needs that one column. Defaults to 2 if no usable ‘condition’ label is present.
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the nback task (after it started) :param trial: Row of trial_info, with all information about the trial :type trial: pd.Series
- Returns:
trial (pd.Series) – Row of trial_data with all response data added
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class OddBall(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the oddball task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class PassageListening(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class RMET(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the Reading the Mind in the Eye (RMET) task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class Reading(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the sentence reading task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class Rest(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- show_stim()
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class SemanticPrediction(info, screen, ttl_clock, const, subj_id)
Bases:
TaskRead a sentence and decide if the last word of the sentence makes sense. Click “3” if the last word makes sense; click “4” if not. Be as accurate and fast as possible.
- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the semantic prediction task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class SensMotControl(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class SerialReactionTime(info, screen, ttl_clock, const, subj_id)
Bases:
TaskSerial reaction time task
- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Override to show empty boxes during initial wait.
- run_trial(trial)
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
Bases:
TaskDisplays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
Initialize task - default is to read the target information into the trial_info dataframe
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
Checks for quit or escape key presses and quits the experiment if necessary
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class Task(info, screen, ttl_clock, const, subj_id)
Bases:
objectTask: takes in inputs from run_experiment.py and methods some methods are universal across all tasks. Those methods are included in the super class Task. There are methods like display_instructions which are the same across most of the tasks. There are, however, some tasks that have different instructions from the rest (like fingerSequence). For those tasks, a display_instructions method is defined within the corresponding class which overrides the universal display_instruction method. Each of other classes runs a unique task given input from target files and from the Task class (VisualSearch, SemanticPrediction, NBack, SocialPrediction, ActionObservation).
- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class TheoryOfMind(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of the Theory of Mind task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class TimePerception(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class TongueMovement(info, screen, ttl_clock, const, subj_id)
Bases:
TaskTongue movement following Buckner et al., 2022! No particular feedback.
- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the tonguemovement task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class VerbGeneration(info, screen, ttl_clock, const, subj_id)
Bases:
Task- cue(condition)
Build the coloured condition label drawn just above the stimulus word.
- cue_colors = {'generate': 'green', 'read': 'red'}
- cue_labels = {'generate': 'GENERATE', 'read': 'READ'}
- display_instructions()
Displays the descriptive name of the task. then instruction to press response key 1 for true and response key 2 for false. Tasks with different instructions implement a new version to overwrite this default version
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Run a single trial of the VerbGeneration task.
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- show_stim(noun, condition)
Display the condition cue (top) and the word for a fixed time.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)
- class VisualSearch(info, screen, ttl_clock, const, subj_id)
Bases:
TaskLook at a screen filled with shapes and identify whether an “L” is present. Click “3” if the “L” is present; click “4” if not. Be as accurate and fast as possible.
- display_instructions()
displays the instruction for the task
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial at the position of fixation cross. Correct is a green check mark, incorrect a red cross.
- Parameters:
give_feedback (bool) – If true, gives informative feedback - otherwise just shows fixation cross
correct_response (bool) – Response was correct?, False otherwise
- generate_trial_stimuli(num_stimuli)
- get_audio_from_movie(movie_path, sample_rate=48000)
Seperates the audio from the movie file and returns the audio object (for better memory handling when playing movies with sound)
- Parameters:
movie_path (str) – Path and filename of the Movie file
sample_rate (int) – Sampling rate of movie file, defaults to 48000.
- Returns:
audio (sound.sound) – Sound object
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials in the task object and collects data Data will be stored in self.trial_data
- Returns:
acc (float) – Mean accuracy in proportion correct
rt (float) – Mean reaction time in s
- run_trial(trial)
Runs a single trial of visual search task
- save_data(subj_id, run_num)
Saves the data to the trial data file
- Parameters:
subj_id (str) – Subject id to determine name
run_num (int) – Number of run - inserted as first column
- screen_quit()
Checks for quit or escape key presses and quits the experiment if necessary
- show_progress(seconds_left, show_last_seconds=5, height=1, width=10, x_pos=-5, y_pos=8)
Displays a progress bar for the Picture Sequence task
- Parameters:
seconds_left (float) – The number of seconds remaining in the current trial. If this value is greater than show_last_seconds, the progress bar is not shown.
show_last_seconds (float, optional) – The duration (in seconds) over which to display the progress bar at the end of a trial. Default is 5 seconds. When seconds_left is less than this value, the progress bar appears.
height (float, optional) – The vertical size of the progress bar in PsychoPy window units. Default is 1.
width (float, optional) – The horizontal size of the progress bar in PsychoPy window units. Default is 10.
x_pos (float, optional) – The horizontal position of the center of the progress bar in window coordinates. Negative values move it leftward. Default is -5.
y_pos (float, optional) – The vertical position of the center of the progress bar in window coordinates. Positive values move it upward. Default is 8.
- wait_response(start_time, max_wait_time, show_last_seconds=None, current_stimuli=None)
waits for a response to be made and then returns the response
- Parameters:
start_time (float) – the time the RT-period started
max_wait_time (float) – How long to wait maximally
show_last_seconds (float or None) – If set, show a progress bar during the final show_last_seconds of the response window. Requires current_stimuli to be set so the display can be redrawn each frame.
current_stimuli (optional) – A single PsychoPy stimulus or a list of stimuli to redraw each frame when the progress bar is active.
- Returns:
key (str) – the key that was pressed (1-4) (0 if no key was pressed)
rt (float) – the reaction time (nan if no key was pressed)