cibrrig.main_pipeline

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

Status

Enum where members are also (and must be) ints

DataOrganization

Create a collection of name/value pairs.

Functions

check_is_alf(run_path)

Check if the run path is already in ALF format

check_data_organization(in_path)

Check if data is in the raw spikeglx organization, the archived subject organziation, or alf

set_status(session, status)

Set the status of the session

get_status(session)

Get the status of the session

check_unit_refine()

setup_logging(local_run_path)

main()

Main function to run the pipeline

run(local_run_path, remote_working_path, ...[, ...])

Run the main pipeline

cli(local_run_path[, remote_working_path, ...])

Command line interface for running the main pipeline.

Module Contents

class cibrrig.main_pipeline.Status[source]

Bases: enum.IntEnum

Enum where members are also (and must be) ints

NONE = 0[source]
PREPROC = 10[source]
SPIKESORTED = 20[source]
CONCATENATED = 30[source]
SYNCHRONIZED = 40[source]
RESP_MOD_COMPUTED = 50[source]
class cibrrig.main_pipeline.DataOrganization(*args, **kwds)[source]

Bases: 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
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

RAW = 'raw'[source]
ARCHIVED = 'archived'[source]
ALF = 'alf'[source]
cibrrig.main_pipeline.check_is_alf(run_path)[source]

Check if the run path is already in ALF format

cibrrig.main_pipeline.check_data_organization(in_path)[source]

Check if data is in the raw spikeglx organization, the archived subject organziation, or alf

raw spikeglx organization: /Subjects/<run>/<run_gate>/.nidq.bin /Subjects/<run>/<run_gate>/<run_gate_probe>/.ap.bin …

archived subject organization: /Subjects/<subject>/<date>/<run_gate>/.nidq.bin /Subjects/<subject>/<date>/<run_gate>/<run_gate_probe>/.ap.bin …

alf organization: /Subjects/<subject>/<date>/<session>/alf /Subjects/<subject>/<date>/<session>/raw_ephys_data …

cibrrig.main_pipeline.set_status(session, status)[source]

Set the status of the session

cibrrig.main_pipeline.get_status(session)[source]

Get the status of the session

cibrrig.main_pipeline.check_unit_refine()[source]
cibrrig.main_pipeline.setup_logging(local_run_path)[source]
cibrrig.main_pipeline.main()[source]

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

cibrrig.main_pipeline.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)[source]

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

Parameters:
  • local_run_path (Path) – Path to the local run directory

  • remote_working_path (Path) – Path to the remote working directory

  • remote_archive_path (Path) – Path to the remote archive directory

  • remove_opto_artifact (bool) – Whether to remove opto artifact during preprocessing

  • run_ephysQC (bool) – Whether to run ephys QC during preprocessing

  • compress_locally (bool) – Whether to compress data locally before backup. Defaults to True.

cibrrig.main_pipeline.cli(local_run_path, remote_working_path=None, remote_archive_path=None, remove_opto_artifact=False, run_ephysqc=False, no_local_compression=False)[source]

Command line interface for running the main pipeline.

Parameters:
  • local_run_path (str) – Path to the data source run directory. Typically on the local computer (NPX acquisition)

  • remote_working_path (str) – Path to the remote working directory where uncompressed active data is stored

  • remote_archive_path (str) – Path to the remote archive directory where compressed freezes are stored

  • remove_opto_artifact (bool) – Whether to remove opto artifact during preprocessing

  • run_ephysQC (bool) – Whether to run ephys QC during preprocessing

  • no_local_compression (bool) – Whether to use legacy remote compression behavior

Returns:

None