Fmdtools
System Resilience Modelling, Simulation, and Assessment in Python
Install / Use
/learn @nasa/FmdtoolsREADME
Overview
fmdtools (Fault Model Design tools) is a Python library for modelling, simulating, and analyzing the resilience of complex systems. With fmdtools, you can (1) represent system structure and behavior in a model, (2) simulate the dynamic effects of hazardous scenarios on the system, and (3) analyze the results of simulations to understand and improve system resilience.
Click here to view the the full documentation website.
Demo Portfolio
See: Examples
<img src="/docs/_images/tutorial_fmdtools_basics.webp" width="15%"></img> <img src="/docs/_images/demo_proxthreat.webp" width="15%"></img> <img src="/docs/_images/demo_wildfire.webp" width="15%"></img> <img src="/docs/_images/paper_jcise_dsa.webp" width="15%"></img> <img src="/docs/_images/demo_urban_flight.webp" width="15%"></img> <img src="/docs/_images/demo_degradation.webp" width="15%"></img>
About
The fmdtools library provides the computational support needed to perform a simulation-based (rather than document-based) hazard analysis process that enables the consideration of systems resilience. This means that it can be used to extend the scope of hazard analysis from component faults to the dynamic interactions between the system, operators, and the environment. Some key features include:
<img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/flexible.svg">Flexible Modelling Paradigm
Models in fmdtools use a consistent and composable representation of system structure and behavior. Whether you want to model a simple component, a complex system-of-systems, or both, fmdtools can help.
<img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/powerful.svg">Powerful Simulation Techniques
Simulation techniques in fmdtools represent the state-of-the-art in dynamical systems modelling for resilience quantification. With fmdtools, you can simulate the dynamic effects of hazardous scenarios over a wide range of variables to quantify and optimize risk, resilience, and safety metrics.
<img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/efficient.svg">Efficient Analysis Process
Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can easily leverage our existing methods to understand simulation results instead of spending hours implementing your own.
The fmdtools documentation repository is also home to the Functional Reasoning Design Language specification, a graphical language that may be used to represent the structure of behavioral interactions in a system to inform hazard analysis.
Getting Started
Python version compatibility
The fmdtools library is developed in Python 3.13 but is tested to maintain compatibility over three versions of Python. See current doctest reports below:
| Python Version | Doctests |
| -------- | ------- |
| 3.11 | |
| 3.12 |
|
| 3.13 |
|
Further (functional and integration) tests are performed in the Python 3.13 to ensure that examples run as desired. Thus, it is generally recommended to use Python 3.13 with this version to keep pace with development, especially when running examples.
Set up python tooling environment
The fmdtools library was developed to run in a python development environments.
If you do not have an existing python environment, first download and install anaconda or uv.
After the base installation, set up a new Python 3.13 environment for fmdtools and install these external external packages in it:
spyder-kernels
# used for: working with external IDEs
# license: ()
# install from: (comes with anaconda) or `uv pip install spyder-kernels`
jupyter notebook
# used for: repository notebooks
# license: (BSD-3) https://jupyter.org/governance/projectlicense.html
# install from: (comes with anaconda) or `uv pip install jupyter`
graphviz
# used for: plotting graphs using graphviz
# license: (CPL 1.0) https://graphviz.org/license/
# install from: https://anaconda.org/anaconda/graphviz or https://graphviz.org/download/
From there, it can be helpful to install an IDE like VSCode or Spyder.
Note: On Windows, some versions fmdtools dependencies may require a compiler such as that provided with Microsoft Studio Build tools to build, so it (while not required) may be helpful to install it also.
Install fmdtools
For use of fmdtools as an external library, the toolkit can be installed directly from the PyPI package repository using pip install fmdtools.
Editable Development Install
For development as well as interactive use of tutorials and models, we reccomend creating an editable development install.
For this installation, fmdtools can be downloaded from the fmdtools github repository using:
cd /path/to/fmdtools
git clone https://github.com/nasa/fmdtools.git
This may then be installed using:
pip install -e .[all] --group dev
Which will install both fmdtools as well as examples ([all] option) as well as testing and development dependencies (--group dev option)
More guidance on development installations is provided in How to Contribute
Note that this version reflects the latest version on the main git branch along with any local changes. To use a particular version of fmdtools in the context of a development install you can checkout the tag corresponding to the version you want, e.g.:
git checkout v2.3.2
Dependencies
fmdtools requires Python 3.13 and depends directly on the packages below (see requirements.txt). Note that the use of these dependencies is governed by their respective licenses, which may be obtained at the provided links.
scipy
# license: (BSD-new) https://www.scipy.org/scipylib/license.html
tqdm
# license: (mixed MPL/MIT) https://github.com/tqdm/tqdm/blob/master/LICENCE
networkx
# license: (BSD-new) https://raw.githubusercontent.com/networkx/networkx/master/LICENSE.txt
numpy < 2.0
# license: (BSD) https://numpy.org/doc/stable/license.html
matplotlib
# license: (mixed) https://matplotlib.org/stable/users/license.html
pandas[all]
# license: (BSD 3-clause) https://pandas.pydata.org/pandas-docs/stable/getting_started/overview.html#license
ordered-set
# license: (MIT) https://github.com/rspeer/ordered-set/blob/master/MIT-LICENSE
dill
# license: (MIT) https://github.com/uqfoundation/dill/blob/master/LICENSE
recordclass == 0.22.1
# license: (MIT) https://github.com/intellimath/recordclass/blob/main/LICENSE.txt
pytest
# license: (MIT) https://docs.pytest.org/en/7.3.x/license.html
graphviz
# license: (MIT) https://github.com/xflr6/graphviz/blob/master/LICENSE.txt
shapely
# license: (BSD 3-clause) https://github.com/shapely/shapely/blob/main/LICENSE.txt
Since these are direct dependencies, they will be installed automatically along with fmdtools.
Some additional indirect dependencies (listed below) may be needed for development/testing of the code, or for specific notebooks. Thus, to develop/contribute to fmdtools, it can be helpful to install these up-front using pip install packagename. Note that the use of these dependencies is governed by their respective licenses, which may be obtained at the provided links.
deap
# us

