cibrrig.main_pipeline ===================== .. py:module:: cibrrig.main_pipeline .. autoapi-nested-parse:: Takes a spikeglx run and performs: 1) compression and copy backup to archive 2) Renaming to alf 3) Preprocessing 4) Spikesorting # Gui created in part by chatgpt Classes ------- .. autoapisummary:: cibrrig.main_pipeline.Status cibrrig.main_pipeline.DataOrganization Functions --------- .. autoapisummary:: cibrrig.main_pipeline.check_is_alf cibrrig.main_pipeline.check_data_organization cibrrig.main_pipeline.set_status cibrrig.main_pipeline.get_status cibrrig.main_pipeline.check_unit_refine cibrrig.main_pipeline.setup_logging cibrrig.main_pipeline.main cibrrig.main_pipeline.run cibrrig.main_pipeline.cli Module Contents --------------- .. py:class:: Status Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: NONE :value: 0 .. py:attribute:: PREPROC :value: 10 .. py:attribute:: SPIKESORTED :value: 20 .. py:attribute:: CONCATENATED :value: 30 .. py:attribute:: SYNCHRONIZED :value: 40 .. py:attribute:: RESP_MOD_COMPUTED :value: 50 .. py:class:: DataOrganization(*args, **kwds) Bases: :py:obj:`enum.Enum` Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: RAW :value: 'raw' .. py:attribute:: ARCHIVED :value: 'archived' .. py:attribute:: ALF :value: 'alf' .. py:function:: check_is_alf(run_path) Check if the run path is already in ALF format .. py:function:: check_data_organization(in_path) Check if data is in the raw spikeglx organization, the archived subject organziation, or alf raw spikeglx organization: /Subjects///*.nidq.bin /Subjects////*.ap.bin ... archived subject organization: /Subjects////*.nidq.bin /Subjects/////*.ap.bin ... alf organization: /Subjects////alf /Subjects////raw_ephys_data ... .. py:function:: set_status(session, status) Set the status of the session .. py:function:: get_status(session) Get the status of the session .. py:function:: check_unit_refine() .. py:function:: setup_logging(local_run_path) .. py:function:: main() Main function to run the pipeline This function runs the pipeline for a selected run directory. It performs the following steps: 1) Backup and compress the data to the archive 2) Rename the data to ALF format 3) Extract and preprocess the auxiliary data 4) Spikesort the data 5) Move the data to the working directory .. py:function:: run(local_run_path: pathlib.Path, remote_working_path: pathlib.Path | None, remote_archive_path: pathlib.Path | None, remove_opto_artifact: bool, run_ephysQC: bool, compress_locally: bool = True) Run the main pipeline 1) Compress data locally (if compress_locally=True) 2) Backup compressed data to archive 3) Rename to ALF if not already 4) Preprocess each session 5) Spikesort each session 6) Move to working directory 7) Synchronize sorting to aux :param local_run_path: Path to the local run directory :type local_run_path: Path :param remote_working_path: Path to the remote working directory :type remote_working_path: Path :param remote_archive_path: Path to the remote archive directory :type remote_archive_path: Path :param remove_opto_artifact: Whether to remove opto artifact during preprocessing :type remove_opto_artifact: bool :param run_ephysQC: Whether to run ephys QC during preprocessing :type run_ephysQC: bool :param compress_locally: Whether to compress data locally before backup. Defaults to True. :type compress_locally: bool .. py:function:: cli(local_run_path, remote_working_path=None, remote_archive_path=None, remove_opto_artifact=False, run_ephysqc=False, no_local_compression=False) Command line interface for running the main pipeline. :param local_run_path: Path to the data source run directory. Typically on the local computer (NPX acquisition) :type local_run_path: str :param remote_working_path: Path to the remote working directory where uncompressed active data is stored :type remote_working_path: str :param remote_archive_path: Path to the remote archive directory where compressed freezes are stored :type remote_archive_path: str :param remove_opto_artifact: Whether to remove opto artifact during preprocessing :type remove_opto_artifact: bool :param run_ephysQC: Whether to run ephys QC during preprocessing :type run_ephysQC: bool :param no_local_compression: Whether to use legacy remote compression behavior :type no_local_compression: bool :returns: None