Skip to main content

aiphoria logo

GitHub Release GitHub Actions Workflow Status Tests Coverage PyPI Downloads PyPI version GitHub License status

Python package for dynamic wood material flow and carbon stock analysis

aiphoria is an open-source Python package for dynamic material flow analysis (DMFA) of wood. It allows users to follow (among other materials) wood from harvest through processing to products such as buildings, furniture, and paper, and calculates how much carbon these products store over time and when it is released. You describe your system and scenarios in an Excel file, so no programming is needed.

aiphoria builds on ODYM - Open Dynamic Material Systems Model for the stock calculations. It was built for the wood sector, but its core does not depend on wood: wood-specific settings such as carbon content and product lifetimes are input data and can be replaced for any other material.

Features

aiphoria allows you to:

  • Solve flows given as absolute amounts and as shares (%) together in one mass-balanced system, for example production and trade statistics (absolute) linked to end uses (shares)
  • Model in-use stocks with product lifetime distributions, by age cohort, using ODYM
  • Track carbon and other indicators/elements (e.g. dry mass, energy) through flows and stocks, and calculate annual CO2 removals from carbon stocks
  • Run alternative scenarios defined in Excel, with constrained and unconstrained modes
  • Explore results interactively with Sankey diagrams for every year and a network graph of the system, and export all results to Excel and CSV

Use cases

aiphoria is suited for:

  • Wood flow and harvested wood product (HWP) carbon accounts at national or regional scale
  • Temporary carbon storage and stock changes in wood products
  • Scenario analysis at the level of end uses (e.g. more wood in construction, more recycling)
  • Other material systems whose data come as a mix of absolute amounts and shares

Installation

aiphoria requires Python 3.10 or newer. It is available on the Python Package Index (PyPI) and as source code on GitHub.

Install from PyPI

pip install aiphoria

Install from GitHub

pip install git+https://github.com/EuropeanForestInstitute/aiphoria.git

A step-by-step guide, including virtual environments, is in the wiki.

How to use

Run the example

aiphoria comes with an example scenario (a simple sawnwood chain with construction and furniture stocks):

from aiphoria.example import run_example

run_example(remove_existing_output_dir=True)

The results are written to a folder called aiphoria_example in your home directory. Open combined_sankey.html in a web browser to explore the flows year by timestep/ year by year. See the Quick start for what to look at first.

Run your own scenario

Describe your system in an Excel scenario file (start from the example or the empty template, both linked in the wiki) and run:

from aiphoria.runner import run_scenarios

run_scenarios(path_to_settings_file="path/to/scenario/file.xlsx",
              path_to_output_dir="~/scenario_result",
              remove_existing_output_dir=False)

Parameters:

  • path_to_settings_file (str): path to the scenario file
  • path_to_output_dir (str): folder where results are saved. Overrides the output path in the scenario file, which is useful when running several scenarios from a script.
  • remove_existing_output_dir (bool): if True, an existing output folder is deleted first. If False (default) and the folder exists, the run stops with an error.

Documentation

The full documentation is in the GitHub wiki:

  • Getting started: installation, quick start, running your own scenario
  • Concepts: how aiphoria works, processes/flows/stocks, indicators, scenarios and scenario modes
  • Building a scenario file: a reference for every sheet of the Excel file
  • Results: output files and interactive visualizations
  • Help: upgrading from older versions, troubleshooting

Citation

If you use aiphoria, please cite it using the metadata in CITATION.cff (on GitHub: Cite this repository in the right-hand panel). A paper describing aiphoria is under review at the Journal of Open Source Software.

Contributing

Contributions are welcome: bug reports, questions, documentation, example scenarios, tests, and code. See CONTRIBUTING.md for how to get started.

Support

Please report bugs and ask questions in the issue tracker. You can also contact us directly:

Special thanks

A huge thank you to the following people who made aiphoria better:

JOSS review

aiphoria was reviewed for the Journal of Open Source Software (review thread). We warmly thank the reviewers @JakobBD and @paulrougieux, and the editor @ethanwhite, for their careful and constructive feedback. Their comments helped us improve the documentation, dependencies, package structure and code organisation of aiphoria, as well as the paper.

Funding

aiphoria developers / European Forest Institute receive funding from the European Union's Horizon Europe Research and Innovation Programme ForestPaths (ID No 101056755), Monifun (ID No 101134991) and eco2adapt (ID No 101059498).

License

aiphoria is released under the MIT License.

Metadata

Release files for aiphoria 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiphoria 1.1.1
File Size Uploaded Provenance Actions
aiphoria-1.1.1.tar.gz 2.1 MB With provenance Details for aiphoria-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiphoria 1.1.1
File Interpreter ABI Platform Actions
aiphoria-1.1.1-py3-none-any.whl Python 3 none any Details for aiphoria-1.1.1-py3-none-any.whl

Total release size: 4.3 MB

Release files / aiphoria-1.1.1.tar.gz

Download URL aiphoria-1.1.1.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
a45562ac74882ce05ede66d530e93097cc92191b18daeb8503a893434dafddab
BLAKE2b-256 checksum
How to use checksums
42060c2855db72231dac85ff531f4b60c1361dc6bd37536a0968933b4a091068
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Release files / aiphoria-1.1.1-py3-none-any.whl

Download URL aiphoria-1.1.1-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
21b4e02971ade98ca740264cfd6f7b459e8dabec8656facdcc76281cb6ef3861
BLAKE2b-256 checksum
How to use checksums
2a9e34d78bf7f4a18b8ed96a96b839166c951af35d93499f7dcf9582407b6688
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

Security for aiphoria 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aiphoria-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page