Repository navigation
Description
Description of the problem
MNE version: 1.9.0
Operating system: Windows 11
When I was using the following code to read eye-movement data from .asc file. I found that the values of pupil size (i.e., pupil_right/pupil_left) were extremely large. They were typically 1000-5000 in v1.7.0, while they were 10^6 times larger in v1.9.0 (the raw data are the same). The issue still existed when I removed mne.preprocessing.eyetracking.convert_units.
cals = read_eyelink_calibration(self.edata_path)
first_cal = cals[0]
first_cal["screen_resolution"] = (2560, 1440)
first_cal["screen_size"] = (0.6, 0.35)
first_cal["screen_distance"] = 0.62
raw_edata = read_raw_eyelink(self.edata_path, create_annotations=["blinks", "saccades", "fixations", "messages"])
mne.preprocessing.eyetracking.convert_units(raw_edata, calibration=first_cal, to="radians")
raw_pick = raw_edata.pick(picks="eyetrack")
data = raw_pick.to_data_frame()
In v1.7.0, it is arbitrary units (AU), which makes sense. What is the pupil size unit in v1.9.0? I noticed that the unit is micrometers in the figure given in the document. However, the pupil size (pupil_right) is about 2x10^9 micrometers (i.e., 2km), which is impossible. Did I miss a parameter in any function? Or it is actually a bug.
Plus, I notice that it says
MNE-Python expects eyegaze positions to be in radians of visual angle, and pupil size to be in meters.
in the document. It could be better if the pupil size is millimeters or micrometers (AU is OK as well). Meters may be too large to describe pupil size.
Steps to reproduce
cals = read_eyelink_calibration(self.edata_path)
first_cal = cals[0]
first_cal["screen_resolution"] = (2560, 1440)
first_cal["screen_size"] = (0.6, 0.35)
first_cal["screen_distance"] = 0.62
raw_edata = read_raw_eyelink(self.edata_path, create_annotations=["blinks", "saccades", "fixations", "messages"])
mne.preprocessing.eyetracking.convert_units(raw_edata, calibration=first_cal, to="radians")
raw_pick = raw_edata.pick(picks="eyetrack")
data = raw_pick.to_data_frame()Link to data
I'm sorry that I can't upload an .asc file, but I believe that you could evaluate with any .asc file.
Expected results
The values of pupil_right/pupil_left in data are typically 1000-5000. It is true in v1.7.0.
Actual results
The values in v1.9.0 are exactly 10^6 times larger than in v1.7.0.
Additional information
v1.7.0:
Platform Windows-11-10.0.22631-SP0
Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]
Executable C:\Program Files\Python312\python.exe
CPU Intel64 Family 6 Model 167 Stepping 1, GenuineIntel (16 cores)
Memory Unavailable (requires "psutil" package)
Core
├☒ mne 1.7.0 (outdated, release 1.9.0 is available!)
├☑ numpy 2.2.5 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
├☑ scipy 1.15.3
└☑ matplotlib 3.10.3 (backend=module://backend_interagg)
Numerical (optional)
├☑ pandas 2.2.3
└☐ unavailable sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py
Visualization (optional)
└☐ unavailable pyvista, pyvistaqt, vtk, qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
v1.9.0:
Platform Windows-11-10.0.22631-SP0
Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)]
Executable C:\Program Files\Python312\python.exe
CPU 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz (16 cores)
Memory 63.7 GiB
Core
- mne 1.9.0 (latest release)
- numpy 2.2.5 (unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl'))
- scipy 1.15.3
- matplotlib 3.10.3 (backend=module://backend_interagg)
Numerical (optional) - pandas 2.2.3
- unavailable sklearn, numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py
Visualization (optional) - unavailable pyvista, pyvistaqt, vtk, qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify
Ecosystem (optional) - unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
Activity
welcome commentedon May 12, 2025
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴
larsoner commentedon May 12, 2025
@scott-huberty ?
scott-huberty commentedon Jun 23, 2025
Sorry for the radio silence. The change you describe might have something to do with PR's that stemmed from this discussion.
But more directly, It seems like to_data_frame() is handling pupil channels incorrectly?
It seems like
to_data_frameis treating pupil channels as if they were EEG channels and is trying to convert from V -> µV? Honestly I would expect it to not do any conversion at all, or convert from meters -to mm (1e3)A temporary hacky work around is to do:
larsoner commentedon Jul 3, 2025
@drammock will you have time to look at this next week?
drammock commentedon Jul 4, 2025
internally, default (plotting/axis-label) unit for
pupilis µmmne-python/mne/defaults.py
Line 96 in 6ad8823
and accordingly the default scaling is 1e6:
mne-python/mne/defaults.py
Line 125 in 6ad8823
therefore
_handle_default("scalings", None)(which is whatto_data_frame()method uses internally when no scalings are passed) returns a dict with entry"pupil": 1000000.0.The default scaling for
pupilchannels was changed from 1 to 1e6 in #12846 by @scott-huberty. I don't really know off-the-cuff what the right move is here; AFAICT theto_data_framemethod is working as expected.scott-huberty commentedon Jul 7, 2025
Thanks @drammock I will look into it this Wednesday 7/9 and aim to have a PR (if necessary) same day.
larsoner commentedon Jul 10, 2025
@scott-huberty I'm going to start the release process, but we can always backport a fix if needed