def _test_rename_ephys_files(self, path, expected_n): """Test SpikeGLX output files are correctly renamed""" misc.rename_ephys_files(path) n = 0 for f in path.rglob("*.*.*"): if any(x in f.name for x in ('.ap.', '.lf.', '.nidq.')): self.assertTrue(f.name.startswith('_spikeglx_ephysData_g')) n += 1 self.assertEqual(expected_n, n)
def _test_rename_ephys_files(self): # Test 3A misc.rename_ephys_files(self.local_session_path_3A) ap_files = list(self.local_session_path_3A.rglob('*.ap.*')) lf_files = list(self.local_session_path_3A.rglob('*.lf.*')) self.assertTrue(len(ap_files) >= 1) self.assertTrue(len(lf_files) >= 1) for f in ap_files: print(f.parent.name, f.name) self.assertTrue('_spikeglx_ephysData_g' in str(f)) self.assertTrue('_t' in str(f)) self.assertTrue('.imec.ap' in str(f)) self.assertTrue(('.bin' in str(f) or '.meta' in str(f))) self.assertTrue(('probe00' in str(f) or 'probe01' in str(f))) for f in lf_files: print(f.parent.name, f.name) self.assertTrue('_spikeglx_ephysData_g' in str(f)) self.assertTrue('_t' in str(f)) self.assertTrue('.imec.lf' in str(f)) self.assertTrue(('.bin' in str(f) or '.meta' in str(f))) # Test 3B self.assertTrue(('probe00' in str(f) or 'probe01' in str(f))) # Test 3B misc.rename_ephys_files(self.local_session_path_3B) ap_files = list(self.local_session_path_3B.rglob('*.ap.*')) lf_files = list(self.local_session_path_3B.rglob('*.lf.*')) nidq_files = list(self.local_session_path_3B.rglob('*.nidq.*')) for f in ap_files: print(f.name) self.assertTrue('_spikeglx_ephysData_g' in str(f)) self.assertTrue('_t' in str(f)) self.assertTrue(('.imec0.ap' in str(f) or 'imec1.ap' in str(f))) self.assertTrue(('.bin' in str(f) or '.meta' in str(f))) for f in lf_files: print(f.name) self.assertTrue('_spikeglx_ephysData_g' in str(f)) self.assertTrue('_t' in str(f)) self.assertTrue(('.imec0.lf' in str(f) or 'imec1.lf' in str(f))) self.assertTrue(('.bin' in str(f) or '.meta' in str(f))) # Test 3B for f in nidq_files: print(f.name) self.assertTrue('_spikeglx_ephysData_g' in str(f)) self.assertTrue('_t' in str(f)) self.assertTrue('.nidq' in str(f)) self.assertTrue(('.bin' in str(f) or '.meta' in str(f)))
def _test_rename_ephys_files(self): # Test 3A misc.rename_ephys_files(self.local_session_path_3A) ap_files = list(self.local_session_path_3A.rglob("*.ap.*")) lf_files = list(self.local_session_path_3A.rglob("*.lf.*")) self.assertTrue(len(ap_files) >= 1) self.assertTrue(len(lf_files) >= 1) for f in ap_files: print(f.parent.name, f.name) self.assertTrue("_spikeglx_ephysData_g" in str(f)) self.assertTrue("_t" in str(f)) self.assertTrue(".imec.ap" in str(f)) self.assertTrue((".bin" in str(f) or ".meta" in str(f))) self.assertTrue(("probe00" in str(f) or "probe01" in str(f))) for f in lf_files: print(f.parent.name, f.name) self.assertTrue("_spikeglx_ephysData_g" in str(f)) self.assertTrue("_t" in str(f)) self.assertTrue(".imec.lf" in str(f)) self.assertTrue((".bin" in str(f) or ".meta" in str(f))) # Test 3B self.assertTrue(("probe00" in str(f) or "probe01" in str(f))) # Test 3B misc.rename_ephys_files(self.local_session_path_3B) ap_files = list(self.local_session_path_3B.rglob("*.ap.*")) lf_files = list(self.local_session_path_3B.rglob("*.lf.*")) nidq_files = list(self.local_session_path_3B.rglob("*.nidq.*")) for f in ap_files: print(f.name) self.assertTrue("_spikeglx_ephysData_g" in str(f)) self.assertTrue("_t" in str(f)) self.assertTrue((".imec0.ap" in str(f) or "imec1.ap" in str(f))) self.assertTrue((".bin" in str(f) or ".meta" in str(f))) for f in lf_files: print(f.name) self.assertTrue("_spikeglx_ephysData_g" in str(f)) self.assertTrue("_t" in str(f)) self.assertTrue((".imec0.lf" in str(f) or "imec1.lf" in str(f))) self.assertTrue((".bin" in str(f) or ".meta" in str(f))) # Test 3B for f in nidq_files: print(f.name) self.assertTrue("_spikeglx_ephysData_g" in str(f)) self.assertTrue("_t" in str(f)) self.assertTrue(".nidq" in str(f)) self.assertTrue((".bin" in str(f) or ".meta" in str(f)))