cibrrig.archiving.ephys_data_to_alf =================================== .. py:module:: cibrrig.archiving.ephys_data_to_alf .. autoapi-nested-parse:: This module reformats raw electrophysiological data to match the ALF standards used by the International Brain Laboratory (IBL). It is intended for organizing data generated by SpikeGLX. The script renames and moves files in place, so ensure that the raw data has been backed up before running the script. Key Features: - Renames probe folders and moves video and electrophysiological data to standardized locations. - Ensures that wiring maps are correctly applied to the electrophysiological data. - Handles the renaming of multiple gates and sessions for a given run path. - Allows optional skipping of backup checks before renaming files. Attributes ---------- .. autoapisummary:: cibrrig.archiving.ephys_data_to_alf._log cibrrig.archiving.ephys_data_to_alf.DEFAULT_IMEC cibrrig.archiving.ephys_data_to_alf.DEFAULT_NIDQ Classes ------- .. autoapisummary:: cibrrig.archiving.ephys_data_to_alf.Run Functions --------- .. autoapisummary:: cibrrig.archiving.ephys_data_to_alf._get_probe_number cibrrig.archiving.ephys_data_to_alf.rename_probe_folders cibrrig.archiving.ephys_data_to_alf.rename_nested_probes cibrrig.archiving.ephys_data_to_alf.rename_flat_probe cibrrig.archiving.ephys_data_to_alf.rename_and_move_video cibrrig.archiving.ephys_data_to_alf.check_backup_flag cibrrig.archiving.ephys_data_to_alf.remove_backup_flag cibrrig.archiving.ephys_data_to_alf.get_record_date cibrrig.archiving.ephys_data_to_alf.get_gate_number cibrrig.archiving.ephys_data_to_alf.check_wiring cibrrig.archiving.ephys_data_to_alf.move_ni_files cibrrig.archiving.ephys_data_to_alf.rename_session cibrrig.archiving.ephys_data_to_alf.run cibrrig.archiving.ephys_data_to_alf.cli Module Contents --------------- .. py:data:: _log .. py:data:: DEFAULT_IMEC .. py:data:: DEFAULT_NIDQ .. py:function:: _get_probe_number(probe_path) .. py:function:: rename_probe_folders(session_path) Renames probe folders under 'raw_ephys_data' to ALF standards (e.g., 'probe00', 'probe01'). :param session_path: The path to the session directory. :type session_path: Path :returns: List of renamed probe paths. :rtype: list .. py:function:: rename_nested_probes(session_path, raw_ephys_folder, ap_bin_files) .. py:function:: rename_flat_probe(session_path, raw_ephys_folder, ap_bin_files) .. py:function:: rename_and_move_video(session_path) Moves and renames video files to the 'raw_video_data' directory following ALF standards. :param session_path: The path to the session directory. :type session_path: Path .. py:function:: check_backup_flag(session_path) Checks if the session has been backed up by verifying the existence of a backup flag file. :param session_path: The path to the session directory. :type session_path: Path :raises AssertionError: If the backup flag file does not exist. .. py:function:: remove_backup_flag(session_path) Removes the backup flag file from the session directory since it is not us. :param session_path: The path to the session directory. :type session_path: Path .. py:function:: get_record_date(gate) Retrieves the recording date from the metadata of the electrophysiological data. :param gate: The path to the gate directory. :type gate: Path :returns: The recording date in YYYY-MM-DD format. :rtype: str .. py:function:: get_gate_number(gate) Extracts the gate number from the gate folder name. :param gate: The path to the gate directory. :type gate: Path :returns: The gate number. :rtype: int .. py:function:: check_wiring(session_path) Ensures that the appropriate wiring map is applied to the session. If a wiring map is missing, it uses the default map. :param session_path: The path to the session directory. :type session_path: Path .. py:function:: move_ni_files(session_path) Moves .nidq files to the 'raw_ephys_data' directory. :param session_path: The path to the session directory. :type session_path: Path .. py:function:: rename_session(session_path) Renames and organizes a session by: - Renaming probe folders. - Moving .nidq files. - Checking and applying wiring maps. - Renaming and moving electrophysiological and video data. - Removing the backup flag. :param session_path: The path to the session directory. :type session_path: Path .. py:class:: Run(run_path) Represents a recording run consisting of multiple gates. .. attribute:: run_path The path to the run directory. :type: Path .. attribute:: gates List of gate directories within the run. :type: list .. py:attribute:: run_path .. py:method:: get_gates() Finds all gate directories in the run directory and stores them in sorted order. .. py:method:: move_gates() Moves gates into directories named by their recording date and renames log files accordingly. .. py:method:: move_run_files(dest) Move files specific for a given day's run into the date folder .. py:function:: run(run_path, skip_backup_check=False) Runs the renaming and reorganization process for a given run. :param run_path: The path to the run directory. :type run_path: str :param skip_backup_check: Flag to skip the backup check before renaming files. :type skip_backup_check: bool .. py:function:: cli(run_path, skip_backup_check) Command-line interface to run the renaming and reorganization process. :param run_path: The path to the run directory. :type run_path: str :param skip_backup_check: Option to skip the backup check. :type skip_backup_check: bool