ibllib.qc.dlc

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()

Question:

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

Functions

run_all_qc

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

Classes

DlcQC

A class for computing camera QC metrics

class DlcQC(session_path_or_eid, side, ignore_checks=['check_pupil_diameter_snr'], **kwargs)[source]

Bases: QC

A class for computing camera QC metrics

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)}}
dstypes = {'body': ['_ibl_bodyCamera.dlc.*', '_ibl_bodyCamera.times.*'], 'left': ['_ibl_leftCamera.dlc.*', '_ibl_leftCamera.times.*', '_ibl_leftCamera.features.*', '_ibl_trials.table.*'], 'right': ['_ibl_rightCamera.dlc.*', '_ibl_rightCamera.times.*', '_ibl_rightCamera.features.*', '_ibl_trials.table.*']}
load_data(download_data: bool | None = 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

Parameters:

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

Parameters:
  • update – if True, updates the session QC fields on Alyx

  • download_data – if True, downloads any missing data if required

Returns:

overall outcome as a str, a dict of checks and their outcomes

check_time_trace_length_match()[source]

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

check_trace_all_nan()[source]

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

check_mean_in_bbox()[source]

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

check_pupil_blocked()[source]

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_lick_detection()[source]

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

check_pupil_diameter_snr()[source]
check_paw_close_nan()[source]
check_paw_far_nan()[source]
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.

Parameters:
  • session – A session path or eid.

  • update – If True, QC fields are updated on Alyx.

  • cameras – A list of camera names to perform QC on.

Returns:

dict of DlcQC objects