Skip to main content

PhyTorch is a comprehensive PyTorch-based toolkit for modeling plant physiological processes including photosynthesis, stomatal conductance, leaf hydraulics, and optical properties.

Project description

PhyTorch

A Comprehensive Physiological Plant Modeling Toolkit

License: GPL v3 Python PyTorch

PhyTorch is a PyTorch-based package for modeling plant physiological processes. It provides efficient, GPU-accelerated implementations of models for photosynthesis, stomatal conductance, leaf hydraulics, and optical properties.

Features

  • Photosynthesis Models: FvCB (Farquhar-von Caemmerer-Berry) model with flexible temperature and light response functions
  • Stomatal Conductance: Multiple empirical and semi-empirical models (Medlyn, Ball-Woodrow-Berry, Buckley-Mott-Farquhar)
  • Leaf Optical Properties: PROSPECT model for leaf spectral reflectance and transmittance
  • Leaf Hydraulics: Coming soon - Models for leaf water transport and hydraulic conductance
  • GPU Acceleration: Leverage PyTorch for fast parameter optimization on CPU or GPU
  • Automatic Differentiation: Efficient gradient-based optimization for model fitting

Installation

From PyPI (recommended)

pip install phytorch

From source

git clone https://github.com/PlantSimulationLab/phytorch.git
cd phytorch
pip install -e .

Quick Start

Photosynthesis (FvCB Model)

from phytorch import photosynthesis as fvcb
import pandas as pd

# Load your A-Ci curve data
df = pd.read_csv('your_aci_data.csv')
lcd = fvcb.initLicordata(df, preprocess=True)

# Initialize and fit the FvCB model
model = fvcb.model(lcd, LightResp_type=2, TempResp_type=2)
result = fvcb.fit(model, learn_rate=0.08, maxiteration=20000)

# View fitted parameters
print(f"Vcmax25 = {result.params['Vcmax25']:.2f} μmol/m²/s")
print(f"Jmax25 = {result.params['Jmax25']:.2f} μmol/m²/s")

Stomatal Conductance

from phytorch import stomatalconductance as stomatal
import pandas as pd

# Load stomatal conductance data
df = pd.read_csv('your_gs_data.csv')
scd = stomatal.initscdata(df, preprocess=True)

# Fit Medlyn model
model = stomatal.model(scd, model_type='MED')
result = stomatal.fit(model, learn_rate=0.01, maxiteration=10000)

# View fitted parameters
print(f"g0 = {result.params['g0']:.4f} mol/m²/s")
print(f"g1 = {result.params['g1']:.2f}")

Package Structure

phytorch/
├── photosynthesis/      # FvCB photosynthesis models
├── stomatalconductance/ # Stomatal conductance models
├── leafoptics/          # PROSPECT leaf optical properties
├── leafhydraulics/      # Leaf hydraulics (under development)
├── data/                # Example datasets
└── util.py              # Utility functions

Documentation

Full documentation is available at https://phytorch.org

Citation

If you use PhyTorch in your research, please cite:

Lei, T., Rizzo, K. T., & Bailey, B. N. (2025). PhoTorch: A robust and generalized
biochemical photosynthesis model fitting package. (In preparation)

Credits

PhyTorch is an extension and reorganization of PhoTorch, developed by:

  • Tong Lei
  • Kyle T. Rizzo
  • Brian N. Bailey

License

PhyTorch is licensed under the GNU General Public License v3.0. See LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contact

For questions or issues, please open an issue on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phytorch_lib-0.1.0.tar.gz (319.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phytorch_lib-0.1.0-py3-none-any.whl (323.2 kB view details)

Uploaded Python 3

File details

Details for the file phytorch_lib-0.1.0.tar.gz.

File metadata

  • Download URL: phytorch_lib-0.1.0.tar.gz
  • Upload date:
  • Size: 319.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for phytorch_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 595052ea042b13b8179b66cd5fc5067f7e212f2b2f043b1ac54d0d6d7cc5393b
MD5 5b226e7f7dc43381973e92602038d1f6
BLAKE2b-256 7d4189b12837314647a736898e29af6ce7cfc44894ace21bb984e4daf4122f05

See more details on using hashes here.

File details

Details for the file phytorch_lib-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: phytorch_lib-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 323.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for phytorch_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8b015711e448f58023fa432dda30ed57360d6110ee1facc537241ecf29e6430
MD5 575a4eb662345bd89efd6e664ce0a7ba
BLAKE2b-256 e5352767c56925bb4c94780593f19826a5f740548baea4b1d6a6aaadb340e31b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page