### Interactive selection (guided setup) Source: https://plantsimulationlab.github.io/PyHelios/PluginBuildSystem.html Starts an interactive guided setup for plugin selection. ```bash build_scripts/build_helios --interactive ``` -------------------------------- ### Quick start with PlantArchitecture Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitectureDoc.html Quick start example that creates a PyHelios context and PlantArchitecture plugin, then retrieves and prints the available plant models. ```python from pyhelios import Context, PlantArchitecture from pyhelios.types import * # Create context and plugin with Context() as context: with PlantArchitecture(context) as plantarch: # Get available plant models models = plantarch.getAvailablePlantModels() print(f"Available models: {models}") ``` -------------------------------- ### Quick Start Example Source: https://plantsimulationlab.github.io/PyHelios/BoundaryLayerConductanceDoc.html A basic example demonstrating how to initialize the PyHelios context and add a leaf patch using the BoundaryLayerConductanceModel. ```python from pyhelios import Context, BoundaryLayerConductanceModel from pyhelios.types import vec3, vec2 with Context() as context: # Create leaf geometry leaf_uuid = context.addPatch(center=vec3(0, 0, 1), size=vec2(0.1, 0.1)) ``` -------------------------------- ### Quick Start: Using Visualizer with Context Source: https://plantsimulationlab.github.io/PyHelios/VisualizerDoc.html Initializes a PyHelios Context and Visualizer. Requires OpenGL 3.3+ and X11/xorg on Mac/Linux. The example shows the import statements and the start of a with block. ```python from pyhelios import Context, Visualizer from pyhelios.types import vec3, vec2, RGBcolor with Context() as context: ``` -------------------------------- ### Setup prerequisites on CentOS/RHEL Source: https://plantsimulationlab.github.io/PyHelios/CrossPlatform.html Commands to install development tools and dependencies on RHEL-based systems. ```bash sudo yum groupinstall "Development Tools" sudo yum install cmake python3-devel ``` -------------------------------- ### LeafOptics Quick Start Source: https://plantsimulationlab.github.io/PyHelios/LeafOpticsDoc.html Quick start example for the LeafOptics plugin. It imports the required classes and creates a leaf patch geometry using the context's addPatch method. ```python from pyhelios import Context, LeafOptics from pyhelios.types import vec3, vec2 with Context() as context: # Create leaf geometry uuid = context.addPatch(center=vec3(0, 0, 1), size=vec2(0.1, 0.1)) ``` -------------------------------- ### Minimal SIF Wiring Example Source: https://plantsimulationlab.github.io/PyHelios/LeafOpticsDoc.html Demonstrates the basic setup for configuring leaf properties and running the LeafOptics simulation for SIF. ```python from pyhelios import Context, LeafOptics from pyhelios.LeafOptics import LeafOpticsProperties from pyhelios.types import vec3, vec2 with Context() as context: leaf_uuids = [context.addPatch(center=vec3(0, 0, 1), size=vec2(0.1, 0.1))] with LeafOptics(context) as leafoptics: props = LeafOpticsProperties() props.chlorophyllcontent = 40.0 # Cab, ug/cm^2 props.carotenoidcontent = 10.0 # Cca, ug/cm^2 props.numberlayers = 1.5 props.watermass = 0.009 # cm props.drymass = 0.012 # g/cm^2 props.V2Z = 0.0 # dark-adapted; SIF-only props.fqe = 1.0 # no calibration scalar; SIF-only leafoptics.run(leaf_uuids, props, "myleaf") ``` -------------------------------- ### Initialize SolarPosition Context Source: https://plantsimulationlab.github.io/PyHelios/SolarPositionDoc.html A quick start example showing how to import necessary modules, initialize a context, and set the date and time. ```python from pyhelios import Context, SolarPosition from pyhelios.types import * with Context() as context: # Set date and time context.setDate(2015, 5, 1) # May 1, 2015 context.setTime(12, 30) # 12:30 ``` -------------------------------- ### Run Plant Architecture File I/O Example Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitectureDoc.html Command to execute the comprehensive file I/O example script provided in the documentation examples directory. ```bash python docs/examples/plantarch_file_io_sample.py ``` -------------------------------- ### Example usage of run() Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1EnergyBalance_1_1EnergyBalanceModel.html Examples demonstrating steady-state and dynamic simulation calls for the EnergyBalanceModel. ```python >>> # Steady state for all primitives >>> energy_balance.run() ``` ```python >>> # Dynamic simulation with 60-second timestep >>> energy_balance.run(dt=60.0) ``` ```python >>> # Steady state for specific patches >>> energy_balance.run(uuids=[patch1_uuid, patch2_uuid]) ``` ```python >>> # Dynamic simulation for specific patches >>> energy_balance.run(uuids=[patch1_uuid, patch2_uuid], dt=30.0) ``` -------------------------------- ### Build a Weber-Penn Tree Source: https://plantsimulationlab.github.io/PyHelios/WeberPennTreeDoc.html A quick start example demonstrating how to initialize a PyHelios context and build a lemon tree at the origin. ```python from pyhelios import Context, WeberPennTree, WPTType from pyhelios.types import vec3 with Context() as context: with WeberPennTree(context) as wpt: # Build a lemon tree tree_id = wpt.buildTree(WPTType.LEMON, origin=vec3(0, 0, 0)) ``` -------------------------------- ### Initialize PhotosynthesisModel Context Source: https://plantsimulationlab.github.io/PyHelios/PhotosynthesisDoc.html A quick start example demonstrating how to initialize the PyHelios context and create a simple patch. ```python from pyhelios import Context, PhotosynthesisModel from pyhelios.types import vec3, vec2 with Context() as context: # Create a simple patch patch_uuid = context.addPatch(center=vec3(0, 0, 0), size=vec2(0.1, 0.1)) ``` -------------------------------- ### Install CUDA Toolkit on Ubuntu 22.04 Source: https://plantsimulationlab.github.io/PyHelios/CUDASetup.html Commands to download the keyring, install the toolkit, update the PATH, and verify the installation on Ubuntu. ```bash wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update sudo apt-get install cuda-toolkit-12-3 export PATH=/usr/local/cuda-12.3/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH source ~/.bashrc nvidia-smi nvcc --version ``` -------------------------------- ### Install CUDA on Ubuntu Source: https://plantsimulationlab.github.io/PyHelios/CrossPlatform.html Steps to configure the NVIDIA repository and install CUDA drivers. ```bash wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" sudo apt-get update sudo apt-get install cuda ``` -------------------------------- ### Install PyHelios on General Systems Source: https://plantsimulationlab.github.io/PyHelios/index.html Standard installation sequence for cloning the repository, building native libraries, and installing Python dependencies. ```bash git clone --recursive https://github.com/PlantSimulationLab/PyHelios.git cd PyHelios/ # Build native libraries (optional - pre-built binaries included) ./build_scripts/build_helios # Install PyHelios dependencies pip install -e . ``` -------------------------------- ### PhotosynthesisModel Usage Example Source: https://plantsimulationlab.github.io/PyHelios/PhotosynthesisDoc.html Example showing how to set required primitive data, create a PhotosynthesisModel, run it, and retrieve the net photosynthesis result. ```APIDOC ## PhotosynthesisModel Usage Example ### Description Demonstrates setting required primitive data, creating a PhotosynthesisModel, running the model, and retrieving the net photosynthesis output. ### Usage ```python # Set required primitive data context.setPrimitiveDataFloat(patch_uuid, "radiation_flux_PAR", 500.0) # W/m² context.setPrimitiveDataFloat(patch_uuid, "temperature", 298.15) # K context.setPrimitiveDataFloat(patch_uuid, "air_CO2", 400.0) # µmol/mol context.setPrimitiveDataFloat(patch_uuid, "moisture_conductance", 0.3) # mol/m²-s context.setPrimitiveDataFloat(patch_uuid, "boundarylayer_conductance", 1.0) # mol/m²-s # Create photosynthesis model with PhotosynthesisModel(context) as photo: # Use species from library photo.setFarquharCoefficientsFromLibrary("Almond") # Run model photo.run() # Get results A = context.getPrimitiveData(patch_uuid, "net_photosynthesis") print(f"Net photosynthesis: {A[0]:.2f} µmol CO₂/m²-s") ``` ### Input Primitive Data - **radiation_flux_PAR** (float) - Required - Radiative flux in PAR band (W/m2). Automatically converted to photon flux density. - **temperature** (float) - Required - Primitive surface temperature (Kelvin). - **air_CO2** (float) - Required - CO2 concentration of air outside of primitive boundary-layer (μmol CO2/mol air). - **moisture_conductance** (float) - Required - Conductance to moisture between sub-stomatal cells and leaf surface (mol air/m2-s). - **boundarylayer_conductance** (float) - Required - Conductance to heat between leaf surface and outside of the boundary-layer (mol air/m2-s). - **twosided_flag** (uint) - Optional - Flag indicating number of primitive faces with heat transfer (0 for one-sided, 1 for two-sided). - **stomatal_sidedness** (float) - Optional - Ratio of stomatal density on upper leaf surface to total stomatal density. ### Output Primitive Data - **net_photosynthesis** (float) - Default output - Net rate of carbon transfer per unit one-sided area (μmol CO2/m2-sec). - **Ci** (float) - Optional - Intercellular CO2 concentration (μmol CO2/mol). - **Gamma_CO2** (float) - Optional - Photosynthetic CO2 compensation point (μmol CO2/mol). - **limitation_state** (int) - Optional - Photosynthesis limitation state. - **Cm** (float) - Optional - Mesophyll cytosolic CO2 partial pressure (μbar). C4 model only. - **Vp** (float) - Optional - PEP carboxylation rate (μmol CO2/m2-sec). C4 model only. ``` -------------------------------- ### Visualizer printWindow usage examples Source: https://plantsimulationlab.github.io/PyHelios/Visualizer_8py_source.html Examples showing how to save the current visualization window to a file, with automatic or explicit format detection. ```python >>> visualizer.printWindow("output.jpg") # Auto-detects JPEG >>> visualizer.printWindow("output.png") # Auto-detects PNG >>> visualizer.printWindow("output.img", image_format="png") # Explicit PNG ``` -------------------------------- ### Install PyHelios on macOS Source: https://plantsimulationlab.github.io/PyHelios/index.html Installation workflow for macOS, including C++ dependency setup and native library building. ```bash git clone --recursive https://github.com/PlantSimulationLab/PyHelios.git cd PyHelios/ # Install c++ dependencies and build native libraries source helios-core/utilities/dependencies.sh ./build_scripts/build_helios # Install PyHelios dependencies pip install -e . ``` -------------------------------- ### Install dependencies and build native libraries Source: https://plantsimulationlab.github.io/PyHelios/CrossPlatform.html Standard commands to prepare the environment and build native components. ```bash source helios-core/utilities/dependencies.sh build_scripts/build_helios pip install -e . ``` -------------------------------- ### Build a plant instance from library Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1PlantArchitecture_1_1PlantArchitecture.html Demonstrates building a plant instance with default and custom parameters. ```python >>> plant_id = plantarch.buildPlantInstanceFromLibrary(base_position=vec3(2.0, 3.0, 0.0), age=45.0) >>> # With custom parameters >>> plant_id = plantarch.buildPlantInstanceFromLibrary( ... base_position=vec3(0, 0, 0), ... age=30.0, ... build_parameters={'trunk_height': 2.0} ... ) ``` -------------------------------- ### LiDARCloud.syntheticScan() discrete-return and full-waveform examples Source: https://plantsimulationlab.github.io/PyHelios/LiDARCloud_8py_source.html Two usage examples for LiDARCloud.syntheticScan(): a discrete-return scan (rays_per_pulse=None) and a full-waveform scan (rays_per_pulse=100). The discrete-return example shows the required setup with Context and LiDARCloud, including addScan() parameters. The full-waveform example requires pulse_distance_threshold and raises ValueError if it is missing. ```python >>> from pyhelios import Context, LiDARCloud >>> from pyhelios.types import vec3 >>> with Context() as context: ... # Add geometry ... context.addPatch(center=vec3(0, 0, 0.5), size=vec2(1, 1)) ... ... with LiDARCloud() as lidar: ... # Define scan parameters ... scan_id = lidar.addScan( ... origin=vec3(0, 0, 2), ... Ntheta=100, theta_range=(0, 1.57), ... Nphi=100, phi_range=(0, 6.28), ... exit_diameter=0, beam_divergence=0 ... ) ... ... # Perform discrete-return scan ... lidar.syntheticScan(context) ``` ```python >>> lidar.syntheticScan( ... context, ... rays_per_pulse=100, ... pulse_distance_threshold=0.02, ... record_misses=True ... ) ``` -------------------------------- ### Initialize Visualizer Source: https://plantsimulationlab.github.io/PyHelios/VisualizerDoc.html Basic setup for importing the Visualizer and required types. ```python from pyhelios import Visualizer from pyhelios.types import vec3, SphericalCoord with Visualizer(width=1200, height=800) as vis: ``` -------------------------------- ### Get Sun Direction Vector Source: https://plantsimulationlab.github.io/PyHelios/SolarPosition_8py_source.html Example of retrieving the sun's direction as a vector. ```python >>> direction = solar.getSunDirectionVector() >>> print(f"Sun direction vector: ({direction.x:.3f}, {direction.y:.3f}, {direction.z:.3f})") ``` -------------------------------- ### Enable Headless Mode Source: https://plantsimulationlab.github.io/PyHelios/VisualizerDoc.html Example showing how to initialize the Visualizer in headless mode by setting the headless parameter to True in the constructor. ```python from pyhelios import Context, Visualizer from pyhelios.types import vec3 with Context() as context: ``` -------------------------------- ### Get Geometry Vertices Example Source: https://plantsimulationlab.github.io/PyHelios/Visualizer_8py_source.html Demonstrates how to retrieve and iterate over the vertices of a geometry primitive. ```python >>> vertices = visualizer.getGeometryVertices(geometry_id) >>> for vertex in vertices: ... print(f"Vertex: ({vertex.x}, {vertex.y}, {vertex.z})") ``` -------------------------------- ### Get Diffuse Flux Source: https://plantsimulationlab.github.io/PyHelios/RadiationModel_8py_source.html Example of retrieving the diffuse flux for a specific band using getDiffuseFlux. ```python >>> flux = radiation.getDiffuseFlux("SW") ``` -------------------------------- ### Build from source on Ubuntu/Debian Source: https://plantsimulationlab.github.io/PyHelios/CrossPlatform.html Steps to install prerequisites and build the project from source on Debian-based systems. ```bash # Install prerequisites sudo apt-get update sudo apt-get install build-essential cmake python3-dev git clone --recursive https://github.com/PlantSimulationLab/PyHelios.git cd PyHelios/ ``` -------------------------------- ### Get Shoot Hierarchy Map Example Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitecture_8py_source.html Demonstrates how to retrieve a mapping of shoot IDs to their direct children IDs. ```python >>> hierarchy = plantarch.getShootHierarchyMap(plant_id) >>> print(f"{len(hierarchy)} shoots carry branches") ``` -------------------------------- ### loadPlantModelFromLibrary usage example Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1PlantArchitecture_1_1PlantArchitecture.html Demonstrates loading different plant models from the built-in library. ```python >>> plantarch.loadPlantModelFromLibrary("bean") >>> plantarch.loadPlantModelFromLibrary("almond") ``` -------------------------------- ### Get Sun Direction Spherical Source: https://plantsimulationlab.github.io/PyHelios/SolarPosition_8py_source.html Example of retrieving the sun's direction as spherical coordinates with radius, elevation, and azimuth. ```python >>> spherical = solar.getSunDirectionSpherical() >>> print(f"Spherical: r={spherical.radius}, elev={spherical.elevation:.3f}, az={spherical.azimuth:.3f}") ``` -------------------------------- ### Import PyHelios context and types Source: https://plantsimulationlab.github.io/PyHelios/API.html Initial setup for using the PyHelios library. ```python from pyhelios import Context from pyhelios.types import vec3, vec2 ``` -------------------------------- ### Example usage of enableSolidObstacleAvoidance Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1PlantArchitecture_1_1PlantArchitecture.html Demonstrates both a simple configuration of solid obstacles and a more specific setup involving reduced avoidance distance and fruit adjustment. ```python >>> # Simple solid obstacle avoidance >>> wall_uuids = [1, 2, 3, 4] # UUIDs of wall primitives >>> plantarch.enableSolidObstacleAvoidance(wall_uuids) >>> >>> # Close avoidance with fruit adjustment >>> plantarch.enableSolidObstacleAvoidance( ... obstacle_UUIDs=wall_uuids, ... avoidance_distance=0.1, ... enable_fruit_adjustment=True ... ) ``` -------------------------------- ### PhotosynthesisModel usage example Source: https://plantsimulationlab.github.io/PyHelios/PhotosynthesisModel_8py_source.html Demonstrates how to initialize the PhotosynthesisModel within a context, configure it with empirical model coefficients, and execute the simulation. ```python >>> from pyhelios import Context, PhotosynthesisModel >>> from pyhelios.types import EmpiricalModelCoefficients >>> context = Context() >>> with PhotosynthesisModel(context) as photosynthesis: ... # Configure empirical model ... coeffs = EmpiricalModelCoefficients( ... Tref=298.0, # Reference temperature (K) ... Ci_ref=290.0, # Reference CO2 concentration (μmol/mol) ... Asat=20.0, # Light-saturated photosynthesis rate (μmol/m²/s) ... theta=65.0 # Light response curvature (µmol/m²·s PPFD) ... ) ... photosynthesis.setEmpiricalModelCoefficients(coeffs) ... photosynthesis.run() ``` -------------------------------- ### Get camera orientation with getCameraOrientation Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1RadiationModel_1_1RadiationModel.html Retrieves the camera orientation as a SphericalCoord [radius, elevation, azimuth] for the given camera label. The example prints the returned orientation. ```python >>> orientation = radiation.getCameraOrientation("cam1") >>> print(f"Camera orientation: {orientation}") ``` -------------------------------- ### Add Disks with Various Configurations Source: https://plantsimulationlab.github.io/PyHelios/Context_8py_source.html Examples demonstrating how to create a simple red disk, a semi-transparent blue elliptical disk, and a disk with specific polar and radial subdivisions. ```python >>> context = Context() >>> # Create a red disk at (0, 0, 1) with radius 0.5 >>> disk_uuids = context.addDisk( ... center=vec3(0, 0, 1), ... size=vec2(0.5, 0.5), ... ndivs=30, ... color=RGBcolor(1, 0, 0) ... ) >>> print(f"Created disk with {len(disk_uuids)} triangles") >>> >>> # Create a semi-transparent blue elliptical disk >>> disk_uuids = context.addDisk( ... center=vec3(0, 0, 2), ... size=vec2(1.0, 0.5), ... ndivs=40, ... rotation=SphericalCoord(1, 0.5, 0), ... color=RGBAcolor(0, 0, 1, 0.5) ... ) >>> >>> # Create disk with polar/radial subdivisions for finer control >>> disk_uuids = context.addDisk( ... center=vec3(0, 0, 3), ... size=vec2(1, 1), ... ndivs=int2(10, 20), # 10 radial, 20 azimuthal divisions ... color=RGBcolor(0, 1, 0) ... ) ``` -------------------------------- ### Configure and run photosynthesis simulation Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1PhotosynthesisModel_1_1PhotosynthesisModel.html Demonstrates initializing a photosynthesis model within a context manager, configuring empirical model coefficients, and executing the simulation. ```python >>> from pyhelios import Context, PhotosynthesisModel >>> from pyhelios.types import EmpiricalModelCoefficients >>> context = Context() >>> with PhotosynthesisModel(context) as photosynthesis: ... # Configure empirical model ... coeffs = EmpiricalModelCoefficients( ... Tref=298.0, # Reference temperature (K) ... Ci_ref=290.0, # Reference CO2 concentration (μmol/mol) ... Asat=20.0, # Light-saturated photosynthesis rate (μmol/m²/s) ... theta=65.0 # Light response curvature (µmol/m²·s PPFD) ... ) ... photosynthesis.setEmpiricalModelCoefficients(coeffs) ... photosynthesis.run() ``` -------------------------------- ### Get Plant Leaf Areas Example Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitecture_8py_source.html Demonstrates how to retrieve the built one-sided surface area of every leaf on a plant. Requires helios-core v1.3.85 or newer. ```python >>> areas = plantarch.getPlantLeafAreas(plant_id) >>> print(f"{len(areas)} leaves, mean {sum(areas)/len(areas):.4f} m^2") ``` -------------------------------- ### Add utility objects with Visualizer Source: https://plantsimulationlab.github.io/PyHelios/VisualizerDoc.html Shows the setup for adding utility objects like coordinate axes and grid wireframes. The example opens a Visualizer and is followed by calls to addCoordinateAxes(), addCoordinateAxesCustom(), or addGridWireFrame(). ```python from pyhelios import Visualizer from pyhelios.types import vec3 with Visualizer(width=1200, height=800) as vis: ``` -------------------------------- ### Build a plant instance from the library Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitecture_8py_source.html Shows how to create a plant instance at a specific position and age, with optional custom build parameters for supported models. ```python >>> plant_id = plantarch.buildPlantInstanceFromLibrary(base_position=vec3(2.0, 3.0, 0.0), age=45.0) >>> # With custom parameters >>> plant_id = plantarch.buildPlantInstanceFromLibrary( ... base_position=vec3(0, 0, 0), ... age=30.0, ... build_parameters={'trunk_height': 2.0} ... ) ``` -------------------------------- ### Set coefficients for different species using UUIDs Source: https://plantsimulationlab.github.io/PyHelios/StomatalConductanceDoc.html Shows the import statements and context setup for a UUID-based coefficient setting example. The code is incomplete in the source, showing only the beginning of a context block. ```python from pyhelios import Context, StomatalConductanceModel, WeberPennTree, WPTType from pyhelios.types import vec3, vec2 with Context() as context: ``` -------------------------------- ### Create an empty plant instance Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitecture_8py_source.html Demonstrates how to initialize a new plant at a specific location and add a base stem shoot to it. ```python >>> # Create empty plant at origin >>> plant_id = plantarch.addPlantInstance(vec3(0, 0, 0), 0.0) >>> >>> # Now add shoots to build custom plant structure >>> shoot_id = plantarch.addBaseStemShoot( ... plant_id, 1, AxisRotation(0, 0, 0), 0.01, 0.1, 1.0, 1.0, 0.8, "mainstem" ... ) ``` -------------------------------- ### LiDARCloud usage example Source: https://plantsimulationlab.github.io/PyHelios/LiDARCloud_8py_source.html Demonstrates initializing a LiDARCloud, adding a scan, adding hit points, and exporting the resulting point cloud. ```python >>> from pyhelios import LiDARCloud >>> from pyhelios.types import vec3 >>> >>> with LiDARCloud() as lidar: ... # Add a scan ... scan_id = lidar.addScan( ... origin=vec3(0, 0, 1), ... Ntheta=100, theta_range=(0, 1.57), ... Nphi=100, phi_range=(-3.14, 3.14), ... exit_diameter=0.01, beam_divergence=0.001 ... ) ... ... # Add hit points ... lidar.addHitPoint(scan_id, vec3(1, 0, 0), vec3(1, 0, 0)) ... ... # Export point cloud ... lidar.exportPointCloud("output.xyz") ``` -------------------------------- ### Example: Define a custom shoot type Source: https://plantsimulationlab.github.io/PyHelios/PlantArchitecture_8py_source.html Shows how to load a plant model, get shoot parameters, modify them, and define a new shoot type. Uses RandomParameterFloat to set constant and uniform parameters. ```python >>> from pyhelios.plant_architecture_params import ShootParameters, RandomParameterFloat >>> plantarch.loadPlantModelFromLibrary("bean") >>> sp = plantarch.getCurrentShootParameters("trifoliate", return_typed=True) >>> sp.max_nodes = RandomParameterFloat.constant(20) >>> sp.phytomer_parameters.leaf.pitch = RandomParameterFloat.uniform(40, 50) >>> plantarch.defineShootType("TallStem", sp) ``` -------------------------------- ### PyHelios plugin CLI usage Source: https://plantsimulationlab.github.io/PyHelios/____main_____8py_source.html Command-line usage examples for the PyHelios plugin management CLI. These commands check plugin status, discover optimal configurations, get plugin information, and validate plugin lists. ```bash python -m pyhelios.plugins status python -m pyhelios.plugins discover python -m pyhelios.plugins info python -m pyhelios.plugins validate ``` -------------------------------- ### __init__(self, Context context) Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1RadiationModel_1_1RadiationModel.html Initializes a RadiationModel instance with graceful plugin handling. ```APIDOC ## __init__(self, Context context) ### Description Initializes RadiationModel with graceful plugin handling. ### Parameters - **context** (Context) - Required - The context object for the radiation model. ### Returns None ``` -------------------------------- ### Install CUDA via Direct Runfile Source: https://plantsimulationlab.github.io/PyHelios/CUDASetup.html Alternative installation method using the NVIDIA runfile installer for more control. ```bash wget https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda_12.3.0_545.23.06_linux.run sudo sh cuda_12.3.0_545.23.06_linux.run ``` -------------------------------- ### Calculate boundary-layer conductance Source: https://plantsimulationlab.github.io/PyHelios/BoundaryLayerConductanceDoc.html Example demonstrating how to set environmental conditions, configure the boundary-layer model, and retrieve the calculated conductance. ```python # Set environmental conditions (optional - defaults used if not set) context.setPrimitiveDataFloat(leaf_uuid, "wind_speed", 2.0) # m/s context.setPrimitiveDataFloat(leaf_uuid, "air_temperature", 298.0) # K # Use boundary-layer conductance model with BoundaryLayerConductanceModel(context) as blc: # Set model for all primitives (default is Pohlhausen) blc.setBoundaryLayerModel("InclinedPlate") # Run calculation blc.run() # Get results gH = context.getPrimitiveData(leaf_uuid, "boundarylayer_conductance") print(f"Boundary-layer conductance: {gH[0]:.3f} mol air/m²-s") ``` -------------------------------- ### Initialize Context and Add Timeseries Data Source: https://plantsimulationlab.github.io/PyHelios/API.html Demonstrates creating a Context object and populating it with temperature data points using Date and Time objects. ```python context = Context() # Add data to timeseries # Date constructor: Date(year, month, day) date = Date(2000, 1, 2) # 2 Jan. 2000 time = Time(13, 0, 0) # 13:00:00 context.addTimeseriesData("temperature", 301.23, date, time) # index #0 time = Time(13, 15, 0) # 13:15:00 context.addTimeseriesData("temperature", 301.92, date, time) # index #1 time = Time(13, 30, 0) # 13:30:00 context.addTimeseriesData("temperature", 302.56, date, time) # index #2 time = Time(13, 45, 0) # 13:45:00 context.addTimeseriesData("temperature", 303.05, date, time) # index #3 ``` -------------------------------- ### Install CUDA Toolkit on CentOS/RHEL Source: https://plantsimulationlab.github.io/PyHelios/CUDASetup.html Commands to install the CUDA repository, the toolkit, update the environment variables, and verify the installation on RHEL 8. ```bash sudo yum install https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-keyring-1.1-1-1.noarch.rpm sudo yum install cuda-toolkit-12-3 export PATH=/usr/local/cuda-12.3/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64:$LD_LIBRARY_PATH source ~/.bashrc nvidia-smi nvcc --version ``` -------------------------------- ### Retrieve PROSPECT parameters using getPropertiesFromSpectrum() Source: https://plantsimulationlab.github.io/PyHelios/LeafOpticsDoc.html This example demonstrates initializing LeafOptics, generating spectra for different leaf types, assigning them to primitives, and finally retrieving the parameters using getPropertiesFromSpectrum(). ```python from pyhelios import Context, LeafOptics from pyhelios.LeafOptics import LeafOpticsProperties from pyhelios.types import vec3, vec2 with Context() as context: with LeafOptics(context) as leafoptics: # Generate spectra for different leaf types healthy_leaf = LeafOpticsProperties() healthy_leaf.chlorophyllcontent = 45.0 healthy_leaf.carotenoidcontent = 12.0 stressed_leaf = LeafOpticsProperties() stressed_leaf.chlorophyllcontent = 20.0 stressed_leaf.brownpigments = 0.3 # Create primitives healthy_IDs = [context.addPatch(center=vec3(0, 0, 1), size=vec2(0.1, 0.1))] stressed_IDs = [context.addPatch(center=vec3(0, 0, 2), size=vec2(0.1, 0.1))] # Run model for each leaf type leafoptics.run(healthy_IDs, healthy_leaf, "healthy") leafoptics.run(stressed_IDs, stressed_leaf, "stressed") # Later, retrieve parameters from primitives based on their assigned spectra all_leaves = healthy_IDs + stressed_IDs leafoptics.getPropertiesFromSpectrum(all_leaves) ``` -------------------------------- ### Example usage of setBBLCoefficients() Source: https://plantsimulationlab.github.io/PyHelios/StomatalConductance_8py_source.html Example usage of setBBLCoefficients() with a BBLCoefficients instance. ```python >>> bbl_coeffs = BBLCoefficients(gs0=0.0743, a1=4.265, D0=14570.0) >>> stomatal.setBBLCoefficients(bbl_coeffs) ``` -------------------------------- ### Example usage of setBWBCoefficients() Source: https://plantsimulationlab.github.io/PyHelios/StomatalConductance_8py_source.html Example usage of setBWBCoefficients() with a BWBCoefficients instance. ```python >>> bwb_coeffs = BWBCoefficients(gs0=0.0733, a1=9.422) >>> stomatal.setBWBCoefficients(bwb_coeffs) ``` -------------------------------- ### Initialize PhotosynthesisModel Source: https://plantsimulationlab.github.io/PyHelios/PhotosynthesisDoc.html Demonstrates the default initialization of the PhotosynthesisModel within a context. ```python from pyhelios import Context, PhotosynthesisModel with Context() as context: with PhotosynthesisModel(context) as photo: ``` -------------------------------- ### __init__(self, Context context) Source: https://plantsimulationlab.github.io/PyHelios/classpyhelios_1_1LeafOptics_1_1LeafOptics.html Initializes a new LeafOptics instance with the provided Context, handling plugin availability gracefully. ```APIDOC ## __init__(self, Context context) ### Description Initializes the LeafOptics object with graceful plugin handling. ### Parameters - **context** (Context) - Required - The Context object used for initialization. ### Returns None ```