chore: Replace metadata dict data_loss_ratio with measure-based equivalents - #140
Open
cbueth wants to merge 2 commits into
Open
chore: Replace metadata dict data_loss_ratio with measure-based equivalents#140cbueth wants to merge 2 commits into
data_loss_ratio with measure-based equivalents#140cbueth wants to merge 2 commits into
Conversation
- use pymovements 0.27.1 for this to work, before these metadata fields are removed in later versions. Signed-off-by: Carlson Büth <commit@cbueth.de>
- Directly compute trial-based data loss using `pymovements` without temporary metadata - clear parsed events for stability Signed-off-by: Carlson Büth <commit@cbueth.de>
cbueth
force-pushed
the
chore/metadata-data-loss-migration
branch
from
July 15, 2026 13:00
ac9d523 to
73c9a8b
Compare
This was referenced Jul 15, 2026
theDebbister
requested changes
Jul 29, 2026
Member
There was a problem hiding this comment.
Ok, so in consultation with the other MultiplEYE team mebers we decided that it is best to report the session level measures (in general) not as simple averages over the trials, but taking the length into account (i.e. just calculate the data loss at the session level directly).
As the other values can simply be calcualted based on values we already have at the trial level, we can later still add these, but for now, we just use this one value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces
pre_processed_metadata['data_loss_ratio']and['data_loss_ratio_blinks'](EyeLink-only, computed during ASC parsing) with format-independent equivalents:pymovements.measure.data_loss('pixel', sampling_rate=sr, unit='ratio'). Per-trial viagroup_by, simple mean across trialsgaze.measure_events_ratio('blink_eyelink', sampling_rate=sr). Per-trial viagroup_by, simple mean across trialsThe old metadata values remain in the overview alongside the new ones for comparison during transition.
Instead of just changing this, I first had both be calculated in parallel (1351619), to see if the results are the same, or differ:
Comparison data
Here compare the results of the metadata numbers of before and the measure numbers of after.
The ~1-2% difference comes from two sources:
.mean()(trials equally weighted), the old metadata usesΣ(expected − valid) / Σ(expected)(weighted by trial duration per recording block).['trial', 'stimulus', 'page']while metadata uses EyeLink START/STOP recording messages. Boundaries differ.See my comment Remove
data_loss_ratioanddata_loss_ratio_blinksfrom parsed metadata pymovements/pymovements#1584 (comment) for more details on this.Open question
Should we use a weighted aggregate instead of simple mean? The current
.mean()treats each trial equally. To replicate the old metadata-style weighted aggregate, we would need to weight by trial duration. Replacingwith
Please add opinions on this when reviewing! Is the information saved where expcted?
References
data_loss_ratioanddata_loss_ratio_blinksfrom parsed metadata pymovements/pymovements#1584null_ratiofunctionality and deprecateparsing._calculate_data_losspymovements/pymovements#1082data_losswith count, time, and ratio units pymovements/pymovements#1420