First Parameter Fit
Model parameters should describe the leaves you study. This example estimates four photosynthesis parameters from gas-exchange measurements using Evaluation.fit, then puts the fitted values into a model.
We use a WALZ GFS-3000 file included with PlantBiophysics, so no download is needed. The file contains several response curves; we keep the same selection as the fitting example provided with the package.
using PlantBiophysics, PlantSimEngine, DataFrames
file = joinpath(pkgdir(PlantBiophysics), "test", "inputs", "data", "P1F20129.csv")
observations = read_walz(file; ntasks=1)
filter!(row -> row.curve ∉ ("Rh Curve", "ligth Curve"), observations)
first(select(observations, :Tₗ, :aPPFD, :Cᵢ, :A), 5)| Row | Tₗ | aPPFD | Cᵢ | A |
|---|---|---|---|---|
| Float64 | Float64 | Float64? | Float64? | |
| 1 | 26.44 | 1274.91 | 192.911 | 6.77484 |
| 2 | 26.44 | 1274.91 | 193.668 | 6.88872 |
| 3 | 26.38 | 1275.0 | 155.41 | 5.57472 |
| 4 | 26.37 | 1275.6 | 156.248 | 5.60771 |
| 5 | 26.41 | 1274.75 | 113.152 | 3.42669 |
The spelling "ligth Curve" is the label in this file. Each retained row provides leaf temperature (Tₗ, °C), absorbed photon flux (aPPFD, µmol photons m⁻² s⁻¹), intercellular CO₂ concentration (Cᵢ, µmol mol⁻¹), and measured net assimilation (A, µmol CO₂ m⁻² s⁻¹).
Now fit the Farquhar–von Caemmerer–Berry model, with parameter values expressed at a reference temperature of 25 °C:
fitted = Evaluation.fit(Fvcb, observations; Tᵣ=25.0)(VcMaxRef = 46.24677841174592, JMaxRef = 80.36773471055639, RdRef = 0.499495043750854, TPURef = 5.596944472641999, Tᵣ = 25.0)The result contains VcMaxRef (Rubisco capacity), JMaxRef (electron-transport capacity), RdRef (respiration in the light), TPURef (triose-phosphate utilization), and the chosen reference temperature Tᵣ.
The returned names match the model's keyword arguments. The ... below passes each fitted value to its corresponding argument:
photosynthesis = FvcbRaw(; fitted...)
(VcMaxRef=photosynthesis.VcMaxRef, Tᵣ=photosynthesis.Tᵣ)(VcMaxRef = 46.24677841174592, Tᵣ = 25.0)FvcbRaw predicts assimilation from measured Cᵢ, which is also how this fit is evaluated. Continue with the parameter-fitting tutorial to run the fitted model against the measurements, plot the response curve, and compare it with the coupled photosynthesis–conductance model.