def test_rename_and_move(self): self._test_rename_ephys_files() # Test for 3A misc.move_ephys_files(self.local_session_path_3A) probe00_files = list(self.probe00_path_3A.rglob("*")) probe00_file_names = [x.name for x in probe00_files] probe01_files = list(self.probe01_path_3A.rglob("*")) probe01_file_names = [x.name for x in probe01_files] self.assertTrue( "_spikeglx_ephysData_g0_t0.imec.ap.bin" in probe00_file_names and "_spikeglx_ephysData_g0_t0.imec.ap.meta" in probe00_file_names and "_spikeglx_ephysData_g0_t0.imec.lf.bin" in probe00_file_names and "_spikeglx_ephysData_g0_t0.imec.lf.meta" in probe00_file_names ) self.assertTrue( "_spikeglx_ephysData_g0_t0.imec.ap.bin" in probe01_file_names and "_spikeglx_ephysData_g0_t0.imec.ap.meta" in probe01_file_names and "_spikeglx_ephysData_g0_t0.imec.lf.bin" in probe01_file_names and "_spikeglx_ephysData_g0_t0.imec.lf.meta" in probe01_file_names ) # Test for 3B misc.move_ephys_files(self.local_session_path_3B) probe00_files = list(self.probe00_path_3B.rglob("*")) probe00_file_names = [x.name for x in probe00_files] probe01_files = list(self.probe01_path_3B.rglob("*")) probe01_file_names = [x.name for x in probe01_files] nidq_files = list(self.raw_ephys_data_path_3B.glob("*.nidq.*")) nidq_file_names = [x.name for x in nidq_files] self.assertTrue( "_spikeglx_ephysData_g0_t0.imec0.ap.bin" in probe00_file_names and "_spikeglx_ephysData_g0_t0.imec0.ap.meta" in probe00_file_names and "_spikeglx_ephysData_g0_t0.imec0.lf.bin" in probe00_file_names and "_spikeglx_ephysData_g0_t0.imec0.lf.meta" in probe00_file_names ) self.assertTrue( "_spikeglx_ephysData_g0_t0.imec1.ap.bin" in probe01_file_names and "_spikeglx_ephysData_g0_t0.imec1.ap.meta" in probe01_file_names and "_spikeglx_ephysData_g0_t0.imec1.lf.bin" in probe01_file_names and "_spikeglx_ephysData_g0_t0.imec1.lf.meta" in probe01_file_names ) self.assertTrue( "_spikeglx_ephysData_g0_t0.nidq.bin" in nidq_file_names and "_spikeglx_ephysData_g0_t0.nidq.meta" in nidq_file_names )
def test_rename_and_move(self): self._test_rename_ephys_files() # TODO: Move files from the bad folders to the local_probe folders? # Test for 3A misc.move_ephys_files(self.local_session_path_3A) probe00_files = list(self.probe00_path_3A.rglob('*')) probe00_file_names = [x.name for x in probe00_files] probe01_files = list(self.probe01_path_3A.rglob('*')) probe01_file_names = [x.name for x in probe01_files] self.assertTrue( '_spikeglx_ephysData_g0_t0.imec.ap.bin' in probe00_file_names and '_spikeglx_ephysData_g0_t0.imec.ap.meta' in probe00_file_names and '_spikeglx_ephysData_g0_t0.imec.lf.bin' in probe00_file_names and '_spikeglx_ephysData_g0_t0.imec.lf.meta' in probe00_file_names) self.assertTrue( '_spikeglx_ephysData_g0_t0.imec.ap.bin' in probe01_file_names and '_spikeglx_ephysData_g0_t0.imec.ap.meta' in probe01_file_names and '_spikeglx_ephysData_g0_t0.imec.lf.bin' in probe01_file_names and '_spikeglx_ephysData_g0_t0.imec.lf.meta' in probe01_file_names) # Test for 3B misc.move_ephys_files(self.local_session_path_3B) probe00_files = list(self.probe00_path_3B.rglob('*')) probe00_file_names = [x.name for x in probe00_files] probe01_files = list(self.probe01_path_3B.rglob('*')) probe01_file_names = [x.name for x in probe01_files] nidq_files = list(self.raw_ephys_data_path_3B.glob('*.nidq.*')) nidq_file_names = [x.name for x in nidq_files] self.assertTrue( '_spikeglx_ephysData_g0_t0.imec0.ap.bin' in probe00_file_names and '_spikeglx_ephysData_g0_t0.imec0.ap.meta' in probe00_file_names and '_spikeglx_ephysData_g0_t0.imec0.lf.bin' in probe00_file_names and '_spikeglx_ephysData_g0_t0.imec0.lf.meta' in probe00_file_names) self.assertTrue( '_spikeglx_ephysData_g0_t0.imec1.ap.bin' in probe01_file_names and '_spikeglx_ephysData_g0_t0.imec1.ap.meta' in probe01_file_names and '_spikeglx_ephysData_g0_t0.imec1.lf.bin' in probe01_file_names and '_spikeglx_ephysData_g0_t0.imec1.lf.meta' in probe01_file_names) self.assertTrue( '_spikeglx_ephysData_g0_t0.nidq.bin' in nidq_file_names and '_spikeglx_ephysData_g0_t0.nidq.meta' in nidq_file_names)
def test_rename_and_move(self): # Test for 3A self._test_rename_ephys_files(self.session_path_3A, 4) misc.move_ephys_files(self.session_path_3A) probe_folders = list(self.session_path_3A.rglob("*probe*")) self.assertTrue( len(probe_folders) == 1 and probe_folders[0].parts[-1] == 'probe00') expected = [ '_spikeglx_ephysData_g0_t0.imec.ap.bin', '_spikeglx_ephysData_g0_t0.imec.ap.meta', '_spikeglx_ephysData_g0_t0.imec.lf.bin', '_spikeglx_ephysData_g0_t0.imec.lf.meta' ] self.assertCountEqual(expected, [x.name for x in probe_folders[0].glob('*')]) # Test for 3B self._test_rename_ephys_files(self.session_path_3B, 14) misc.move_ephys_files(self.session_path_3B) probe_folders = sorted(self.session_path_3B.rglob("*probe*")) # Check moved into 'probexx' folders self.assertTrue(len(probe_folders) == 3) self.assertCountEqual((f'probe0{x}' for x in range(3)), [x.parts[-1] for x in probe_folders]) for i in range(3): expected = [ f'_spikeglx_ephysData_g0_t0.imec{i}.ap.bin', f'_spikeglx_ephysData_g0_t0.imec{i}.ap.meta', f'_spikeglx_ephysData_g0_t0.imec{i}.lf.bin', f'_spikeglx_ephysData_g0_t0.imec{i}.lf.meta' ] self.assertCountEqual(expected, [x.name for x in probe_folders[i].glob('*')]) nidq_files = self.session_path_3B.joinpath('raw_ephys_data').glob( "*.nidq.*") expected = [ '_spikeglx_ephysData_g0_t0.nidq.bin', '_spikeglx_ephysData_g0_t0.nidq.meta' ] self.assertCountEqual(expected, [x.name for x in nidq_files])