FeedbackMachine
Model environmental feedback loops in Life Cycle Assessment — dynamically and prospectively — on top of Brightway, bw_timex and premise.
Life Cycle Assessment has traditionally relied on a strict separation between the environment and the economy. This package breaks this boundary to compute feedback-aware CF: emissions trigger environmental mechanisms, which in turn generate feedback flows back to the technosphere, closing the loop.
FeedbackMachine operationalizes this idea. An elementary flow acts as an initial
perturbation (analogous to a functional-unit demand), and the package propagates
its feedbacks through time, producing a time-resolved, characterized inventory. It
rigorously separates endogenous effects (attributable to the initial emission)
from exogenous system dynamics using partial derivatives within a matrix-based
LCA formulation, which lets multiple feedback loops interact consistently.
This package is introduced and supported by the academic publication: FeedbackMachine: A general computing framework for feedback-aware LCA characterization factors (Jouannais. P, under review)
The demonstration example in the publication is supported by examples/demonstration_two_feedbacks_pGWP.ipynb.
Installation
pip install FeedbackMachine
or, from source:
git clone https://github.com/PJGilmw/FeedbackMachine.git
cd FeedbackMachine
pip install -e .
To also build prospective background databases with premise (heavy, and gated by a key you request from the premise authors):
pip install -e ".[prospective]"
For development (tests):
pip install -e ".[dev]"
Requirements
- Python ≥ 3.10
- A Brightway 2.5 project (
bw2data,bw2calc), with a biosphere database and, for realistic use, ecoinvent and premise-built prospective databases. bw_timex,bw_temporalis,dynamic_characterization>1.4.2 for the dynamic/temporal inventory and characterization.
premise is an optional dependency: it is only needed to generate the
prospective background databases and requires a decryption key (email
romain.sacchi@psi.ch).
Quickstart
import logging
import FeedbackMachine as fb
logging.basicConfig(level=logging.INFO) # optional: see propagation progress
# 1. Response / modulation models (how the technosphere responds to drivers)
registry = fb.ModelRegistry()
# ... register fb.ExactModel(...) / fb.build_nd_rbf_from_samples(...) ...
# 2. Driver/demand time-patterns (how a driver or induced demand evolves over
# time after an emission)
lookup = fb.PatternLookup(patterns, param_points=points, param_names=names)
# 3. Assemble the full input dictionary (settings + feedbacks) and run
machine = fb.FeedbackMachine(dict_feedbacks)
machine.propagate()
# 4. Assemble and characterize the total impact
machine.prepare_computation_total_feedback_impact()
machine.compute_impact_feedback_dynamic(perturbation_amount, metric, method)
See the full worked example — including building the initialization databases,
response functions, exogenous trajectories, and premise prospective databases —
in examples/demonstration_quickstart.ipynb.
The demonstration example in the publication is supported by examples/demonstration_two_feedbacks_pGWP.ipynb. The healthcare sector are computed with
examples/exiobase_health_FR_air_emissions.ipynb
Examples
The examples/ folder contains notebooks:
-
demonstration_quickstart.ipynb— minimal single-feedback run. -
demonstration_two_feedbacks_pGWP.ipynb— the two-feedbacks case with prospective pGWP characterization (MESSAGE SSP2-4.5). -
demonstration_batch_parallel.ipynb— running scenario batches in parallel with Ray (pip install "FeedbackMachine[parallel]"). -
verification_trivial_cases.ipynb— hand-solvable regression checks. -
explore_coupling_matrix.ipynb— step-by-step walk-through of the coupling matrix built inFeedbackMachine.propagate(). -
exiobase_health_FR_air_emissions.ipynb— derives the EXIOBASE emission profile used in the two-feedbacks examples (results inexiobase_health_FR_results/).
Most notebooks need a Brightway project with ecoinvent and premise databases, and some read external input data (temperature trajectories, REMIND scenarios, yield sensitivities) from local paths that you must adapt.
Public API
Engine:
FeedbackMachine— propagate feedbacks and assemble the total impact.FeedbackMatrixGenerator— build the per-time-step temporalized feedback database.
Response / modulation utilities:
create_curve,make_derivativeExactModel,NDRBFModel,build_nd_rbf_from_samplesModelRegistryPatternLookupnumerical_partial,finite_difference_partial,check_partial_consistency
Project / batch utilities (for running independent scenario batches in
parallel processes/kernels — see project_batches.py's module docstring for
why each process needs its own Brightway project, not a shared one):
create_project_copies,setup_project_batches— make N independent copies of a Brightway project (viabw2data's owncopy_project), one per worker process/kernel.estimate_project_size— check a project's on-disk size before copying.merge_batch_results— combine multiple pickled per-batch result dicts into one, detecting keys that collide across batches.delete_project_copies— clean up batch project copies afterward.
Tests
The response/modulation utilities are covered by a Brightway-free test suite:
pytest
Citation & references
If you use this package, please cite the underlying academic works.
License
BSD 3-Clause. See LICENSE.
Metadata
Release files for FeedbackMachine 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| feedbackmachine-0.1.1.tar.gz | 112.0 kB | With provenance | Details for feedbackmachine-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| feedbackmachine-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for feedbackmachine-0.1.1-py3-none-any.whl |
Total release size: 208.8 kB
Release files / feedbackmachine-0.1.1.tar.gz
| Download URL | feedbackmachine-0.1.1.tar.gz |
|---|---|
| Size | 112.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
010741c6daf4d472bb3969b06b54aea827591f81ff93172339b831fbd11840d0
|
|
BLAKE2b-256 checksum How to use checksums |
1d2380cd71101f9a96fb2a60bd46554b571f4e69f80e38ddcb9a8d4865500af8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 30, 2026.
Transparency logRelease files / feedbackmachine-0.1.1-py3-none-any.whl
| Download URL | feedbackmachine-0.1.1-py3-none-any.whl |
|---|---|
| Size | 96.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbd5af03790254b23a104c8455a0e1c57e3783f313821e6841d446a9b67bab96
|
|
BLAKE2b-256 checksum How to use checksums |
977ad20ab58e2f7e7fa77b657596b0eaa0caacffc0867261a195b124f3c523ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 30, 2026.
Transparency logSecurity for FeedbackMachine 0.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.
Attestation for feedbackmachine-0.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 Nov 30, 2026.
Transparency logA 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.