Photosynthesis#17
Merged
Merged
Conversation
Introduces test_C3_properties.jl and test_C4_properties.jl, which test mathematical invariants of the FvCB model implementations rather than fixed numeric outputs. Each file covers eight (C3) or seven (C4) properties: monotonic response of assimilation to Ca, PAR, and temperature (peaked, with interior maximum in 10-40 C range); monotonic increase of stomatal conductance with RH; dark respiration (An < 0 at PAR = 0); CO2 compensation point (sign change at physiologically appropriate Ca); minimum stomatal conductance (gs >= gso across a grid of PAR x Ca conditions); and O2 inhibition of assimilation via photorespiration (C3 only). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17 +/- ##
==========================================
- Coverage 97.24% 93.79% -3.45%
==========================================
Files 10 10
Lines 290 290
==========================================
- Hits 282 272 -10
- Misses 8 18 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two main changes:
Switch to solving for Ci and then calculating gs in the analytical models of C3 and C4 photosynthesis. This prevents the error in the calculation of gs (thanks to Jorad de Vries for figuring out the bug and a possible fix).
To further detect this kind of errors, I added tests that check that certain qualitative properties of response curves are met. Specifically:
A increases monotonically with Ca (above compensation point)
A increases monotonically with PAR
gs increases monotonically with RH
Temperature response of A is peaked (interior maximum in 10–40 °C)
Net A < 0 in darkness (PAR = 0)
CO2 compensation point exists at physiologically appropriate Ca
gs ≥ gso over a PAR × Ca grid
A decreases monotonically as O2 increases (photorespiration)
Claude Code was used as assistant to help generate the tests.