Skip to content

Conversation

@putnokiabel
Copy link

@putnokiabel putnokiabel commented Jan 26, 2026

Closes #695.

Feature

Based on https://www.nature.com/articles/s41598-017-14166-6?WT.feed_name=subjects_optical-manipulation-and-tweezers#Sec9 .
Use SPIFF to remove pixel-locking bias and improve sub-pixel accuracy of located features.
In the test cases shown (see test_spiff.py), you can see an order of magnitude better accuracy when the SPIFF correction is applied.

Sample results

Verify by adding the following line in test_spiff.py and running the tests:
image

2D
error before: 0.1300
error after SPIFF: 0.01998

3D
error before SPIFF: 0.2486
error after SPIFF: 0.0227

Note on documentation and further integration

I did not invest time into updating the documentation and further integrating it into the basic features yet, as I wanted to see what the maintainers think of the feature first.

Since it seems like SPIFF improves accuracy pretty much universally, I'd suggest the following (but feel free to ignore or suggest something else):

  • Include an apply_spiff argument in tp.locate() and tp.batch() (could be enabled or disabled by default) and have those functions apply the SPIFF correction so the user doesn't have to know or think about it necessarily.
  • Add documentation on using the new apply_spiff argument as well as the underlying apply_spiff_correction function.
  • Update documentation (and walkthrough example) on subpixel bias to mention that using SPIFF is preferred to increasing the location radius (see the paper mentioned in the apply_spiff_correction method for more details on this).

@putnokiabel putnokiabel marked this pull request as ready for review January 26, 2026 22:13
@putnokiabel
Copy link
Author

@nkeim
Hi, I'm new here!
Is there a process for contributing to trackpy (other than just submitting a PR and waiting)?

@nkeim
Copy link
Contributor

nkeim commented Feb 5, 2026 via email

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.

Feature request: Implementing SPIFF to improve subpixel accuracy

2 participants