Source code for ibllib.tests.integration.test_ephys_ttl_check

"""
The ttl_check pipeline is to validate a setup before doing recordings,
on the ephysChoiceWorld task, doing a dummy without animal and check that all syncs are there

This test is also a synchronization extraction test, as it checks the ouput. The tear down function
removes all _spikeglx_ files so they are regenerated from the small files accessible
"""
import ibllib.ephys.ephysqc

from ibllib.tests import base


[docs] class TestEphysCheckList(base.IntegrationTest): required_files = ['ephys/ttl_check'] _writable_scope = 'test'
[docs] def setUp(self): super().setUp() self.init_folder = self.data_path.joinpath('ephys', 'ttl_check') if not self.init_folder.exists(): return
[docs] def test_checklist_mock_3B_single(self): ses_path = self.init_folder / 'ttl_3B_single' self.assertTrue(ibllib.ephys.ephysqc.validate_ttl_test(ses_path))
[docs] def test_checklist_mock_3A_single(self): ses_path = self.init_folder / 'ttl_3A_single' self.assertTrue(ibllib.ephys.ephysqc.validate_ttl_test(ses_path))
[docs] def test_checklist_mock_3A_dual(self): ses_path = self.init_folder / 'ttl_3A_dual' self.assertTrue(ibllib.ephys.ephysqc.validate_ttl_test(ses_path))
[docs] def test_checklist_from_arbitrary_folder(self): ses_path = self.init_folder / 'ttl_3A_dual' self.assertTrue(ibllib.ephys.ephysqc.validate_ttl_test(ses_path)) ibllib.ephys.ephysqc.validate_ttl_test(ses_path / 'raw_ephys_data')
[docs] def test_checklist_mock_3B_dual(self): ses_path = self.init_folder / 'ttl_3B_dual' self.assertTrue(ibllib.ephys.ephysqc.validate_ttl_test(ses_path))
[docs] def test_checklist_empty_folder(self): ses_path = self.init_folder / 'empty' # Ensure the folder structure exists for the test for subfolder in ['probe00', 'probe01']: ses_path.joinpath(subfolder).mkdir(parents=True, exist_ok=True) with self.assertRaises(FileNotFoundError): ibllib.ephys.ephysqc.validate_ttl_test(ses_path)
[docs] def tearDown(self): # Remove any generated *.timestamps.npy and *.sync.npy files. for sf in self.init_folder.rglob('*g0_t0.imec*.npy'): sf.unlink() return super().tearDown()