ibllib.ephys.ephysqc

Quality control of raw Neuropixel electrophysiology data.

Functions

extract_rmsmap

Wrapper for rmsmap that outputs _ibl_ephysRmsMap and _ibl_ephysSpectra ALF files

phy_model_from_ks2_path

qc_fpga_task

:fpga_task is the dictionary output of ibllib.io.extractors.ephys_fpga.extract_behaviour_sync : bpod_trials is the dictionary output of ibllib.io.extractors.ephys_trials.extract_all : alf_trials is the ALF _ibl_trials object after extraction (alf.io.load_object) :return: qc_session, qc_trials, True means QC passes while False indicates a failure

raw_qc_session

Wrapper that exectutes QC from a session folder and outputs the results whithin the same folder as the original raw data.

rmsmap

Computes RMS map in time domain and spectra for each channel of Neuropixel probe

spike_sorting_metrics_ks2

Given a path containing kilosort 2 output, compute quality metrics and optionally save them to a clusters_metric.csv file :param ks2_path: :param save :return:

validate_ttl_test

For a mock session on the Ephys Choice world task, check the sync channels for all device properly connected and perform a synchronization if dual probes to check that all channels are recorded properly :param ses_path: session path :param display: show the probe synchronization plot if several probes :return: True if tests pass, errors otherwise

rmsmap(fbin)[source]

Computes RMS map in time domain and spectra for each channel of Neuropixel probe

Parameters

fbin (str or pathlib.Path) – binary file in spike glx format (will look for attached metatdata)

Returns

a dictionary with amplitudes in channeltime space, channelfrequency space, time and frequency scales

extract_rmsmap(fbin, out_folder=None, overwrite=False)[source]

Wrapper for rmsmap that outputs _ibl_ephysRmsMap and _ibl_ephysSpectra ALF files

Parameters
  • fbin – binary file in spike glx format (will look for attached metatdata)

  • out_folder – folder in which to store output ALF files. Default uses the folder in which the fbin file lives.

  • overwrite – do not re-extract if all ALF files already exist

  • label – string or list of strings that will be appended to the filename before extension

Returns

None

raw_qc_session(session_path, overwrite=False)[source]

Wrapper that exectutes QC from a session folder and outputs the results whithin the same folder as the original raw data. :param session_path: path of the session (Subject/yyyy-mm-dd/number :param overwrite: bool (False) Force means overwriting an existing QC file :return: None

validate_ttl_test(ses_path, display=False)[source]

For a mock session on the Ephys Choice world task, check the sync channels for all device properly connected and perform a synchronization if dual probes to check that all channels are recorded properly :param ses_path: session path :param display: show the probe synchronization plot if several probes :return: True if tests pass, errors otherwise

spike_sorting_metrics_ks2(ks2_path=None, m=None, save=True)[source]

Given a path containing kilosort 2 output, compute quality metrics and optionally save them to a clusters_metric.csv file :param ks2_path: :param save :return:

phy_model_from_ks2_path(ks2_path, bin_path, bin_file=None)[source]
qc_fpga_task(fpga_trials, alf_trials)[source]

:fpga_task is the dictionary output of ibllib.io.extractors.ephys_fpga.extract_behaviour_sync : bpod_trials is the dictionary output of ibllib.io.extractors.ephys_trials.extract_all : alf_trials is the ALF _ibl_trials object after extraction (alf.io.load_object) :return: qc_session, qc_trials, True means QC passes while False indicates a failure