Skip to content

Pin dose_response hitcall against tcplfit2 - #189

Merged
timtreis merged 4 commits into
mainfrom
feat/tcplfit2-equivalence
Oct 5, 2026
Merged

timtreis merged 4 commits into
mainfrom
feat/tcplfit2-equivalence

Conversation

@timtreis

@timtreis timtreis commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

tl.dose_response's continuous hitcall ports tcplfit2's hitcontinner/toplikelihood, but tests/test_tl_dose.py pins only orderings and ranges, so a wrong constant in the error model, Akaike weight or profile term would pass.

Adds tests/test_equivalence_tcplfit2.py: one parametrized test asserting hitcall against the values tcplfit2 0.1.9 reports for fixed, baseline-corrected inputs — a decisive curve (1.0), a scattered curve whose top sits near the cutoff so the call lands mid-range (0.711), and a flat response (0.0). Reference values are stored inline, so no runtime or test dependency on R or tcplfit2 is added.

P1 (the Akaike weight against the constant model) is taken over mantispy's two models rather than tcplfit2's ten, so the scenarios are chosen where P1 saturates and the assertion rests on the ported P2/P3 arithmetic. atol=0.02 absorbs the four-parameter logistic fitting a slightly different top than tcplfit2's three-parameter Hill (mid-range case matches to 2.6e-3) while staying inside the shift a wrong constant causes (a chi-square-factor error moves it 0.066).

Verified: hatch test tests/test_tl_dose.py tests/test_equivalence_tcplfit2.py — 16 passed.

Closes #90.


Also folds in four dose-response doc fixes a persona review surfaced (no behaviour change): the tutorial now states that P1 is weighed over mantispy's two models, not tcplfit2's ten, so it is not tcplfit2's number, and that hitcall is NaN without marked controls or a cutoff; it flags that the U2OS cross-line calls rest on one or two wells per group before reading the off-diagonal as biology; and the dose_response docstring states that hitcall assumes a non-negative distance-like response.

timtreis and others added 4 commits October 5, 2026 22:21
tl.dose_response's continuous hitcall ports tcplfit2's hitcontinner and
toplikelihood, but the existing tests pin only orderings and ranges, which
would not catch a wrong constant. Add one module that asserts the call against
the values tcplfit2 0.1.9 reports for fixed inputs: a decisive curve, a
scattered curve whose top sits near the cutoff so the call lands mid-range, and
a flat response. Reference values are stored inline, so no dependency on R or
tcplfit2 is added. Closes #90.
Address a cluster review: the earlier pin rested on one non-clamped point
(clear=1.0 and miss=0.0 sit at the clip bounds). Add a second independent
strong curve (strong_high=0.80) so two mid-range calls, from different curves,
exercise the ported P2/P3 arithmetic. Record the tcplfit2 concRespCore recipe
in the docstring so the values can be re-derived, note that a call below ~0.6
is not asserted because the four- and three-parameter fits part there, drop the
redundant min_doses (4 is the default), and plain up two anthropomorphic lines.
- Tutorial: say in the hitcall paragraph that P1 is weighed over mantispy's
  two models, not tcplfit2's ten, so it is not tcplfit2's number, and that
  hitcall is NaN without marked controls or an explicit cutoff.
- Tutorial: note the U2OS calls rest on one or two wells per group before
  reading the off-diagonal call as biology.
- Docstring: state that hitcall assumes a non-negative distance-like response
  and the signed path is not exercised by the default.
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 mantispy | 🛠️ Build #34954601 | 📁 Comparing fc5c1a3 against latest (9241f54)

  🔍 Preview build  

3 files changed
± api/generated/mantispy.tl.dose_response.html
± tutorials/compounds/dose_response.html
± _modules/mantispy/tl/_dose.html

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.33%. Comparing base (248f320) to head (fc5c1a3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #189   +/-   ##
=======================================
  Coverage   87.33%   87.33%           
=======================================
  Files          88       88           
  Lines        8331     8331           
=======================================
  Hits         7276     7276           
  Misses       1055     1055           
Files with missing lines Coverage Δ
src/mantispy/tl/_dose.py 96.27% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis
timtreis merged commit c5b43e6 into main Oct 5, 2026
13 of 15 checks passed
@timtreis
timtreis deleted the feat/tcplfit2-equivalence branch October 5, 2026 21:49
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.

hitcall is not checked numerically against tcplfit2

2 participants