Skip to content

Conversation

@scott-huberty
Copy link
Contributor

closes #13244

There have been several iterations on the issue of eyetracking units, so let me summarize for brevity:

Stemming from Issue #12756 (comment) (and PR #12846 (comment) + #12850), we changed MNE internals to assume all incoming Eyetracking data were already represented in Meters (SI unit of distance, as some eyetrackers report pupil size in mm). In those PR's I adjusted the scaling for Pupil channels so that data in meters would look nice when plotting by default. I chose a scaling factor of 1e6 (meters -> micro meters).

This caused inst.to_data_frame() to convert from meters -> micrometers which is probably not very intuitive for researchers (hence #13244).

It is probably more intuitive to adjust the scalings to go from meters to mm. The plotting still looks good, and pupil channels will be converted to mm by default by to_data_frame():

import mne
import numpy as np


sfreq = 100
ch_names = ["my_pupil"]
ch_types = "pupil"
info = mne.create_info(ch_names, sfreq, ch_types)
data = np.full((1, 900), np.repeat(np.linspace(0, .008, 9), sfreq))  # data between 0-8mm
raw = mne.io.RawArray(data, info, verbose=False)
raw.plot(remove_dc=False)

df = raw.to_data_frame()
df.head()
Screenshot 2025-07-10 at 6 13 58 PM
Out[4]: 
     time  my_pupil
0    0.00       0.0
1    0.01       0.0
2    0.02       0.0
3    0.03       0.0
4    0.04       0.0
..    ...       ...
895  8.95       8.0
896  8.96       8.0
897  8.97       8.0
898  8.98       8.0
899  8.99       8.0

[900 rows x 2 columns]

Does this sound reasonable to you @larsoner and @drammock ?

@larsoner larsoner merged commit 35398fd into mne-tools:main Jul 11, 2025
32 checks passed
@larsoner
Copy link
Member

Thanks @scott-huberty !

@scott-huberty scott-huberty deleted the pupil_unit branch July 11, 2025 20:02
larsoner added a commit to larsoner/mne-python that referenced this pull request Jul 23, 2025
* upstream: (115 commits)
  Capitalize Get Help (mne-tools#13340)
  Website page load fixes (mostly) (mne-tools#13343)
  MAINT: Restore statsmodels to pip-pre (mne-tools#13345)
  BUG: Fix bug with reading old reports (mne-tools#13341)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13338)
  MAINT: Fix ref cycle with vtkPolyData (mne-tools#13336)
  MAINT: Dont set private attributes for PyVista Actor (mne-tools#13334)
  Add icon links to our donation pages (mne-tools#13331)
  MAINT: Dont set attribute on PolyData (mne-tools#13330)
  MAINT: Bump mins, deprecations (mne-tools#13322)
  Fix changes in SSD for backward compatibility [circle deploy] (mne-tools#13327)
  ENH: Add GED transformer (mne-tools#13259)
  FIX: Links
  MAINT: Stabilize MxNE tests (mne-tools#13321)
  FIX: DigMontage.rename_channels should return self (mne-tools#13320)
  MAINT: Prep for release (mne-tools#13319)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13317)
  MAINT: Update code credit (mne-tools#13318)
  MAINT: Make MxNE test more robust (mne-tools#13315)
  Adjust Pupil channel units (again) (mne-tools#13314)
  ...
WouterKroot pushed a commit to WouterKroot/mne-python that referenced this pull request Aug 13, 2025
zEdS15B3GCwq pushed a commit to zEdS15B3GCwq/mne-python that referenced this pull request Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pupil size unit

2 participants