Importing Eye tracking data with MNE-Python
import mne
import matplotlib.pyplot as plt
from almirah import Layout
mne.set_log_level(False)
lay = Layout(root="/path/to/data", specification_name="bids")
lay
<Layout root: '/path/to/data'>
files = lay.query(datatype="eyetrack", extension=".asc")
len(files)
3632
file = lay.query(subject="D0019", datatype="eyetrack", task="FIX", extension=".asc")[0]
print(file.rel_path)
sub-D0019/ses-111/eyetrack/sub-D0019_ses-111_task-FIX_run-01_eyetrack.asc
raw = mne.io.read_raw_eyelink(file.path, create_annotations=["blinks"])
custom_scalings = dict(eyegaze=1e3)
raw.pick(picks="eyetrack").plot(scalings=custom_scalings)
plt.close()
raw
<summary><strong>General</strong></summary>
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Measurement date</th>
<td>January 01, 2009 00:03:33 GMT</td>
</tr>
<tr>
<th>Experimenter</th>
<td>Unknown</td>
</tr>
<tr>
<th>Participant</th>
<td>Unknown</td>
</tr>
</table>
</details>
<details open>
<summary><strong>Channels</strong></summary>
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Digitized points</th>
<td>Not available</td>
</tr>
<tr>
<th>Good channels</th>
<td>2 Eye-tracking (Gaze position), 1 Eye-tracking (Pupil size)</td>
</tr>
<tr>
<th>Bad channels</th>
<td>None</td>
</tr>
<tr>
<th>EOG channels</th>
<td>Not available</td>
</tr>
<tr>
<th>ECG channels</th>
<td>Not available</td>
</tr>
</table>
</details>
<details open>
<summary><strong>Data</strong></summary>
<table class="table table-hover table-striped table-sm table-responsive small">
<tr>
<th>Sampling frequency</th>
<td>1000.00 Hz</td>
</tr>
<tr>
<th>Highpass</th>
<td>0.00 Hz</td>
</tr>
<tr>
<th>Lowpass</th>
<td>500.00 Hz</td>
</tr>
<tr>
<th>Filenames</th>
<td>sub-D0019_ses-111_task-FIX_run-01_eyetrack.asc</td>
</tr>
<tr>
<th>Duration</th>
<td>00:01:11 (HH:MM:SS)</td>
</tr>
</table>
</details>
raw.ch_names
['xpos_left', 'ypos_left', 'pupil_left']
raw["xpos_left"]
(array([[510.2, 510.1, 509.9, ..., 454.4, 454.8, 455.5]]),
array([0.0000e+00, 1.0000e-03, 2.0000e-03, ..., 7.0556e+01, 7.0557e+01,
7.0558e+01]))