![]() |
0.1.23
|
High-level interface for Helios photosynthesis modeling. More...
High-level interface for Helios photosynthesis modeling.
The PhotosynthesisModel provides methods for configuring and running photosynthesis simulations using various models including empirical and mechanistic (Farquhar-von Caemmerer-Berry) approaches.
Available species can be queried using: >>> PhotosynthesisModel.get_available_species() ['ALMOND', 'APPLE', 'AVOCADO', ...]
Definition at line 76 of file PhotosynthesisModel.py.
Public Member Functions | |
| __init__ (self, Context context) | |
| Initialize PhotosynthesisModel. | |
| __enter__ (self) | |
| Context manager entry. | |
| __exit__ (self, exc_type, exc_value, traceback) | |
| Context manager exit with cleanup. | |
| cleanup (self) | |
| Clean up native resources. | |
| get_native_ptr (self) | |
| Get the native C++ pointer for advanced operations. | |
| __del__ (self) | |
| Destructor to ensure cleanup. | |
| setModelTypeEmpirical (self) | |
| Set the photosynthesis model type to empirical. | |
| setModelTypeFarquhar (self) | |
| Set the photosynthesis model type to Farquhar-von Caemmerer-Berry. | |
| setModelTypeC4 (self) | |
| Set the photosynthesis model type to the von Caemmerer (2021) steady-state C4 model. | |
| setFarquharMesophyllConductance (self, float gm_at_25c, float dha=-1.0, float topt=-1.0, float dhd=-1.0, Optional[List[int]] uuids=None) | |
Set Farquhar mesophyll conductance gm (mol CO2 / m² / s / bar) for selected primitives. | |
| setC4CoefficientsFromLibrary (self, str species, Optional[List[int]] uuids=None, Optional[str] material_label=None) | |
| Set C4 model coefficients from the von Caemmerer (2021) species library. | |
| List[float] | getC4CoefficientsFromLibrary (self, str species) |
Return the 43-float C4 coefficient array for species. | |
| setC4ModelCoefficients (self, List[float] coefficients, Optional[List[int]] uuids=None, Optional[str] material_label=None) | |
| Apply a 43-float C4 coefficient array. | |
| List[float] | getC4ModelCoefficients (self, int uuid) |
| Return the 43-float C4 coefficient array for a single primitive. | |
| setCm (self, float cm, List[int] uuids) | |
| Manually prescribe the mesophyll cytosolic CO2 partial pressure (Cm) for the C4 model. | |
| run (self) | |
| Run photosynthesis calculations for all primitives in the context. | |
| runForPrimitives (self, Union[List[int], int] uuids) | |
| Run photosynthesis calculations for specific primitives. | |
| setSpeciesCoefficients (self, str species, Optional[List[int]] uuids=None) | |
| Set Farquhar model coefficients from built-in species library. | |
| setFarquharCoefficientsFromLibrary (self, str species, Optional[List[int]] uuids=None) | |
| Set Farquhar model coefficients from built-in species library. | |
| List[float] | getSpeciesCoefficients (self, str species) |
| Get Farquhar model coefficients for a species from the library. | |
| setEmpiricalModelCoefficients (self, EmpiricalModelCoefficients coefficients, Optional[List[int]] uuids=None) | |
| Set empirical model coefficients. | |
| setFarquharModelCoefficients (self, FarquharModelCoefficients coefficients, Optional[List[int]] uuids=None) | |
| Set Farquhar model coefficients. | |
| setVcmax (self, float vcmax, List[int] uuids, Optional[float] dha=None, Optional[float] topt=None, Optional[float] dhd=None) | |
| Set maximum carboxylation rate for Farquhar model. | |
| setJmax (self, float jmax, List[int] uuids, Optional[float] dha=None, Optional[float] topt=None, Optional[float] dhd=None) | |
| Set maximum electron transport rate for Farquhar model. | |
| setDarkRespiration (self, float respiration, List[int] uuids, Optional[float] dha=None, Optional[float] topt=None, Optional[float] dhd=None) | |
| Set dark respiration rate. | |
| setQuantumEfficiency (self, float efficiency, List[int] uuids, Optional[float] dha=None, Optional[float] topt=None, Optional[float] dhd=None) | |
| Set quantum efficiency of photosystem II. | |
| setLightResponseCurvature (self, float curvature, List[int] uuids, Optional[float] dha=None, Optional[float] topt=None, Optional[float] dhd=None) | |
| Set light response curvature parameter. | |
| List[float] | getEmpiricalModelCoefficients (self, int uuid) |
| Get empirical model coefficients for a specific primitive. | |
| List[float] | getFarquharModelCoefficients (self, int uuid) |
| Get Farquhar model coefficients for a specific primitive. | |
| exportResults (self, str label) | |
| Export photosynthesis results with optional label. | |
| enableMessages (self) | |
| Enable photosynthesis model status messages. | |
| disableMessages (self) | |
| Disable photosynthesis model status messages. | |
| printModelReport (self, Optional[List[int]] uuids=None) | |
| Print model configuration report. | |
| bool | validateConfiguration (self) |
| Basic validation that model has been configured. | |
| resetModel (self) | |
| Reset the model by recreating it. | |
Static Public Member Functions | |
| List[str] | get_available_species () |
| Static method to get available species without creating a model instance. | |
| dict | get_species_aliases () |
| Static method to get species aliases mapping. | |
Public Attributes | |
| context = context | |
Protected Attributes | |
| _native_ptr = None | |
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.__init__ | ( | self, | |
| Context | context ) |
Initialize PhotosynthesisModel.
| context | PyHelios Context instance containing the 3D geometry |
| PhotosynthesisModelError | If plugin is not available or initialization fails |
Definition at line 87 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.__del__ | ( | self | ) |
Destructor to ensure cleanup.
Definition at line 146 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.__enter__ | ( | self | ) |
Context manager entry.
Definition at line 124 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.__exit__ | ( | self, | |
| exc_type, | |||
| exc_value, | |||
| traceback ) |
Context manager exit with cleanup.
Definition at line 128 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.cleanup | ( | self | ) |
Clean up native resources.
Definition at line 132 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.disableMessages | ( | self | ) |
Disable photosynthesis model status messages.
Definition at line 680 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.enableMessages | ( | self | ) |
Enable photosynthesis model status messages.
Definition at line 676 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.exportResults | ( | self, | |
| str | label ) |
Export photosynthesis results with optional label.
| label | Data label for export |
Definition at line 671 of file PhotosynthesisModel.py.
|
static |
Static method to get available species without creating a model instance.
Definition at line 382 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.get_native_ptr | ( | self | ) |
Get the native C++ pointer for advanced operations.
Definition at line 142 of file PhotosynthesisModel.py.
|
static |
Static method to get species aliases mapping.
Definition at line 392 of file PhotosynthesisModel.py.
| List[float] pyhelios.PhotosynthesisModel.PhotosynthesisModel.getC4CoefficientsFromLibrary | ( | self, | |
| str | species ) |
Return the 43-float C4 coefficient array for species.
See ``native/include/pyhelios_wrapper_photosynthesis.h`` for the per-index meaning.
Definition at line 248 of file PhotosynthesisModel.py.
| List[float] pyhelios.PhotosynthesisModel.PhotosynthesisModel.getC4ModelCoefficients | ( | self, | |
| int | uuid ) |
Return the 43-float C4 coefficient array for a single primitive.
Definition at line 280 of file PhotosynthesisModel.py.
| List[float] pyhelios.PhotosynthesisModel.PhotosynthesisModel.getEmpiricalModelCoefficients | ( | self, | |
| int | uuid ) |
Get empirical model coefficients for a specific primitive.
| uuid | Primitive UUID |
Definition at line 650 of file PhotosynthesisModel.py.
| List[float] pyhelios.PhotosynthesisModel.PhotosynthesisModel.getFarquharModelCoefficients | ( | self, | |
| int | uuid ) |
Get Farquhar model coefficients for a specific primitive.
| uuid | Primitive UUID |
Definition at line 662 of file PhotosynthesisModel.py.
| List[float] pyhelios.PhotosynthesisModel.PhotosynthesisModel.getSpeciesCoefficients | ( | self, | |
| str | species ) |
Get Farquhar model coefficients for a species from the library.
| species | Species name |
Definition at line 371 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.printModelReport | ( | self, | |
| Optional[List[int]] | uuids = None ) |
Print model configuration report.
| uuids | Optional list of UUIDs. If None, prints report for all primitives. |
Definition at line 689 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.resetModel | ( | self | ) |
Reset the model by recreating it.
Definition at line 709 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.run | ( | self | ) |
Run photosynthesis calculations for all primitives in the context.
The model must be configured with appropriate coefficients before running.
Definition at line 309 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.runForPrimitives | ( | self, | |
| Union[List[int], int] | uuids ) |
Run photosynthesis calculations for specific primitives.
| uuids | Single UUID (integer) or list of UUIDs for primitives |
Definition at line 319 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setC4CoefficientsFromLibrary | ( | self, | |
| str | species, | ||
| Optional[List[int]] | uuids = None, | ||
| Optional[str] | material_label = None ) |
Set C4 model coefficients from the von Caemmerer (2021) species library.
| species | Species name (case-insensitive). See :data:AVAILABLE_C4_SPECIES. |
| uuids | Optional list of primitive UUIDs. If None and material_label is also None, applies to all primitives in the Context. |
| material_label | Optional material label. When set, applies the coefficients to every primitive that references this material at run() time. Mutually exclusive with uuids. |
| ValueError | If both ``uuids`` and ``material_label`` are provided. |
| NotImplementedError | If running against helios-core older than v1.3.72. |
Definition at line 232 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setC4ModelCoefficients | ( | self, | |
| List[float] | coefficients, | ||
| Optional[List[int]] | uuids = None, | ||
| Optional[str] | material_label = None ) |
Apply a 43-float C4 coefficient array.
Pair with :meth:`getC4CoefficientsFromLibrary` to round-trip a species' defaults.
| coefficients | 43-float C4 coefficient array. |
| uuids | Optional list of primitive UUIDs. If None and material_label is also None, applies to all primitives in the Context. |
| material_label | Optional material label. When set, applies the coefficients to every primitive that references this material at run() time. Mutually exclusive with uuids. |
| ValueError | If both ``uuids`` and ``material_label`` are provided. |
Definition at line 267 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setCm | ( | self, | |
| float | cm, | ||
| List[int] | uuids ) |
Manually prescribe the mesophyll cytosolic CO2 partial pressure (Cm) for the C4 model.
Bypasses the ``Cm = Ci - A/gm`` fixed-point iteration and the stomatal balance on Ci. Primarily intended for testing and validation against the von Caemmerer 2021 reference spreadsheet.
| cm | Mesophyll cytosolic CO2 partial pressure in ubar. |
| uuids | Primitive UUIDs to set. Must be non-empty. |
| ValueError | If ``uuids`` is empty. |
| NotImplementedError | If running against helios-core older than v1.3.72. |
Definition at line 298 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setDarkRespiration | ( | self, | |
| float | respiration, | ||
| List[int] | uuids, | ||
| Optional[float] | dha = None, | ||
| Optional[float] | topt = None, | ||
| Optional[float] | dhd = None ) |
Set dark respiration rate.
This method modifies only the Rd parameter while preserving all other existing Farquhar model parameters for each primitive.
| respiration | Dark respiration rate at 25°C (μmol m⁻² s⁻¹) |
| uuids | List of primitive UUIDs to modify (required) |
| dha | Activation energy (optional, kJ/mol) |
| topt | Optimal temperature (optional, °C) |
| dhd | Deactivation energy (optional, kJ/mol) |
Definition at line 542 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setEmpiricalModelCoefficients | ( | self, | |
| EmpiricalModelCoefficients | coefficients, | ||
| Optional[List[int]] | uuids = None ) |
Set empirical model coefficients.
| coefficients | EmpiricalModelCoefficients instance with model parameters |
| uuids | Optional list of primitive UUIDs. If None, applies to all primitives. |
Definition at line 404 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setFarquharCoefficientsFromLibrary | ( | self, | |
| str | species, | ||
| Optional[List[int]] | uuids = None ) |
Set Farquhar model coefficients from built-in species library.
This method matches the C++ API naming: setFarquharCoefficientsFromLibrary()
| species | Species name from the built-in library |
| uuids | Optional list of primitive UUIDs. If None, applies to all primitives. |
Definition at line 356 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setFarquharMesophyllConductance | ( | self, | |
| float | gm_at_25c, | ||
| float | dha = -1.0, | ||
| float | topt = -1.0, | ||
| float | dhd = -1.0, | ||
| Optional[List[int]] | uuids = None ) |
Set Farquhar mesophyll conductance gm (mol CO2 / m² / s / bar) for selected primitives.
Pass ``dha`` < 0 (the default) to apply ``gm`` with no temperature response. Pass a positive ``dha`` and leave ``topt``/``dhd`` at -1 to use a monotonic Arrhenius response. Set ``topt`` (in °C) for a peaked Arrhenius response, and ``dhd`` to override the deactivation energy (defaults to ``10*dha``).
| gm_at_25c | gm at the 25 °C reference, mol CO2 / m² / s / bar. |
| dha | Activation energy (kJ/mol). -1 disables temperature response. |
| topt | Optimum temperature in °C. -1 keeps Arrhenius monotonic. |
| dhd | Deactivation energy (kJ/mol). -1 picks a default. |
| uuids | Primitive UUIDs to update. None is rejected; the underlying wrapper requires explicit UUIDs (matching setVcmax etc.). |
| ValueError | If ``uuids`` is None or empty. |
| NotImplementedError | If running against helios-core older than v1.3.72. |
Definition at line 203 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setFarquharModelCoefficients | ( | self, | |
| FarquharModelCoefficients | coefficients, | ||
| Optional[List[int]] | uuids = None ) |
Set Farquhar model coefficients.
| coefficients | FarquharModelCoefficients instance with FvCB parameters |
| uuids | Optional list of primitive UUIDs. If None, applies to all primitives. |
Definition at line 422 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setJmax | ( | self, | |
| float | jmax, | ||
| List[int] | uuids, | ||
| Optional[float] | dha = None, | ||
| Optional[float] | topt = None, | ||
| Optional[float] | dhd = None ) |
Set maximum electron transport rate for Farquhar model.
This method modifies only the Jmax parameter while preserving all other existing Farquhar model parameters for each primitive.
| jmax | Maximum electron transport rate at 25°C (μmol m⁻² s⁻¹) |
| uuids | List of primitive UUIDs to modify (required) |
| dha | Activation energy (optional, kJ/mol) |
| topt | Optimal temperature (optional, °C) |
| dhd | Deactivation energy (optional, kJ/mol) |
Definition at line 505 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setLightResponseCurvature | ( | self, | |
| float | curvature, | ||
| List[int] | uuids, | ||
| Optional[float] | dha = None, | ||
| Optional[float] | topt = None, | ||
| Optional[float] | dhd = None ) |
Set light response curvature parameter.
This method modifies only the theta parameter while preserving all other existing Farquhar model parameters for each primitive.
| curvature | Light response curvature at 25°C (dimensionless) |
| uuids | List of primitive UUIDs to modify (required) |
| dha | Activation energy (optional, kJ/mol) |
| topt | Optimal temperature (optional, °C) |
| dhd | Deactivation energy (optional, kJ/mol) |
Definition at line 621 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setModelTypeC4 | ( | self | ) |
Set the photosynthesis model type to the von Caemmerer (2021) steady-state C4 model.
Pair with :meth:`setC4CoefficientsFromLibrary` (e.g. ``"SetariaViridis_vC2021"``, ``"Maize_Massad2007"``) or :meth:`setC4ModelCoefficients` to populate parameters.
| NotImplementedError | If running against an older helios-core that does not support the C4 bindings — rebuild with build_scripts/build_helios --clean. |
Definition at line 180 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setModelTypeEmpirical | ( | self | ) |
Set the photosynthesis model type to empirical.
The empirical model uses light response curves with saturation kinetics.
Definition at line 155 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setModelTypeFarquhar | ( | self | ) |
Set the photosynthesis model type to Farquhar-von Caemmerer-Berry.
The FvCB model is a mechanistic model accounting for biochemical limitations of C3 photosynthesis.
Definition at line 164 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setQuantumEfficiency | ( | self, | |
| float | efficiency, | ||
| List[int] | uuids, | ||
| Optional[float] | dha = None, | ||
| Optional[float] | topt = None, | ||
| Optional[float] | dhd = None ) |
Set quantum efficiency of photosystem II.
This method modifies only the alpha parameter while preserving all other existing Farquhar model parameters for each primitive.
| efficiency | Quantum efficiency at 25°C (dimensionless, 0-1) |
| uuids | List of primitive UUIDs to modify (required) |
| dha | Activation energy (optional, kJ/mol) |
| topt | Optimal temperature (optional, °C) |
| dhd | Deactivation energy (optional, kJ/mol) |
Definition at line 579 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setSpeciesCoefficients | ( | self, | |
| str | species, | ||
| Optional[List[int]] | uuids = None ) |
Set Farquhar model coefficients from built-in species library.
| species | Species name from the built-in library |
| uuids | Optional list of primitive UUIDs. If None, applies to all primitives. |
Definition at line 337 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.setVcmax | ( | self, | |
| float | vcmax, | ||
| List[int] | uuids, | ||
| Optional[float] | dha = None, | ||
| Optional[float] | topt = None, | ||
| Optional[float] | dhd = None ) |
Set maximum carboxylation rate for Farquhar model.
This method modifies only the Vcmax parameter while preserving all other existing Farquhar model parameters for each primitive.
| vcmax | Maximum carboxylation rate at 25°C (μmol m⁻² s⁻¹) |
| uuids | List of primitive UUIDs to modify (required) |
| dha | Activation energy (optional, kJ/mol) |
| topt | Optimal temperature (optional, °C) |
| dhd | Deactivation energy (optional, kJ/mol) |
Definition at line 452 of file PhotosynthesisModel.py.
| bool pyhelios.PhotosynthesisModel.PhotosynthesisModel.validateConfiguration | ( | self | ) |
Basic validation that model has been configured.
Definition at line 702 of file PhotosynthesisModel.py.
|
protected |
Definition at line 94 of file PhotosynthesisModel.py.
| pyhelios.PhotosynthesisModel.PhotosynthesisModel.context = context |
Definition at line 93 of file PhotosynthesisModel.py.