From 57832edc596656b015efda38d9f0a18050586df9 Mon Sep 17 00:00:00 2001 From: Chase King Date: Sat, 6 Jan 2024 18:40:56 -0800 Subject: [PATCH 1/5] Update get_eye_tracking method in brain observatory cache with more detailed documentation --- allensdk/core/brain_observatory_cache.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/allensdk/core/brain_observatory_cache.py b/allensdk/core/brain_observatory_cache.py index 3d66ae615c..cda5eb39f8 100644 --- a/allensdk/core/brain_observatory_cache.py +++ b/allensdk/core/brain_observatory_cache.py @@ -654,9 +654,15 @@ def get_eye_tracking(self, ophys_experiment_id) -> np.ndarray: Returns ------- `numpy.ndarray` - Contents of array unknown. Assumed to be [n_frames, 5] where - the meaning of the values in each column are unknown. - Ask Saskia De Vries saskiad@alleninstitute.org + Shape of array is (n_frames, 5). Values at axis=1 store the following data: + [:, 0] is the frame number + [:, 1] is the DLC-computed eye area in cm^2 + [:, 2] is the pupil area in cm^2 + [:, 3] is the x (azimuth) position of the pupil in degrees + [:, 4] is the y (altitude/elevation) position of the pupil in degrees + DLC refers to DeepLabCut (Mathis et al., 2018, Nature), a tool used to track eyes from videos. + See King et al., 2023, eNeuro, and de Vries et al., 2018, Nature for more info on eye tracking methods. + Contact saskiad@alleninstitute.org and chase.king@alleninstitute.org with any questions. """ cloud_cache = S3CloudCache( cache_dir=Path(self.manifest_path).parent / "s3_cache", From 256826cbe4e73a707c8500ce0b9e5c1fc98e8c4c Mon Sep 17 00:00:00 2001 From: Chase King Date: Sat, 6 Jan 2024 18:43:34 -0800 Subject: [PATCH 2/5] Better DLC notes --- allensdk/core/brain_observatory_cache.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/allensdk/core/brain_observatory_cache.py b/allensdk/core/brain_observatory_cache.py index cda5eb39f8..8c775bb53e 100644 --- a/allensdk/core/brain_observatory_cache.py +++ b/allensdk/core/brain_observatory_cache.py @@ -654,15 +654,18 @@ def get_eye_tracking(self, ophys_experiment_id) -> np.ndarray: Returns ------- `numpy.ndarray` - Shape of array is (n_frames, 5). Values at axis=1 store the following data: + Shape of array is (n_frames, 5). Values at axis=1 store the following: [:, 0] is the frame number - [:, 1] is the DLC-computed eye area in cm^2 + [:, 1] is the computed eye area in cm^2 [:, 2] is the pupil area in cm^2 [:, 3] is the x (azimuth) position of the pupil in degrees - [:, 4] is the y (altitude/elevation) position of the pupil in degrees - DLC refers to DeepLabCut (Mathis et al., 2018, Nature), a tool used to track eyes from videos. - See King et al., 2023, eNeuro, and de Vries et al., 2018, Nature for more info on eye tracking methods. - Contact saskiad@alleninstitute.org and chase.king@alleninstitute.org with any questions. + [:, 4] is the y (altitude) position of the pupil in degrees + Metrics are computed using DeepLabCut (Mathis et al., 2018, Nature) + from videos of the mouse's eye during experimentation. + See King et al., 2023, eNeuro, and de Vries et al., 2018, Nature for + more info on eye tracking methods. + Contact saskiad@alleninstitute.org and chase.king@alleninstitute.org + with any questions. """ cloud_cache = S3CloudCache( cache_dir=Path(self.manifest_path).parent / "s3_cache", From 7cc4d3749125defcdee99a6ee436b40f80dbb87e Mon Sep 17 00:00:00 2001 From: Chase King Date: Sat, 6 Jan 2024 18:45:26 -0800 Subject: [PATCH 3/5] Notes on frame number --- allensdk/core/brain_observatory_cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/allensdk/core/brain_observatory_cache.py b/allensdk/core/brain_observatory_cache.py index 8c775bb53e..a62376e26b 100644 --- a/allensdk/core/brain_observatory_cache.py +++ b/allensdk/core/brain_observatory_cache.py @@ -655,7 +655,8 @@ def get_eye_tracking(self, ophys_experiment_id) -> np.ndarray: ------- `numpy.ndarray` Shape of array is (n_frames, 5). Values at axis=1 store the following: - [:, 0] is the frame number + [:, 0] is the 2-photon frame number. Can be parsed as int and + uses the same indexing as calcium imaging frames. [:, 1] is the computed eye area in cm^2 [:, 2] is the pupil area in cm^2 [:, 3] is the x (azimuth) position of the pupil in degrees From faacaed3a7746f10ab8c72f05ba586ecb385a4c5 Mon Sep 17 00:00:00 2001 From: Chase King Date: Sat, 6 Jan 2024 18:48:07 -0800 Subject: [PATCH 4/5] Fix notes on frame --- allensdk/core/brain_observatory_cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allensdk/core/brain_observatory_cache.py b/allensdk/core/brain_observatory_cache.py index a62376e26b..f74b26293d 100644 --- a/allensdk/core/brain_observatory_cache.py +++ b/allensdk/core/brain_observatory_cache.py @@ -656,7 +656,7 @@ def get_eye_tracking(self, ophys_experiment_id) -> np.ndarray: `numpy.ndarray` Shape of array is (n_frames, 5). Values at axis=1 store the following: [:, 0] is the 2-photon frame number. Can be parsed as int and - uses the same indexing as calcium imaging frames. + used to index calcium imaging dF/F arrays, for example. [:, 1] is the computed eye area in cm^2 [:, 2] is the pupil area in cm^2 [:, 3] is the x (azimuth) position of the pupil in degrees From 359b54b7f228960c02c488fe051e92e75aa606ec Mon Sep 17 00:00:00 2001 From: Chase King Date: Sat, 6 Jan 2024 19:11:48 -0800 Subject: [PATCH 5/5] Fix max line width --- allensdk/core/brain_observatory_cache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/allensdk/core/brain_observatory_cache.py b/allensdk/core/brain_observatory_cache.py index f74b26293d..9c80c0630a 100644 --- a/allensdk/core/brain_observatory_cache.py +++ b/allensdk/core/brain_observatory_cache.py @@ -654,7 +654,7 @@ def get_eye_tracking(self, ophys_experiment_id) -> np.ndarray: Returns ------- `numpy.ndarray` - Shape of array is (n_frames, 5). Values at axis=1 store the following: + Shape of array is (n_frames, 5); axis=1 stores the following: [:, 0] is the 2-photon frame number. Can be parsed as int and used to index calcium imaging dF/F arrays, for example. [:, 1] is the computed eye area in cm^2 @@ -663,9 +663,9 @@ def get_eye_tracking(self, ophys_experiment_id) -> np.ndarray: [:, 4] is the y (altitude) position of the pupil in degrees Metrics are computed using DeepLabCut (Mathis et al., 2018, Nature) from videos of the mouse's eye during experimentation. - See King et al., 2023, eNeuro, and de Vries et al., 2018, Nature for - more info on eye tracking methods. - Contact saskiad@alleninstitute.org and chase.king@alleninstitute.org + See King et al., 2023, eNeuro, and de Vries et al., 2018, Nature + for more info on eye tracking methods. + Contact saskiad@alleninstitute.org, chase.king@alleninstitute.org with any questions. """ cloud_cache = S3CloudCache(