# Problem on accessing OPHYS eye-tracking data

**URL:** <https://community.brain-map.org/t/problem-on-accessing-ophys-eye-tracking-data/2688>\
**Category:** Technical\
**Tags:** brain-observatory-visual-coding, allensdk\
**Created:** [November 1, 2023, 3:58pm UTC](https://community.brain-map.org/t/problem-on-accessing-ophys-eye-tracking-data/2688 "2023-11-01T15:58:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohammad](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@Mohammad](https://community.brain-map.org/u/Mohammad)\
**Post date:** [November 1, 2023, 3:58pm UTC](https://community.brain-map.org/t/problem-on-accessing-ophys-eye-tracking-data/2688/1 "2023-11-01T15:58:49Z")

</div>

Hi everyone.  
First of all I’m sorry for my poor English writing skill. I’ll try to convey my problem as clear as I can.  
I’m currently working on ophys dataset and I’m using AllenSDK to access the data.  
I wrote this piece of code to download only experiments that contains **Eye tracking data**.  
here is my code:

```auto
experiments = boc.get_ophys_experiments(targeted_structures=[area]
                                            ,imaging_depths=depth
                                            ,session_types=['three_session_A']
                                            ,require_eye_tracking=True
                                            ,cell_specimen_ids=cells)
experiment_ids = [experiment[""id""] for experiment in experiments ]

```

Then i use these ids to get ophys experiments data and eye-tracking data using this code:

```auto
nwb = boc.get_ophys_experiment_data(ophys_experiment_id=experiments[0])

x = nwb.get_pupil_location()

```

but I got this error:

```auto
    849 except KeyError:
--> 850 raise NoEyeTrackingException("No eye tracking for this experiment.")
    852 return pupil_times, pupil_location

NoEyeTrackingException: No eye tracking for this experiment.

```

indeed I checked manually the metadata for this experiment (experiment id:652094901) using this code to ensure that eye-tracking data is available for this experiment. by this code:

```auto
>boc.get_ophys_experiments(ids = [652094901])
>[{'id': 652094901,
  'imaging_depth': 175,
  'targeted_structure': 'VISp',
  'cre_line': 'Slc17a7-IRES2-Cre',
  'reporter_line': 'Ai93(TITL-GCaMP6f)',
  'acquisition_age_days': 87,
  'experiment_container_id': 650389885,
  'session_type': 'three_session_A',
  'donor_name': '355468',
  'specimen_name': 'Slc17a7-IRES2-Cre;Camk2a-tTA;Ai93-355468',
  'fail_eye_tracking': False}]

```

as you can clearly see fail\_eye\_tracking key is false meaning that data is available.  
but i did not stop and i found this method (part of [brain\_observatory\_cache](https://github.com/AllenInstitute/AllenSDK/blob/master/allensdk/core/brain_observatory_cache.py#L645) class) that returns an array with the shape of (n\_frame,5) .  
here is that method:  
`x = boc.get_eye_tracking(ophys_experiment_id=652094901)`  
in the doc string of this method i saw this comment:

```auto
        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

```

I’ve tried to email Saskia and to this day ive got no response.  
finally I’ve ploted each column of this array and i found that first column must be time stamps:  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/brainobservatory/original/1X/a226703bc96d1dff612e314d587054e7d3d7314e.png)  
but i have no idea about other columns.  
Now my question is, is it even possible to get eye-tracking data using `nwb.get_pupil_location()` method or not? if not, what is the meaning of column that returned by `boc.get_eye_tracking()` method?  
Thanks for your consideration and your time!

---

<div class="post-metadata">

**Author:** ![saskiad](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.brain-map.org/saskiad/32/1695_2.png) [@saskiad](https://community.brain-map.org/u/saskiad)\
**Post date:** [November 1, 2023, 5:37pm UTC](https://community.brain-map.org/t/problem-on-accessing-ophys-eye-tracking-data/2688/2 "2023-11-01T17:37:01Z")

</div>

Hi Mohammad,

I apologize that your email must have been buried while I was traveling.

The columns are:  
frame number, eye\_area, pupil\_area, x\_position, y\_position.  
The positions are both in degrees.

I think the get\_pupil\_location method doesn’t work for this data - I’m unclear why both functions exist and will ask the Technology team about that

Good luck!
