You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unit Conversion Helper function for eye-tracking data (pixels to radians) #12112
I am at a point in one of my projects where I'd like to convert my eye-tracking position data from pixels-on-screen to a unit of angle. Since 1) this is a fairly common conversion in eye-tracking research; 2) it was highlighted as a TODO in #11879 ; and 3) this would help users convert their position data into an SI unit (radians), I think It would be good to build a helper function for this.
mne.preprocessing.eyetracking.convert_units(calibration: Calibration, from: str = 'px', to: str = 'radian')
Where Calibration is an instance of mne.preprocessing.eyetracking.Calibration that contains necessary metadata: screen_size, distance, screen_resolution.
We could also include screen_size, screen_resolution, distance as parameters of the function, so the user can either pass a Calibration instance with this info, or specify them directly via the function call (this was an idea brought up in the summer and documented in this comment)
Additional context
This was a feature that I proposed during my GSoC but didn't get to by the end of summer.
Yeah I agree that distance and such should probably be parameters.
One thing to think about then: if a parameter is specified in Calibration but also gets passed and numbers don't match, what should be expected behavior? Overwrite by parameters and throw warning? Throw error?
EDIT: second thought: alternative of course could be to only allow setting of those measurements in Calibration. In that respect it would be cleaner.
with optional screen_size, screen_resolution and distance sounds good to me.
Thanks!
One thing to think about then: if a parameter is specified in Calibration but also gets passed and numbers don't match, what should be expected behavior? Overwrite by parameters and throw warning?
Yeah, I think allowing explicit parameters to over-ride Calibration makes sense, and so does throwing a warning.
EDIT: second thought: alternative of course could be to only allow setting of those measurements in Calibration. In that respect it would be cleaner.
I'm also okay with this. I offered the option to add optional keyword args for screen_distance/screen_size etc. because IIRC someone suggested this in the summer. But we could also add these later if people ask for it?
+1 for adding screen_distance/size later if needed and starting out with just Calibration. As it says in @britta-wstnr's note eventually we could allow setting those in the Calibration itself which would be cleaner. So let's start from the most common case where the user has a Calibration they want to use to convert units and add things later as we hit use cases.
Activity
mscheltienne commentedon Oct 19, 2023
with optional
screen_size,screen_resolutionanddistancesounds good to me.britta-wstnr commentedon Oct 19, 2023
Yeah I agree that
distanceand such should probably be parameters.One thing to think about then: if a parameter is specified in
Calibrationbut also gets passed and numbers don't match, what should be expected behavior? Overwrite by parameters and throw warning? Throw error?EDIT: second thought: alternative of course could be to only allow setting of those measurements in
Calibration. In that respect it would be cleaner.scott-huberty commentedon Oct 19, 2023
Thanks!
Yeah, I think allowing explicit parameters to over-ride Calibration makes sense, and so does throwing a warning.
I'm also okay with this. I offered the option to add optional keyword args for
screen_distance/screen_sizeetc. because IIRC someone suggested this in the summer. But we could also add these later if people ask for it?larsoner commentedon Oct 19, 2023
+1 for adding
screen_distance/sizelater if needed and starting out with just Calibration. As it says in @britta-wstnr's note eventually we could allow setting those in theCalibrationitself which would be cleaner. So let's start from the most common case where the user has a Calibration they want to use to convert units and add things later as we hit use cases.