Skip to content

Using np.nextafter instead of eps#189

Merged
JoOkuma merged 22 commits intoroyerlab:mainfrom
yfukai:apply-tiled_nextafter
Nov 5, 2025
Merged

Using np.nextafter instead of eps#189
JoOkuma merged 22 commits intoroyerlab:mainfrom
yfukai:apply-tiled_nextafter

Conversation

@yfukai
Copy link
Copy Markdown
Contributor

@yfukai yfukai commented Nov 4, 2025

This pull request updates the tile slicing logic in the _yield_apply_tiled function within src/tracksdata/functional/_apply.py to improve numerical precision and ensure correct handling of inclusive and exclusive ranges. The most important changes are:

Tile slicing precision improvements:

  • Replaced the use of a fixed epsilon (eps) for adjusting slice end points with np.nextafter, which more accurately converts inclusive to exclusive ranges based on floating-point precision. This change affects both the calculation of slicing_without_overlap and the main slicing logic.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.22%. Comparing base (cb4770a) to head (40da2ae).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #189      +/-   ##
==========================================
- Coverage   88.22%   88.22%   -0.01%     
==========================================
  Files          51       51              
  Lines        3593     3592       -1     
  Branches      617      617              
==========================================
- Hits         3170     3169       -1     
  Misses        254      254              
  Partials      169      169              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yfukai
Copy link
Copy Markdown
Contributor Author

yfukai commented Nov 4, 2025

Now it's ready to review @JoOkuma! The edge case fails with the previous impl but succeeds with np.nextafter.

@yfukai yfukai marked this pull request as ready for review November 4, 2025 23:15
Copy link
Copy Markdown
Member

@JoOkuma JoOkuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, @yfukai

I didn't think of using -np.inf. Thank you for the fix and for implementing the edge case.

@JoOkuma JoOkuma merged commit 5d51270 into royerlab:main Nov 5, 2025
6 of 8 checks passed
@yfukai yfukai deleted the apply-tiled_nextafter branch November 5, 2025 21:35
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.

3 participants