From f7aecdb41294cc7c1b11f65c6d82b9a1c8bf0e83 Mon Sep 17 00:00:00 2001 From: Miles Wells Date: Fri, 8 Nov 2024 14:35:28 +0200 Subject: [PATCH] Windows CI test fix and Linux Numpy 2.0 test fix --- ibllib/io/extractors/camera.py | 11 +++++------ ibllib/tests/test_oneibl.py | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ibllib/io/extractors/camera.py b/ibllib/io/extractors/camera.py index 5ce07dd9e..76ae83279 100644 --- a/ibllib/io/extractors/camera.py +++ b/ibllib/io/extractors/camera.py @@ -303,14 +303,13 @@ def _times_from_bpod(self): n_frames = 0 n_out_of_sync = 0 missed_trials = [] - for ind in np.arange(ntrials): + for ind in range(ntrials): # get upgoing and downgoing fronts - pin = np.array(self.bpod_trials[ind]['behavior_data'] - ['Events timestamps'].get('Port1In')) - pout = np.array(self.bpod_trials[ind]['behavior_data'] - ['Events timestamps'].get('Port1Out')) + events = self.bpod_trials[ind]['behavior_data']['Events timestamps'] + pin = np.array(events.get('Port1In') or [np.nan]) + pout = np.array(events.get('Port1Out') or [np.nan]) # some trials at startup may not have the camera working, discard - if np.all(pin) is None: + if np.isnan(pin).all(): missed_trials.append(ind) continue # if the trial starts in the middle of a square, discard the first downgoing front diff --git a/ibllib/tests/test_oneibl.py b/ibllib/tests/test_oneibl.py index 7eaa33371..617625a49 100644 --- a/ibllib/tests/test_oneibl.py +++ b/ibllib/tests/test_oneibl.py @@ -725,7 +725,8 @@ def test_handler(self): self.assertTrue(all(f.is_symlink for f in linked), 'failed to sym link input files') self.assertEqual(len(task.input_files), len(linked), 'unexpected number of linked patch files') # Check all links to root session - self.assertTrue(all(f.resolve().is_relative_to(self.session_path) for f in linked)) + session_path = self.session_path.resolve() # NB: GitHub CI uses linked temp dir so we resolve here + self.assertTrue(all(f.resolve().is_relative_to(session_path) for f in linked)) # Check sym link doesn't contain UUID self.assertTrue(len(linked[0].resolve().stem.split('.')[-1]) == 36, 'source path missing UUID') self.assertFalse(len(linked[0].stem.split('.')[-1]) == 36, 'symlink contains UUID')