def eye(): """ Adds eye Position and PupilTracking to behavior processing module. Needs data from eye.timestamps.npy, eye.area.npy, and eye.xyPos.npy. """ eye_timestamps = read_npy_file('eye.timestamps.npy')[:, 1] # takes out index eye_area = read_npy_file('eye.area.npy') eye_xy_pos = read_npy_file('eye.xyPos.npy') pupil = TimeSeries( name='eye_area', timestamps=eye_timestamps, data=np.ravel(eye_area), unit='arb. unit', description='Features extracted from the video of the right eye.', comments='The area of the pupil extracted with DeepLabCut. Note that ' 'it is relatively very small during the discrimination task ' 'and during the passive replay because the three screens are ' 'medium-grey at this time and black elsewhere - so the much ' 'brighter overall luminance levels lead to relatively ' 'constricted pupils.') eye_xy = TimeSeries( name='eye_xy_positions', timestamps=eye_timestamps, data=eye_xy_pos, # currently as [x, y] pairs unit='arb. unit', description='Features extracted from the video of the right eye.', comments='The 2D position of the center of the pupil in the video ' 'frame. This is not registered to degrees visual angle, but ' 'could be used to detect saccades or other changes in eye position.') pupil_track = PupilTracking(pupil) pupil_track.add_timeseries(eye_xy) behavior_module.add_data_interface(pupil_track)
def test_init(self): ts = TimeSeries('test_ts', np.ones((2, 2)), 'unit', timestamps=[1., 2., 3.]) pt = PupilTracking(ts) self.assertEqual(pt.time_series['test_ts'], ts)
def test_init(self): ts = TimeSeries('test_ts', 'a hypothetical source', list(), 'unit', timestamps=list()) pt = PupilTracking('test_pt', ts) self.assertEqual(pt.source, 'test_pt') self.assertEqual(pt.time_series, ts)
def test_init(self): ts = TimeSeries('test_ts', list(), 'unit', timestamps=list()) pt = PupilTracking(ts) self.assertEqual(pt.time_series['test_ts'], ts)