DummyTask
- class DummyTask[source]
Bases:
TaskA dummy task class for use during calibration.
- __init__() None
Initializes the Task instance with default settings and components.
Methods
__init__()Initializes the Task instance with default settings and components.
Executed after each trial completes.
close()Closes the dummy task (no-op).
Appends the current trial's data to the session DataFrame.
Sets up file and directory paths for the session.
Creates the state machine for the current trial.
disconnect_and_save(run_mode)Stops the task, disconnects devices, and saves session data.
do_trial([send_to_cam])Executes a single trial.
get_name()Returns the name of the task class.
Retrieves and processes data from the last executed trial.
Registers standard session metadata values (task, subject, system, date).
register_value(name, value)Registers a custom value to be saved with the trial data.
run()Runs the task in the main thread until completion or forced stop.
run_in_thread([daemon])Runs the task in a separate background thread.
save_csv(run_mode)Saves the session data to CSV files.
save_json(run_mode)Saves the session settings to a JSON file.
send_softcode_to_bpod(code)Sends a softcode to the Bpod device.
start()Starts the task.
transform(df)Transforms raw session data into a wide format suitable for analysis.
- close()[source]
Closes the dummy task (no-op).
- after_trial() None
Executed after each trial completes. Must be overridden.
- concatenate_trial_data() None
Appends the current trial’s data to the session DataFrame.
- create_paths() None
Sets up file and directory paths for the session.
- create_trial() None
Creates the state machine for the current trial. Must be overridden.
- disconnect_and_save(run_mode: str) Tuple[Save, float, int, int, str]
Stops the task, disconnects devices, and saves session data.
- Parameters:
run_mode (str) – The mode in which the task was run (e.g., “Manual”).
- Returns:
A tuple containing the save status, session duration, number of trials, water consumed, and settings string.
- Return type:
Tuple[Save, float, int, int, str]
- do_trial(send_to_cam: bool = False) None
Executes a single trial.
Initializes the state machine, runs it, collects data, and performs post-trial updates.
- Parameters:
send_to_cam (bool, optional) – Whether to update the camera with the trial number. Defaults to False.
- classmethod get_name() str
Returns the name of the task class.
- get_trial_data() None
Retrieves and processes data from the last executed trial.
Extracts timestamps, events, and states from the Bpod session and updates self.trial_data.
- register_default_values() None
Registers standard session metadata values (task, subject, system, date).
- register_value(name: str, value: Any) None
Registers a custom value to be saved with the trial data.
- Parameters:
name (str) – The name of the value (column header).
value (Any) – The value to store.
- run() None
Runs the task in the main thread until completion or forced stop.
- run_in_thread(daemon: bool = True) None
Runs the task in a separate background thread.
- Parameters:
daemon (bool, optional) – Whether to run as a daemon thread. Defaults to True.
- save_csv(run_mode: str) Tuple[float, int, int, bool]
Saves the session data to CSV files.
Processes raw data, saves raw and clean session files, and updates the subject’s cumulative data file.
- Parameters:
run_mode (str) – The execution mode string.
- Returns:
Duration, trial count, water consumed, and success status.
- Return type:
Tuple[float, int, int, bool]
- save_json(run_mode: str) str
Saves the session settings to a JSON file.
- Parameters:
run_mode (str) – The execution mode string.
- Returns:
The JSON string containing the settings.
- Return type:
str
- send_softcode_to_bpod(code: int) None
Sends a softcode to the Bpod device.
- Parameters:
code (int) – The softcode value to send.
- start() None
Starts the task. Must be overridden by subclasses.
- transform(df: pandas.DataFrame) pandas.DataFrame
Transforms raw session data into a wide format suitable for analysis.
- Parameters:
df (pd.DataFrame) – Raw dataframe.
- Returns:
Transformed dataframe.
- Return type:
pd.DataFrame
- bpod: PyBpodBase
- name: str
- subject: str
- current_trial: int
- current_trial_states: list
- touch_response: list
- system_name: str
- date: str
- info: str
- filename: str
- sessions_directory: str
- raw_session_path: str
- session_path: str
- session_settings_path: str
- video_directory: str
- video_path: str
- video_data_path: str
- subject_path: str
- rt_session_path: str
- settings: Settings
- training: TrainingProtocolBase
- trial_data: dict
- raw_df: pandas.DataFrame
- session_df: pandas.DataFrame
- subject_df: pandas.DataFrame
- force_stop: bool
- maximum_number_of_trials: int
- sound_calibration: Collection
- water_calibration: Collection