Skip to main content

Public Fault Tree Analyser (PFTA)

Free and open-source fault tree analysis.

  • For rudimentary documentation, see DOCS.md.
  • For an overview of the mathematics, see MATHS.md.
  • For example fault trees, see examples/.

Features

  • Enforces declaration of at least one value of time t.
  • Supports the general fault tree analysis framework where objects can have both a failure probability q(t) and a failure intensity ω(t) (with failure rate λ(t) = ω(t) / (1 − q(t))).
  • Supports Monte Carlo (sampling of distributions) for failure parameters out of the box.

Limitations

  • Does not support negative logic (NOT gates). Only supports coherent fault trees (i.e. those whose logic is reducible to AND gates and OR gates).
  • Does not support common cause failure groups.

Textual input

PFTA reads a textual representation of a fault tree. For example:

- times: 1, 2, 3, 5, 10, 100, 1000
- time_unit: h
- seed: Candley McCandleface
- sample_size: 1000

Gate: CAN
- label: Candlelight fails
- type: OR
- inputs: IGN, EXP, EXT

Gate: IGN
- label: Candle fails to ignite
- type: AND
- inputs: MAT, LTR

Event: MAT
- label: Single match fails to ignite candle
- model_type: Fixed
- probability: triangular(lower=0.1, upper=0.3, mode=0.2)
- intensity: 0

Event: LTR
- label: Lighter fails to ignite candle
- model_type: Fixed
- probability: loguniform(lower=0.001, upper=0.01)
- intensity: 0

Event: EXP
- label: Candle explodes on ignition
- appearance: Undeveloped
- model_type: Fixed
- probability: 0
- intensity: 0

Event: EXT
- label: Candle extinguishes
- model_type: ConstantRate
- mean_failure_time: 3
- mean_repair_time: inf

This allows for text-based version control of a fault tree.

Output

Output files consist of:

  • a table (TSV) of events,
  • a table (TSV) of gates,
  • a table (TSV) of cut sets under each gate, and
  • vector graphics (SVG) for each top gate and paged gate at each value of time.

Nice looking SVG output for the example above.

Installation

$ pip3 install pfta
  • If simply using as a command line tool, do pipx instead of pip3 to avoid having to set up a virtual environment.
  • If using Windows, do pip instead of pip3.

Usage (command line)

$ pfta [-h] [-v] ft.txt

Perform a fault tree analysis.

positional arguments:
  ft.txt         fault tree text file; output is written to `{ft.txt}.out/`

options:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit

Usage (scripting example)

from pfta.core import FaultTree

fault_tree = FaultTree('''
- times: nan

Event: A
- model_type: Fixed
- probability: 0
- intensity: 0.9

Event: B
- model_type: Fixed
- probability: 0.7
- intensity: 0

Event: C
- model_type: Fixed
- probability: 0
- intensity: 1e-4

Gate: AB
- type: AND
- inputs: A, B

Gate: AB_OR_C
- type: OR
- inputs: AB, C
''')

fault_tree.gates[0]
# Gate(id_='AB', is_paged=False, type_=<GateType.AND: 2>, vote_threshold=None, input_ids=['A', 'B'], is_top_gate=False, flattened_indexer=FlattenedIndexer(time_count=1, sample_size=1, flattened_size=1), computed_expression=<...>, computed_probabilities=<...>, computed_intensities=<...>, computed_rates=<...>)

fault_tree.gates[0].computed_rates
# [0.63]

fault_tree.gates[1]
# Gate(id_='AB_OR_C', is_paged=False, type_=<GateType.OR: 1>, vote_threshold=None, input_ids=['AB', 'C'], is_top_gate=True, flattened_indexer=FlattenedIndexer(time_count=1, sample_size=1, flattened_size=1), computed_expression=<...>, computed_probabilities=<...>, computed_intensities=<...>, computed_rates=<...>)

fault_tree.gates[1].computed_rates
# [0.6301]

Licence

Copyright 2025 Conway.
Licensed under the GNU General Public License v3.0 (GPL-3.0-only).
This is free software with NO WARRANTY etc. etc., see LICENSE.

Metadata

Release files for pfta 0.4.0

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

Source distribution (sdist)

Source distribution for pfta 0.4.0
File Size Uploaded Provenance Actions
pfta-0.4.0.tar.gz 45.3 kB With provenance Details for pfta-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 95.3 kB

Release files / pfta-0.4.0.tar.gz

Download URL pfta-0.4.0.tar.gz
Size 45.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7761869508927883fd215da96fa443c85d558685eb8b6b37cfd4ab3495a419c4
BLAKE2b-256 checksum
How to use checksums
65f94cf565e61035b746bcd8270a49de3f56a2150490f289c433eeb31b20b118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 May 19, 2025.

Transparency log

Release files / pfta-0.4.0-py3-none-any.whl

Download URL pfta-0.4.0-py3-none-any.whl
Size 50.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6253b52502c779403f1ebf92310a39f8c27d9bc475b0e1c4ff4182c8d919f0e
BLAKE2b-256 checksum
How to use checksums
227c93357745f669b2a98527c17ab3531392adebf5511c8316c9f1aefd946296
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 May 19, 2025.

Transparency log

Security for pfta 0.4.0

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 pfta-0.4.0.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 May 19, 2025.

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