![]() |
PyHelios 0.1.11
|
High-level interface for PROSPECT leaf optical model. More...
High-level interface for PROSPECT leaf optical model.
This class provides a user-friendly wrapper around the native Helios LeafOptics plugin for computing spectral reflectance and transmittance of plant leaves based on their biochemical properties.
The PROSPECT model computes spectral optical properties for wavelengths from 400 nm to 2500 nm at 1 nm resolution (2101 data points).
System requirements:
Definition at line 223 of file LeafOptics.py.
Public Member Functions | |
| __init__ (self, Context context) | |
| Initialize LeafOptics with graceful plugin handling. | |
| __enter__ (self) | |
| Context manager entry. | |
| __exit__ (self, exc_type, exc_value, traceback) | |
| Context manager exit with proper cleanup. | |
| __del__ (self) | |
| Destructor to ensure C++ resources freed even without 'with' statement. | |
| None | run (self, List[int] UUIDs, LeafOpticsProperties leafproperties, str label) |
| Run the LeafOptics model to generate spectra and assign to primitives. | |
| None | runNoUUIDs (self, LeafOpticsProperties leafproperties, str label) |
| Run the LeafOptics model without assigning to primitives. | |
| Tuple[List[float], List[float], List[float]] | getLeafSpectra (self, LeafOpticsProperties leafproperties) |
| Compute leaf reflectance and transmittance spectra. | |
| None | setProperties (self, List[int] UUIDs, LeafOpticsProperties leafproperties) |
| Set leaf optical properties for primitives as Context primitive data. | |
| None | getPropertiesFromSpectrum (self, List[int] UUIDs) |
| Get PROSPECT parameters from reflectivity spectrum for primitives. | |
| LeafOpticsProperties | getPropertiesFromLibrary (self, str species) |
| Get leaf optical properties from the built-in species library. | |
| None | disableMessages (self) |
| Disable command-line output messages from LeafOptics. | |
| None | enableMessages (self) |
| Enable command-line output messages from LeafOptics. | |
| None | optionalOutputPrimitiveData (self, str label) |
| Selectively output specific biochemical properties as primitive data. | |
Static Public Member Functions | |
| List[str] | getAvailableSpecies () |
| Get list of available species in the built-in library. | |
| bool | isAvailable () |
| Check if LeafOptics plugin is available in the current build. | |
Public Attributes | |
| context = context | |
Protected Attributes | |
| _leafoptics_ptr = None | |
| pyhelios.LeafOptics.LeafOptics.__init__ | ( | self, | |
| Context | context ) |
Initialize LeafOptics with graceful plugin handling.
| context | Helios Context instance |
| TypeError | If context is not a Context instance |
| LeafOpticsError | If LeafOptics plugin is not available or spectral data missing |
Definition at line 235 of file LeafOptics.py.
| pyhelios.LeafOptics.LeafOptics.__del__ | ( | self | ) |
Destructor to ensure C++ resources freed even without 'with' statement.
Definition at line 305 of file LeafOptics.py.
| pyhelios.LeafOptics.LeafOptics.__enter__ | ( | self | ) |
Context manager entry.
Definition at line 290 of file LeafOptics.py.
| pyhelios.LeafOptics.LeafOptics.__exit__ | ( | self, | |
| exc_type, | |||
| exc_value, | |||
| traceback ) |
Context manager exit with proper cleanup.
Definition at line 294 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.disableMessages | ( | self | ) |
Disable command-line output messages from LeafOptics.
Definition at line 516 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.enableMessages | ( | self | ) |
Enable command-line output messages from LeafOptics.
Definition at line 523 of file LeafOptics.py.
|
static |
Get list of available species in the built-in library.
Definition at line 582 of file LeafOptics.py.
| Tuple[List[float], List[float], List[float]] pyhelios.LeafOptics.LeafOptics.getLeafSpectra | ( | self, | |
| LeafOpticsProperties | leafproperties ) |
Compute leaf reflectance and transmittance spectra.
This method computes spectral properties without creating global data entries or assigning to primitives.
| leafproperties | LeafOpticsProperties with biochemical parameters |
| ValueError | If parameters are invalid |
| LeafOpticsError | If computation fails |
Definition at line 409 of file LeafOptics.py.
| LeafOpticsProperties pyhelios.LeafOptics.LeafOptics.getPropertiesFromLibrary | ( | self, | |
| str | species ) |
Get leaf optical properties from the built-in species library.
The library contains PROSPECT-D parameters fitted from the LOPEX93 dataset for common plant species.
| species | Name of the species (case-insensitive). Available species: "default", "garden_lettuce", "alfalfa", "corn", "sunflower", "english_walnut", "rice", "soybean", "wine_grape", "tomato", "common_bean", "cowpea" |
| ValueError | If species name is empty |
Definition at line 502 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.getPropertiesFromSpectrum | ( | self, | |
| List[int] | UUIDs ) |
Get PROSPECT parameters from reflectivity spectrum for primitives.
This method retrieves the "reflectivity_spectrum" primitive data for each primitive and checks if it matches a spectrum generated by this LeafOptics instance. If a match is found, the corresponding PROSPECT model parameters are assigned as primitive data.
| UUIDs | List of primitive UUIDs to query |
Definition at line 465 of file LeafOptics.py.
|
static |
Check if LeafOptics plugin is available in the current build.
Definition at line 592 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.optionalOutputPrimitiveData | ( | self, | |
| str | label ) |
Selectively output specific biochemical properties as primitive data.
By default, LeafOptics writes all biochemical properties to primitive data. Use this method to specify only the properties you need for improved performance.
| label | Biochemical property to output. Valid values:
|
| ValueError | If label is empty or invalid |
| LeafOpticsError | If operation fails |
Definition at line 561 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.run | ( | self, | |
| List[int] | UUIDs, | ||
| LeafOpticsProperties | leafproperties, | ||
| str | label ) |
Run the LeafOptics model to generate spectra and assign to primitives.
This method computes reflectance and transmittance spectra based on the given leaf properties, creates global data entries, and assigns them to the specified primitives.
| UUIDs | List of primitive UUIDs to assign spectra to |
| leafproperties | LeafOpticsProperties with biochemical parameters |
| label | Label for the spectra (appended to "leaf_reflectivity_" and "leaf_transmissivity_") |
| ValueError | If parameters are invalid |
| LeafOpticsError | If computation fails |
Definition at line 335 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.runNoUUIDs | ( | self, | |
| LeafOpticsProperties | leafproperties, | ||
| str | label ) |
Run the LeafOptics model without assigning to primitives.
This method computes reflectance and transmittance spectra based on the given leaf properties and creates global data entries, but does not assign them to any primitives.
| leafproperties | LeafOpticsProperties with biochemical parameters |
| label | Label for the spectra (appended to "leaf_reflectivity_" and "leaf_transmissivity_") |
| ValueError | If parameters are invalid |
| LeafOpticsError | If computation fails |
Definition at line 368 of file LeafOptics.py.
| None pyhelios.LeafOptics.LeafOptics.setProperties | ( | self, | |
| List[int] | UUIDs, | ||
| LeafOpticsProperties | leafproperties ) |
Set leaf optical properties for primitives as Context primitive data.
This assigns the biochemical properties as primitive data using labels: "chlorophyll", "carotenoid", "anthocyanin", "brown", "water", "drymass" (or "protein" + "cellulose" in PROSPECT-PRO mode).
| UUIDs | List of primitive UUIDs |
| leafproperties | LeafOpticsProperties with biochemical parameters |
| ValueError | If parameters are invalid |
| LeafOpticsError | If operation fails |
Definition at line 436 of file LeafOptics.py.
|
protected |
Definition at line 243 of file LeafOptics.py.
| pyhelios.LeafOptics.LeafOptics.context = context |
Definition at line 242 of file LeafOptics.py.