Skip to content

DRAFT: Fix: cache the compute ancillary params at indentation level#28

Draft
PinkShnack wants to merge 4 commits intoAFM-analysis:masterfrom
PinkShnack:27_bugfix_ancill_comp_caching
Draft

DRAFT: Fix: cache the compute ancillary params at indentation level#28
PinkShnack wants to merge 4 commits intoAFM-analysis:masterfrom
PinkShnack:27_bugfix_ancill_comp_caching

Conversation

@PinkShnack
Copy link

@PinkShnack PinkShnack commented Feb 10, 2026

As mentioned in #27, the ancillary param computation is currently very slow for extension models that require a model for the initial fit (e.g. KVM Hertz model).

This PR tries to fix that by caching the ancillary params at the Indentation (curve) level per fit. After the fit is complete, the cache is cleared for the next curve.

Perhaps we need a specific test for this with the KVM model? Thoughts?

Todo

  • make sure TODO note in core.py is removed if relevant
  • add ancillary test that actaully calculates ancillaries
  • fix KVM model for numpy version 2
  • ensure that pyjibe gives expected results with new cache system in nanite. Show plots here.

@codecov
Copy link

codecov bot commented Feb 10, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@PinkShnack PinkShnack marked this pull request as draft February 10, 2026 13:14
@paulmueller
Copy link
Member

test_fit_ancillary.py uses a fake model with ancillaries. You can add a test there for caching (no need to include the KVM model AFAIK.

I would initialize the cache with None and invalidate it before the fit is actually called (to prevent possible race conditions).

@PinkShnack
Copy link
Author

I added a test. I also checked to see how it looked with the KVM model locally. Turns out my nanite was using numpy 2 and therefore the KVM model extension failed due to a numpy np.argwhere error. Where can I fix the KVM model python code? (where is the code kept?).

@paulmueller
Copy link
Member

I added a test. I also checked to see how it looked with the KVM model locally. Turns out my nanite was using numpy 2 and therefore the KVM model extension failed due to a numpy np.argwhere error. Where can I fix the KVM model python code? (where is the code kept?).

I think it is supplementary material to the paper. Not sure whether there is a public repository for it. We could add a curated list of external model as a repository to AFM-analysis?

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.

2 participants