DLC QC This module runs a list of quality control metrics on the dlc traces.

Example - Run DLC QC

qc = DlcQC(eid, ‘left’, download_data=True) qc.run()


We’re not extracting the audio based on TTL length. Is this a problem?



Run DLC QC for all cameras Run the DLC QC for left, right and body cameras.



A class for computing camera QC metrics

class DlcQC(session_path_or_eid, side, **kwargs)[source]

Bases: ibllib.qc.base.QC

A class for computing camera QC metrics

dstypes = ['camera.dlc', 'camera.times']
bbox = {'body': {'xrange': range(201, 500), 'yrange': range(81, 330)}, 'left': {'xrange': range(301, 700), 'yrange': range(181, 470)}, 'right': {'xrange': range(301, 600), 'yrange': range(110, 275)}}
load_data(download_data: bool = None) → None[source]
Extract the data from data files

Extracts all the required task data from the data files.

Data keys:
  • camera_times (float array): camera frame timestamps extracted from frame headers

  • dlc_coords (dict): keys are the points traced by dlc, items are x-y coordinates of

    these points over time, those with likelihood <0.9 set to NaN

param download_data

if True, any missing raw data is downloaded via ONE.

run(update: bool = False, **kwargs) -> (<class 'str'>, <class 'dict'>)[source]

Run DLC QC checks and return outcome :param update: if True, updates the session QC fields on Alyx :param download_data: if True, downloads any missing data if required :returns: overall outcome as a str, a dict of checks and their outcomes


Check that the length of the DLC traces is the same length as the video.


Check that none of the dlc traces, except for the ‘tube’ traces, are all NaN.


Empirical bounding boxes around average dlc points, averaged across time and points; sessions with points out of this box were often faulty in terms of raw videos


get mean of both pupil diameters d1 = top - bottom, d2 = left - right


Check if pupil diameter is nan for more than 60 % of the frames (might be blocked by a whisker) Check if standard deviation is above a threshold, found for bad sessions


Check if both of the two tongue edge points are less than 10 % NaN, indicating that wrong points are detected (spout edge, mouth edge)

run_all_qc(session, cameras='left', 'right', 'body', one=None, **kwargs)[source]

Run DLC QC for all cameras Run the DLC QC for left, right and body cameras. :param session: A session path or eid. :param update: If True, QC fields are updated on Alyx. :param cameras: A list of camera names to perform QC on. :return: dict of DlcQC objects