ibllib.tests.integration.test_camera_extraction
Integration tests for the camera extraction and QC.
- Folders used:
camera/
ephys/ephys_choice_world_task/ibl_witten_27/2021-01-21/001/
ephys/choice_world_init/KS022/2019-12-10/001
Subjects_init/ZM_1098/2019-01-25/001/
training/CSHL_003/2019-04-05/001/
NB: These tests hit the main Alyx database. This is required for full coverage of the QC (in particular the CameraQC._ensure_required_data method and MotionAlign using eid2ref).
Classes
Test the video QC on some failure cases. |
|
Starting with version 8.28.0 of IBLRIG, the first trial of the state machine is no longer used for timing the initial delay and waiting for the first camera trigger. |
|
Test the video QC on some failure cases |
|
- class TestTrainingCameraExtractor(*args, **kwargs)[source]
Bases:
IntegrationTest- required_files = ['camera/FMR007/2021-02-25/001', 'camera/ZFM-01867/2021-03-23/002']
An optional list of required files/folders to glob for, relative to data_path.
- test_groom_pin_state()[source]
- e7098000-62a0-46a4-99df-981ee2b56988 (ZFM-01867/2/2021-03-23)
In this session there were occasions where the GPIO would change twice after an audio TTL, perhaps because the audio TTLs are often split up into two short TTLs on Bpod, some of which are caught by the camera, others not.
The function removes the short audio TTLs then assigns the rest to the GPIO fronts. The unassigned audio TTL fronts and GPIO changes are removed. Usually if the TTL low-to-high is not assigned to a GPIO front, neither is the high-to-low, so both are removed. However sometimes because of mis-assigning (due to clock drift, short TTLs, faulty wiring, etc.) there are some ‘orphaned’ TTLs/GPIO fronts leaving us with two low-to-high fronts (or high-to-low) in a row. These so-called orphaned fronts should be removed too. The goal is to end up with an array of audio TTL times and GPIO times that are the same length.
Debugging output states: - 2316 fronts TLLs less than 5ms apart - 11 audio TTL rises were not detected by the camera - 346 pin state rises could not be attributed to an audio TTL - 10 audio TTL falls were not detected by the camera - 345 pin state falls could not be attributed to an audio TTL - 3 orphaned TTLs removed
The output arrays are not aligned per se, but should at least have most GPIO fronts correctly assigned to the corresponding audio TTLs.
- Returns:
- class TestTrainingCameraExtractorNew(*args, **kwargs)[source]
Bases:
IntegrationTestStarting with version 8.28.0 of IBLRIG, the first trial of the state machine is no longer used for timing the initial delay and waiting for the first camera trigger. Instead, the first trial is now identical to the remaining trials. Here we test the extraction of the camera timestamps from such sessions. The integration data has a purposefully added 1-second delay between starting the camera and start of the first trial - this is not normally the case. It has been added here to test the effect of decoupling camera start and first trial on the synchronization of the camera timestamps with the Bpod trials.
- required_files = ['training/8.28.0/2025-06-12/002/*']
An optional list of required files/folders to glob for, relative to data_path.
- class TestEphysCameraExtractor(*args, **kwargs)[source]
Bases:
IntegrationTest- required_files = ['camera/SWC_054/2020-10-07/001', 'ephys/ephys_choice_world_task/ibl_witten_27/2021-01-21/001', 'Subjects_init/ZM_1098/2019-01-25/001']
An optional list of required files/folders to glob for, relative to data_path.
- test_extraction(mock_vc)[source]
Mock the VideoCapture class of cv2 so that we can control the number of frames
- Parameters:
mock_vc
- Returns:
- class TestVideoQC(*args, **kwargs)[source]
Bases:
IntegrationTestTest the video QC on some failure cases
- required_files = ['camera/10_sec_vids', 'camera/10sec_bad_location']
An optional list of required files/folders to glob for, relative to data_path.
- class TestCameraQC(*args, **kwargs)[source]
Bases:
IntegrationTestTest the video QC on some failure cases.
- required_files = ['Subjects_init/ZM_1098/2019-01-25/001', 'camera/SWC_054/2020-10-07/001', 'camera/FMR007/2021-02-25/001', 'camera/NR_0020/2022-01-27/001', 'camera/6c6983ef-7383-4989-9183-32b1a300d17a_frame_samples.npy', 'camera/7082d576-4eb4-41dc-a16e-8a742829a83a_frame_samples.npy', 'camera/451bc9c0-113c-408e-a924-122ffe44306e_frame_samples.npy']
An optional list of required files/folders to glob for, relative to data_path.
- test_ephys_session(mock_ext, mock_meta)[source]
Tests the full QC process for an ephys session.
Mock a load of things so we don’t need the full video file.
- Parameters:
mock_ext – mock cv.VideoCapture in camera extractor module
mock_meta – mock get_video_meta
- Returns:
- test_training_session(mock_ext, mock_meta)[source]
Tests the full QC process for a training session. Mock a load of things so we don’t need the ful video file.
- Parameters:
mock_ext – mock cv.VideoCapture in camera extractor module
mock_meta – mock get_video_meta
- Returns:
- test_habituation_session(mock_ext, mock_meta)[source]
Tests the full QC process for a habituation session. :return:
- class TestWheelMotionNRG(*args, **kwargs)[source]
Bases:
IntegrationTest- required_files = ['camera/6c6983ef-7383-4989-9183-32b1a300d17a_frame_samples.npy', 'camera/SWC_054/2020-10-07/001']
An optional list of required files/folders to glob for, relative to data_path.
- class TestWheelAlignment(*args, **kwargs)[source]
Bases:
IntegrationTest- required_files = ['training/CSHL_003/2019-04-05/001', 'ephys/choice_world_init/KS022/2019-12-10/001']
An optional list of required files/folders to glob for, relative to data_path.