Skip to content

Comments

Fix Mean Saccade Velocity Calculation Denominator#68

Merged
oscararenas12 merged 2 commits intomainfrom
fix-saccade-velocity-denominator
Nov 4, 2025
Merged

Fix Mean Saccade Velocity Calculation Denominator#68
oscararenas12 merged 2 commits intomainfrom
fix-saccade-velocity-denominator

Conversation

@oscararenas12
Copy link
Contributor

@oscararenas12 oscararenas12 commented Nov 4, 2025

Summary

Fixes mean saccade velocity calculation bug in SaccadeVelocity.java.

Problem

The denominator incorrectly used saccadePoints.size() - discardedDataCount, which divides by the number of points instead of the number of velocity measurements.

Solution

Changed line 226 to saccadePoints.size() - 1 - discardedDataCount because n points produce n-1 velocity
measurements between consecutive points.

Example

With 5 points and 1 discarded measurement:

  • Old (incorrect): 5 - 1 = 4
  • New (correct): 5 - 1 - 1 = 3

Changes

  • Updated getMeanVelocity() denominator calculation
  • Added JavaDoc explaining n points produce n-1 velocities
  • Updated test_DGMs.csv to correct velocity values

Needed

We must update User Manuel, section 4.2.3.1 "Saccade Velocity" (page 17) says:

  • "Mean saccade velocity is the average speed during a saccade, calculated by summing up all velocities during a saccade and dividing by the total amount of points."

This is incorrect and needs to be updated. Based on the bug fix we just made, it should say:

  • Suggested correction: "Mean saccade velocity is the average speed during a saccade, calculated by summing up all velocities during a saccade and dividing by the total number of velocity measurements (which is one less than the total amount of points, since n points produce n-1 velocities between consecutive points), excluding any measurements that exceed the velocity threshold."
    Or more concisely:
  • "Mean saccade velocity is the average speed during a saccade, calculated by summing up all valid velocities during a saccade and dividing by the number of valid velocity measurements computed between consecutive points."

@oscararenas12 oscararenas12 merged commit 1186bd1 into main Nov 4, 2025
1 check passed
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.

1 participant