Task_blocks Module
- class Task(info, screen, ttl_clock, const, subj_id)
Task: 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 ActionObservation(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 ActionPrediction(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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- run_trial(trial)
Runs a single trial of the Action 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 DegradedPassage(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 FrithHappe(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- run_trial(trial)
Runs a single trial of the Frith-Happe 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 IntactPassage(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 Liking(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 NonwordReading(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- run_trial(trial)
Run a single trial of the nonword 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 PictureSequence(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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_presses(pressed_keys, positions, last_key_press_time, width=1.4, height=7, line_width=10)
Displays the presses on the screen :param pressed_keys: A list of the keys that have been pressed :type pressed_keys: list :param positions: A list of the positions of the images :type positions: list :param width: The width of the images :type width: float :param height: The height of the images :type height: float :param line_width: The width of the border :type line_width: float :param last_key_press_time: The time of the last key press :type last_key_press_time: float
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 Pong(info, screen, ttl_clock, const, subj_id)
Bases:
TaskPong task
- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 SemanticSwitching(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()
Display instructions for the semantic switching task.
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe.
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- run_trial(trial)
Runs a single trial of the semantic switching 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 SentenceReading(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
display the feedback for the current trial using the color of the fixation 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)
Initialize task - default is to read the target information into the trial_info dataframe
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 StorySequence(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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_presses(sentences, positions, pressed_keys, last_key_press_time, wrapWidth, text_height=1)
Displays the presses on the screen :param sentences: A list of the sentences to be displayed :type sentences: list :param positions: A list of the positions of the sentences :type positions: list :param pressed_keys: A list of the keys that have been pressed :type pressed_keys: list :param last_key_press_time: The time of the last key press :type last_key_press_time: float :param wrapWidth: The width of the text :type wrapWidth: float
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 StrangeStories(info, screen, ttl_clock, const, subj_id)
Bases:
Task- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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- display_generate_instruction()
Display the ‘GENERATE’ instruction.
- display_instructions()
displays the instruction for the task Most tasks have the same instructions. (Tasks that have True/False responses) Those tasks that have different instructions will have their own routine
- display_trial_feedback(give_feedback, correct_response)
display the feedback for the current trial using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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)
Display a 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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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 using the color of the fixation 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)
- init_task()
Initialize task - default is to read the target information into the trial_info dataframe
- run()
Loop over trials and collects data Data will be stored in self.trial_data
- Returns:
info (pd.DataFrame) – _description_
- 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 :param seconds_left: The number of seconds remaining in the current trial.
If this value is greater than show_last_seconds, the progress bar is not shown.
- Parameters:
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 :param start_time: the time the RT-period started :type start_time: float :param max_wait_time: How long to wait maximally :type max_wait_time: float :param show_last_seconds: 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.
- Parameters:
current_stimuli – 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)