cibrrig.postprocess.synchronize_sorting_to_aux

This module applies synchronization to the ALF (Alyx Filenames) standard for all probes within a given session path. The synchronization adjusts spike times from the IMEC clock to the NIDAQ clock.

Key Features:

  • Applies synchronization to spike times.

  • Saves adjusted and original spike times.

  • Provides a command-line interface for session processing.

Attributes

_log

Functions

get_ap_breaks_samps(ap_files)

Computes the cumulative sample lengths for multiple recordings. This is useful

sync_spikes(ap_files, spikes)

Synchronizes spike times by adjusting them to match the NIDAQ clock, based on

run_session(session_path)

Converts all sorting in a session to the ALF standard, applying synchronization and QC metrics.

main(session_path, sorting_name)

Command-line interface for converting spike sorting data to the ALF standard.

Module Contents

cibrrig.postprocess.synchronize_sorting_to_aux._log[source]
cibrrig.postprocess.synchronize_sorting_to_aux.get_ap_breaks_samps(ap_files)[source]

Computes the cumulative sample lengths for multiple recordings. This is useful for handling recordings across multiple triggers.

Example: If recording 1 has 110 samples and recording 2 has 24 samples, this function returns [0, 110, 134].

Parameters:

ap_files (list[Path]) – List of paths to .ap.bin or .ap.cbin files.

Returns:

Cumulative sample lengths across recordings.

Return type:

numpy.ndarray

cibrrig.postprocess.synchronize_sorting_to_aux.sync_spikes(ap_files, spikes)[source]

Synchronizes spike times by adjusting them to match the NIDAQ clock, based on synchronization files that align the IMEC clock to the NIDAQ clock. Spikes with negative times are set to zero.

Parameters:
  • ap_files (list[Path]) – List of paths to .ap.bin or .ap.cbin files.

  • spikes (AlfBunch) – ALF object containing spike data.

Returns:

Adjusted spike times after synchronization.

Return type:

numpy.ndarray

cibrrig.postprocess.synchronize_sorting_to_aux.run_session(session_path)[source]

Converts all sorting in a session to the ALF standard, applying synchronization and QC metrics.

Assumes: - Spike sorting data is in the structure: <session>/alf/probeXX/ - Raw ephys data is located in: <session>/raw_ephys_data/probeXX - Processed ephys data is stored as: <session>/alf/probeXX/<.si>/.preprocessed :param session_path: Path to the session directory. :type session_path: Path

cibrrig.postprocess.synchronize_sorting_to_aux.main(session_path, sorting_name)[source]

Command-line interface for converting spike sorting data to the ALF standard.

Parameters:
  • session_path (str) – Path to the session directory.

  • sorting_name (str) – Name of the sorting.