fmdtools 2.0.0__tar.gz → 2.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {fmdtools-2.0.0 → fmdtools-2.0.4}/LICENSE +1 -1
  2. {fmdtools-2.0.0/fmdtools.egg-info → fmdtools-2.0.4}/PKG-INFO +48 -20
  3. {fmdtools-2.0.0 → fmdtools-2.0.4}/README.md +45 -17
  4. fmdtools-2.0.4/examples/asg_demo/__init__.py +16 -0
  5. fmdtools-2.0.4/examples/asg_demo/demo_model.py +212 -0
  6. fmdtools-2.0.4/examples/eps/__init__.py +6 -0
  7. fmdtools-2.0.4/examples/eps/eps.py +515 -0
  8. fmdtools-2.0.4/examples/eps/test_eps.py +134 -0
  9. fmdtools-2.0.4/examples/multiflow_demo/__init__.py +6 -0
  10. fmdtools-2.0.4/examples/multiflow_demo/multiflow_demo.py +140 -0
  11. fmdtools-2.0.4/examples/multiflow_demo/test_multiflow.py +92 -0
  12. fmdtools-2.0.4/examples/multirotor/__init__.py +16 -0
  13. fmdtools-2.0.4/examples/multirotor/drone_mdl_dynamic.py +549 -0
  14. fmdtools-2.0.4/examples/multirotor/drone_mdl_hierarchical.py +334 -0
  15. fmdtools-2.0.4/examples/multirotor/drone_mdl_rural.py +961 -0
  16. fmdtools-2.0.4/examples/multirotor/drone_mdl_static.py +809 -0
  17. fmdtools-2.0.4/examples/multirotor/drone_mdl_urban.py +549 -0
  18. fmdtools-2.0.4/examples/multirotor/opt_drone_rural.py +203 -0
  19. fmdtools-2.0.4/examples/multirotor/test_multirotor.py +154 -0
  20. fmdtools-2.0.4/examples/pump/__init__.py +6 -0
  21. fmdtools-2.0.4/examples/pump/ex_pump.py +691 -0
  22. fmdtools-2.0.4/examples/pump/jointfaults_ex.py +44 -0
  23. fmdtools-2.0.4/examples/pump/parallelism_methods.py +200 -0
  24. fmdtools-2.0.4/examples/pump/pump_indiv.py +83 -0
  25. fmdtools-2.0.4/examples/pump/pump_stochastic.py +231 -0
  26. fmdtools-2.0.4/examples/pump/test_pump.py +335 -0
  27. fmdtools-2.0.4/examples/pump/test_pump_example.py +208 -0
  28. fmdtools-2.0.4/examples/pump/test_pump_stochastic.py +297 -0
  29. fmdtools-2.0.4/examples/rover/__init__.py +16 -0
  30. fmdtools-2.0.4/examples/rover/opt_rover.py +75 -0
  31. fmdtools-2.0.4/examples/rover/optimization/ea_analysis.py +35 -0
  32. fmdtools-2.0.4/examples/rover/optimization/search_rover.py +841 -0
  33. fmdtools-2.0.4/examples/rover/optimization/untitled2.py +7 -0
  34. fmdtools-2.0.4/examples/rover/rover_degradation.py +347 -0
  35. fmdtools-2.0.4/examples/rover/rover_mode_space.py +81 -0
  36. fmdtools-2.0.4/examples/rover/rover_model.py +1275 -0
  37. fmdtools-2.0.4/examples/rover/rover_model_human.py +547 -0
  38. fmdtools-2.0.4/examples/rover/test_rover.py +39 -0
  39. fmdtools-2.0.4/examples/tank/__init__.py +16 -0
  40. fmdtools-2.0.4/examples/tank/tank_model.py +477 -0
  41. fmdtools-2.0.4/examples/tank/tank_optimization_model.py +275 -0
  42. fmdtools-2.0.4/examples/tank/test_tank.py +276 -0
  43. fmdtools-2.0.4/examples/taxiway/ATC.py +183 -0
  44. fmdtools-2.0.4/examples/taxiway/asset.py +591 -0
  45. fmdtools-2.0.4/examples/taxiway/common.py +859 -0
  46. fmdtools-2.0.4/examples/taxiway/model.py +235 -0
  47. fmdtools-2.0.4/examples/taxiway/test_asset.py +309 -0
  48. fmdtools-2.0.4/examples/taxiway/test_model.py +95 -0
  49. {fmdtools-2.0.0 → fmdtools-2.0.4}/fmdtools/__init__.py +1 -1
  50. fmdtools-2.0.4/fmdtools/analyze/__init__.py +25 -0
  51. fmdtools-2.0.4/fmdtools/analyze/common.py +521 -0
  52. fmdtools-2.0.4/fmdtools/analyze/graph/__init__.py +23 -0
  53. fmdtools-2.0.4/fmdtools/analyze/graph/base.py +998 -0
  54. fmdtools-2.0.4/fmdtools/analyze/graph/label.py +243 -0
  55. fmdtools-2.0.4/fmdtools/analyze/graph/model.py +392 -0
  56. fmdtools-2.0.4/fmdtools/analyze/graph/style.py +621 -0
  57. fmdtools-2.0.4/fmdtools/analyze/history.py +1182 -0
  58. fmdtools-2.0.4/fmdtools/analyze/phases.py +691 -0
  59. fmdtools-2.0.4/fmdtools/analyze/result.py +1143 -0
  60. fmdtools-2.0.4/fmdtools/analyze/tabulate.py +869 -0
  61. fmdtools-2.0.4/fmdtools/define/__init__.py +26 -0
  62. fmdtools-2.0.4/fmdtools/define/architecture/__init__.py +24 -0
  63. fmdtools-2.0.4/fmdtools/define/architecture/action.py +422 -0
  64. fmdtools-2.0.4/fmdtools/define/architecture/base.py +424 -0
  65. fmdtools-2.0.4/fmdtools/define/architecture/component.py +56 -0
  66. fmdtools-2.0.4/fmdtools/define/architecture/function.py +932 -0
  67. fmdtools-2.0.4/fmdtools/define/architecture/geom.py +222 -0
  68. fmdtools-2.0.4/fmdtools/define/base.py +333 -0
  69. fmdtools-2.0.4/fmdtools/define/block/__init__.py +23 -0
  70. fmdtools-2.0.4/fmdtools/define/block/action.py +101 -0
  71. fmdtools-2.0.4/fmdtools/define/block/base.py +686 -0
  72. fmdtools-2.0.4/fmdtools/define/block/component.py +29 -0
  73. fmdtools-2.0.4/fmdtools/define/block/function.py +262 -0
  74. fmdtools-2.0.4/fmdtools/define/container/__init__.py +24 -0
  75. fmdtools-2.0.4/fmdtools/define/container/base.py +474 -0
  76. fmdtools-2.0.4/fmdtools/define/container/mode.py +619 -0
  77. fmdtools-2.0.4/fmdtools/define/container/parameter.py +228 -0
  78. fmdtools-2.0.4/fmdtools/define/container/rand.py +408 -0
  79. fmdtools-2.0.4/fmdtools/define/container/state.py +365 -0
  80. fmdtools-2.0.4/fmdtools/define/container/time.py +177 -0
  81. fmdtools-2.0.4/fmdtools/define/environment.py +146 -0
  82. fmdtools-2.0.4/fmdtools/define/flow/__init__.py +22 -0
  83. fmdtools-2.0.4/fmdtools/define/flow/base.py +106 -0
  84. fmdtools-2.0.4/fmdtools/define/flow/commsflow.py +283 -0
  85. fmdtools-2.0.4/fmdtools/define/flow/multiflow.py +236 -0
  86. fmdtools-2.0.4/fmdtools/define/object/__init__.py +23 -0
  87. fmdtools-2.0.4/fmdtools/define/object/base.py +973 -0
  88. fmdtools-2.0.4/fmdtools/define/object/coords.py +1364 -0
  89. fmdtools-2.0.4/fmdtools/define/object/geom.py +518 -0
  90. fmdtools-2.0.4/fmdtools/define/object/timer.py +158 -0
  91. fmdtools-2.0.4/fmdtools/sim/__init__.py +23 -0
  92. fmdtools-2.0.4/fmdtools/sim/propagate.py +1242 -0
  93. fmdtools-2.0.4/fmdtools/sim/sample.py +1976 -0
  94. fmdtools-2.0.4/fmdtools/sim/scenario.py +421 -0
  95. fmdtools-2.0.4/fmdtools/sim/search.py +1830 -0
  96. {fmdtools-2.0.0 → fmdtools-2.0.4/fmdtools.egg-info}/PKG-INFO +48 -20
  97. fmdtools-2.0.4/fmdtools.egg-info/SOURCES.txt +103 -0
  98. {fmdtools-2.0.0 → fmdtools-2.0.4}/fmdtools.egg-info/requires.txt +1 -1
  99. {fmdtools-2.0.0 → fmdtools-2.0.4}/pyproject.toml +23 -3
  100. {fmdtools-2.0.0 → fmdtools-2.0.4}/tests/test_graph.py +1 -1
  101. fmdtools-2.0.0/fmdtools.egg-info/SOURCES.txt +0 -13
  102. fmdtools-2.0.0/setup.py +0 -3
  103. {fmdtools-2.0.0 → fmdtools-2.0.4}/examples/__init__.py +0 -0
  104. {fmdtools-2.0.0 → fmdtools-2.0.4}/fmdtools.egg-info/dependency_links.txt +0 -0
  105. {fmdtools-2.0.0 → fmdtools-2.0.4}/fmdtools.egg-info/top_level.txt +0 -0
  106. {fmdtools-2.0.0 → fmdtools-2.0.4}/setup.cfg +0 -0
  107. {fmdtools-2.0.0 → fmdtools-2.0.4}/tests/test_packages.py +0 -0
@@ -1,4 +1,4 @@
1
- fmdtools version 2.0.0
1
+ fmdtools version 2.0.4
2
2
  ---------------------------
3
3
  Apache License
4
4
  Version 2.0, January 2004
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fmdtools
3
- Version: 2.0.0
3
+ Version: 2.0.4
4
4
  Summary: System resilience modelling, simulation, and assessment in Python
5
5
  Author: fmdtools Developers
6
6
  Maintainer-email: Daniel Hulse <daniel.e.hulse@nasa.gov>
7
- License: fmdtools version 2.0.0
7
+ License: fmdtools version 2.0.4
8
8
  ---------------------------
9
9
  Apache License
10
10
  Version 2.0, January 2004
@@ -251,22 +251,24 @@ Requires-Dist: matplotlib>=3.7.0
251
251
  Requires-Dist: pandas
252
252
  Requires-Dist: ordered-set
253
253
  Requires-Dist: dill
254
- Requires-Dist: recordclass>=0.21.1
254
+ Requires-Dist: recordclass==0.22.1
255
255
  Requires-Dist: pytest
256
256
  Requires-Dist: graphviz
257
257
  Requires-Dist: shapely>=2.0
258
258
 
259
- [![fmdtools logo - titanic](/docs/figures/logo/logo-titanic.png)](https://github.com/nasa/fmdtools)
259
+ [![fmdtools logo - titanic](/docs-source/figures/logo/logo-titanic.png)](https://github.com/nasa/fmdtools)
260
260
 
261
261
  # Overview
262
262
 
263
263
  ![Python Version](https://img.shields.io/badge/Python-3.11-blue)
264
264
  [![PyPI](https://img.shields.io/pypi/v/fmdtools)](https://pypi.org/project/fmdtools/)
265
+ [![Total Downloads](https://static.pepy.tech/badge/fmdtools)](https://pepy.tech/project/fmdtools)
266
+ [![Downloads/Month](https://static.pepy.tech/badge/fmdtools/month)](https://pepy.tech/project/fmdtools)
265
267
  [![GitHub release (latest by date)](https://img.shields.io/github/v/release/nasa/fmdtools?label=GitHub%20Release)](https://github.com/nasa/fmdtools/releases)
266
268
  [![GitHub Tag](https://img.shields.io/github/v/tag/nasa/fmdtools)](https://github.com/nasa/fmdtools/tags)
267
269
  [![CodeFactor](https://www.codefactor.io/repository/github/nasa/fmdtools/badge)](https://www.codefactor.io/repository/github/nasa/fmdtools)
268
- [![Tests Status](./tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/junit/report.html)
269
- [![Tests Coverage](./coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/coverage/index.html)
270
+ [![Tests Status](./reports/full-py311/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/junit/report.html)
271
+ [![Tests Coverage](./reports/full-py311/coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/coverage/index.html)
270
272
  [![GitHub License](https://img.shields.io/badge/License-Apache%202.0-green)](https://github.com/nasa/fmdtools/blob/main/LICENSE)
271
273
  [![NASA Software Classification](https://img.shields.io/badge/Software_Class-E-blue)](https://nodis3.gsfc.nasa.gov/displayDir.cfm?Internal_ID=N_PR_7150_002D_&page_name=AppendixD)
272
274
 
@@ -274,21 +276,22 @@ Requires-Dist: shapely>=2.0
274
276
 
275
277
  [Click here to view the the full documentation website.](https://nasa.github.io/fmdtools)
276
278
 
279
+
277
280
  ## About
278
281
 
279
- 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**](https://nasa.github.io/fmdtools/docs/Development%20Guide.html#why-fmdtools). 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:
282
+ 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**](https://nasa.github.io/fmdtools/docs-source/Development%20Guide.html#why-fmdtools). 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:
280
283
 
281
- <img align="left" width="100" height="100" src="/docs/figures/powerpoint/flexible.svg">
284
+ <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/flexible.svg">
282
285
 
283
286
  ### Flexible Modelling Paradigm
284
287
  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.
285
288
 
286
- <img align="left" width="100" height="100" src="/docs/figures/powerpoint/powerful.svg">
289
+ <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/powerful.svg">
287
290
 
288
291
  ### Powerful Simulation Techniques
289
292
  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.
290
293
 
291
- <img align="left" width="100" height="100" src="/docs/figures/powerpoint/efficient.svg">
294
+ <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/efficient.svg">
292
295
 
293
296
  ### Efficient Analysis Process
294
297
  Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can write 2-3 lines of code to visualize model behavior instead of spending hours writing it yourself.
@@ -297,6 +300,18 @@ Readily-deployable analysis methods are built in to fmdtools to enable the rapid
297
300
 
298
301
  ## Getting Started
299
302
 
303
+ ### Python version compatibility
304
+
305
+ The fmdtools library is developed in Python 3.11 but tested to maintain compatibility over three versions of Python. See current doctest reports below:
306
+
307
+ | Python Version | Doctests |
308
+ | -------- | ------- |
309
+ | 3.10 | [![Python 3.10 Tests](./reports/doctests-py310/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/doctests-py310/junit/report.html) |
310
+ | 3.11 | [![Python 3.11 Tests](./reports/doctests-py311/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/doctests-py311/junit/report.html) |
311
+ | 3.12 | [![Python 3.12 Tests](./reports/doctests-py312/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/doctests-py312/junit/report.html) |
312
+
313
+ Further (functional and integration) tests are performed in the Python 3.11 to ensure that examples run as desired. Thus, it is generally reccommended to use Python 3.11 to keep pace with development, especially when running examples.
314
+
300
315
  ### Set up python environment
301
316
 
302
317
  The fmdtools library was developed to run in an anaconda python environment. If you do not have an existing python environment, first [download and install anaconda.](https://docs.anaconda.com/free/anaconda/install/index.html).
@@ -314,21 +329,34 @@ graphviz
314
329
  # install from: https://anaconda.org/anaconda/graphviz
315
330
  ```
316
331
 
332
+ Note: On Windows, some versions `fmdtools` dependencies may require a compiler such as that provided with [Microsoft Studio Build tools](https://visualstudio.microsoft.com/downloads/?q=build+tools) to build, so it (while not required) may be helpful to install it also.
333
+
334
+
317
335
  ### Install fmdtools
318
336
 
319
- The latest public version of fmdtools can be downloaded from the [fmdtools github repository](https://github.com/nasa/fmdtools/) e.g., using:
337
+ For use of fmdtools as an external library, the toolkit can be installed directly from the [PyPI package repository](https://pypi.org/project/fmdtools/) using ``pip install fmdtools``.
338
+
339
+ #### Editable Development Install
340
+
341
+ For development as well as interactive use of tutorials and models, we reccomend creating an editable development install.
342
+
343
+ For this installation, fmdtools can be downloaded from the [fmdtools github repository](https://github.com/nasa/fmdtools/) using:
320
344
 
321
345
  ```
322
346
  git clone https://github.com/nasa/fmdtools.git
323
347
  ```
324
-
325
- For development and use of this version (e.g., for tutorials and models), we recommended installing this package using `pip`:
348
+
349
+ This may then be installed using:
326
350
 
327
351
  ```
328
352
  pip install -e "/path/to/fmdtools"
329
353
  ```
330
354
 
331
- A version of the fmdtools toolkit can also be installed directly from the [PyPI package repository](https://pypi.org/project/fmdtools/) using ``pip install fmdtools``.
355
+ 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`` you can checkout the tag corresponding to the version you want, e.g.:
356
+
357
+ ```
358
+ git checkout v2.0.4
359
+ ```
332
360
 
333
361
 
334
362
  #### Dependencies
@@ -352,7 +380,7 @@ ordered-set
352
380
  # license: (MIT) https://github.com/rspeer/ordered-set/blob/master/MIT-LICENSE
353
381
  dill
354
382
  # license: (MIT) https://github.com/uqfoundation/dill/blob/master/LICENSE
355
- recordclass == 0.21.1
383
+ recordclass == 0.22.1
356
384
  # license: (MIT) https://github.com/intellimath/recordclass/blob/main/LICENSE.txt
357
385
  pytest
358
386
  # license: (MIT) https://docs.pytest.org/en/7.3.x/license.html
@@ -420,13 +448,13 @@ If a development install has been performed, you can further check aspects of yo
420
448
 
421
449
  Once fmdtools is installed, use the following to get acquainted with how to use the library:
422
450
 
423
- - Go through the [Intro to fmdtools workshop](https://nasa.github.io/fmdtools/docs/Intro_to_fmdtools.html) to learn about some of the basics of the fmdtools library and work with an existing model.
451
+ - Go through the [Intro to fmdtools workshop](https://nasa.github.io/fmdtools/docs-source/Intro_to_fmdtools.html) to learn about some of the basics of the fmdtools library and work with an existing model.
424
452
 
425
453
  - Explore more [examples](https://nasa.github.io/fmdtools/examples/Examples.html) of particular use-cases by going through the [examples folder](https://github.com/nasa/fmdtools/tree/main/examples)
426
454
 
427
- - Read about contributions and model development best practices by perusing the [Development Guide](https://nasa.github.io/fmdtools/docs/Development%20Guide.html#).
455
+ - Read about contributions and model development best practices by perusing the [Development Guide](https://nasa.github.io/fmdtools/docs-source/Development%20Guide.html#).
428
456
 
429
- - Explore the searchable [module reference](https://nasa.github.io/fmdtools/docs/fmdtools.html) for syntax and usage documentation.
457
+ - Explore the searchable [module reference](https://nasa.github.io/fmdtools/docs-source/fmdtools.html) for syntax and usage documentation.
430
458
 
431
459
  ## Contributions
432
460
  fmdtools is developed primarily by researchers at NASA Ames Research Center. External contributions are welcome under a Contributor License Agreement:
@@ -465,8 +493,8 @@ To cite a particular version of the fmdtools, you may use:
465
493
  author = {{NASA}},
466
494
  title = {fmdtools},
467
495
  url = {https://github.com/nasa/fmdtools},
468
- version = {2.0.0}, # <- replace with your version number
469
- date = {2024-08-22},
496
+ version = {2.0.4}, # <- replace with your version number
497
+ date = {2024-10-25},
470
498
  }
471
499
  ```
472
500
 
@@ -1,14 +1,16 @@
1
- [![fmdtools logo - titanic](/docs/figures/logo/logo-titanic.png)](https://github.com/nasa/fmdtools)
1
+ [![fmdtools logo - titanic](/docs-source/figures/logo/logo-titanic.png)](https://github.com/nasa/fmdtools)
2
2
 
3
3
  # Overview
4
4
 
5
5
  ![Python Version](https://img.shields.io/badge/Python-3.11-blue)
6
6
  [![PyPI](https://img.shields.io/pypi/v/fmdtools)](https://pypi.org/project/fmdtools/)
7
+ [![Total Downloads](https://static.pepy.tech/badge/fmdtools)](https://pepy.tech/project/fmdtools)
8
+ [![Downloads/Month](https://static.pepy.tech/badge/fmdtools/month)](https://pepy.tech/project/fmdtools)
7
9
  [![GitHub release (latest by date)](https://img.shields.io/github/v/release/nasa/fmdtools?label=GitHub%20Release)](https://github.com/nasa/fmdtools/releases)
8
10
  [![GitHub Tag](https://img.shields.io/github/v/tag/nasa/fmdtools)](https://github.com/nasa/fmdtools/tags)
9
11
  [![CodeFactor](https://www.codefactor.io/repository/github/nasa/fmdtools/badge)](https://www.codefactor.io/repository/github/nasa/fmdtools)
10
- [![Tests Status](./tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/junit/report.html)
11
- [![Tests Coverage](./coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/coverage/index.html)
12
+ [![Tests Status](./reports/full-py311/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/junit/report.html)
13
+ [![Tests Coverage](./reports/full-py311/coverage-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/full-py311/coverage/index.html)
12
14
  [![GitHub License](https://img.shields.io/badge/License-Apache%202.0-green)](https://github.com/nasa/fmdtools/blob/main/LICENSE)
13
15
  [![NASA Software Classification](https://img.shields.io/badge/Software_Class-E-blue)](https://nodis3.gsfc.nasa.gov/displayDir.cfm?Internal_ID=N_PR_7150_002D_&page_name=AppendixD)
14
16
 
@@ -16,21 +18,22 @@
16
18
 
17
19
  [Click here to view the the full documentation website.](https://nasa.github.io/fmdtools)
18
20
 
21
+
19
22
  ## About
20
23
 
21
- 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**](https://nasa.github.io/fmdtools/docs/Development%20Guide.html#why-fmdtools). 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:
24
+ 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**](https://nasa.github.io/fmdtools/docs-source/Development%20Guide.html#why-fmdtools). 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:
22
25
 
23
- <img align="left" width="100" height="100" src="/docs/figures/powerpoint/flexible.svg">
26
+ <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/flexible.svg">
24
27
 
25
28
  ### Flexible Modelling Paradigm
26
29
  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.
27
30
 
28
- <img align="left" width="100" height="100" src="/docs/figures/powerpoint/powerful.svg">
31
+ <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/powerful.svg">
29
32
 
30
33
  ### Powerful Simulation Techniques
31
34
  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.
32
35
 
33
- <img align="left" width="100" height="100" src="/docs/figures/powerpoint/efficient.svg">
36
+ <img align="left" width="100" height="100" src="/docs-source/figures/powerpoint/efficient.svg">
34
37
 
35
38
  ### Efficient Analysis Process
36
39
  Readily-deployable analysis methods are built in to fmdtools to enable the rapid and iterative statistical analysis of simulation results. With fmdtools, you can write 2-3 lines of code to visualize model behavior instead of spending hours writing it yourself.
@@ -39,6 +42,18 @@ Readily-deployable analysis methods are built in to fmdtools to enable the rapid
39
42
 
40
43
  ## Getting Started
41
44
 
45
+ ### Python version compatibility
46
+
47
+ The fmdtools library is developed in Python 3.11 but tested to maintain compatibility over three versions of Python. See current doctest reports below:
48
+
49
+ | Python Version | Doctests |
50
+ | -------- | ------- |
51
+ | 3.10 | [![Python 3.10 Tests](./reports/doctests-py310/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/doctests-py310/junit/report.html) |
52
+ | 3.11 | [![Python 3.11 Tests](./reports/doctests-py311/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/doctests-py311/junit/report.html) |
53
+ | 3.12 | [![Python 3.12 Tests](./reports/doctests-py312/tests-badge.svg)](https://htmlpreview.github.io/?https://github.com/nasa/fmdtools/blob/main/reports/doctests-py312/junit/report.html) |
54
+
55
+ Further (functional and integration) tests are performed in the Python 3.11 to ensure that examples run as desired. Thus, it is generally reccommended to use Python 3.11 to keep pace with development, especially when running examples.
56
+
42
57
  ### Set up python environment
43
58
 
44
59
  The fmdtools library was developed to run in an anaconda python environment. If you do not have an existing python environment, first [download and install anaconda.](https://docs.anaconda.com/free/anaconda/install/index.html).
@@ -56,21 +71,34 @@ graphviz
56
71
  # install from: https://anaconda.org/anaconda/graphviz
57
72
  ```
58
73
 
74
+ Note: On Windows, some versions `fmdtools` dependencies may require a compiler such as that provided with [Microsoft Studio Build tools](https://visualstudio.microsoft.com/downloads/?q=build+tools) to build, so it (while not required) may be helpful to install it also.
75
+
76
+
59
77
  ### Install fmdtools
60
78
 
61
- The latest public version of fmdtools can be downloaded from the [fmdtools github repository](https://github.com/nasa/fmdtools/) e.g., using:
79
+ For use of fmdtools as an external library, the toolkit can be installed directly from the [PyPI package repository](https://pypi.org/project/fmdtools/) using ``pip install fmdtools``.
80
+
81
+ #### Editable Development Install
82
+
83
+ For development as well as interactive use of tutorials and models, we reccomend creating an editable development install.
84
+
85
+ For this installation, fmdtools can be downloaded from the [fmdtools github repository](https://github.com/nasa/fmdtools/) using:
62
86
 
63
87
  ```
64
88
  git clone https://github.com/nasa/fmdtools.git
65
89
  ```
66
-
67
- For development and use of this version (e.g., for tutorials and models), we recommended installing this package using `pip`:
90
+
91
+ This may then be installed using:
68
92
 
69
93
  ```
70
94
  pip install -e "/path/to/fmdtools"
71
95
  ```
72
96
 
73
- A version of the fmdtools toolkit can also be installed directly from the [PyPI package repository](https://pypi.org/project/fmdtools/) using ``pip install fmdtools``.
97
+ 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`` you can checkout the tag corresponding to the version you want, e.g.:
98
+
99
+ ```
100
+ git checkout v2.0.4
101
+ ```
74
102
 
75
103
 
76
104
  #### Dependencies
@@ -94,7 +122,7 @@ ordered-set
94
122
  # license: (MIT) https://github.com/rspeer/ordered-set/blob/master/MIT-LICENSE
95
123
  dill
96
124
  # license: (MIT) https://github.com/uqfoundation/dill/blob/master/LICENSE
97
- recordclass == 0.21.1
125
+ recordclass == 0.22.1
98
126
  # license: (MIT) https://github.com/intellimath/recordclass/blob/main/LICENSE.txt
99
127
  pytest
100
128
  # license: (MIT) https://docs.pytest.org/en/7.3.x/license.html
@@ -162,13 +190,13 @@ If a development install has been performed, you can further check aspects of yo
162
190
 
163
191
  Once fmdtools is installed, use the following to get acquainted with how to use the library:
164
192
 
165
- - Go through the [Intro to fmdtools workshop](https://nasa.github.io/fmdtools/docs/Intro_to_fmdtools.html) to learn about some of the basics of the fmdtools library and work with an existing model.
193
+ - Go through the [Intro to fmdtools workshop](https://nasa.github.io/fmdtools/docs-source/Intro_to_fmdtools.html) to learn about some of the basics of the fmdtools library and work with an existing model.
166
194
 
167
195
  - Explore more [examples](https://nasa.github.io/fmdtools/examples/Examples.html) of particular use-cases by going through the [examples folder](https://github.com/nasa/fmdtools/tree/main/examples)
168
196
 
169
- - Read about contributions and model development best practices by perusing the [Development Guide](https://nasa.github.io/fmdtools/docs/Development%20Guide.html#).
197
+ - Read about contributions and model development best practices by perusing the [Development Guide](https://nasa.github.io/fmdtools/docs-source/Development%20Guide.html#).
170
198
 
171
- - Explore the searchable [module reference](https://nasa.github.io/fmdtools/docs/fmdtools.html) for syntax and usage documentation.
199
+ - Explore the searchable [module reference](https://nasa.github.io/fmdtools/docs-source/fmdtools.html) for syntax and usage documentation.
172
200
 
173
201
  ## Contributions
174
202
  fmdtools is developed primarily by researchers at NASA Ames Research Center. External contributions are welcome under a Contributor License Agreement:
@@ -207,8 +235,8 @@ To cite a particular version of the fmdtools, you may use:
207
235
  author = {{NASA}},
208
236
  title = {fmdtools},
209
237
  url = {https://github.com/nasa/fmdtools},
210
- version = {2.0.0}, # <- replace with your version number
211
- date = {2024-08-22},
238
+ version = {2.0.4}, # <- replace with your version number
239
+ date = {2024-10-25},
212
240
  }
213
241
  ```
214
242
 
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Copyright © 2024, United States Government, as represented by the Administrator
5
+ of the National Aeronautics and Space Administration. All rights reserved.
6
+
7
+ The “"Fault Model Design tools - fmdtools version 2"” software is licensed
8
+ under the Apache License, Version 2.0 (the "License"); you may not use this
9
+ file except in compliance with the License. You may obtain a copy of the
10
+ License at http://www.apache.org/licenses/LICENSE-2.0.
11
+
12
+ Unless required by applicable law or agreed to in writing, software distributed
13
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
15
+ specific language governing permissions and limitations under the License.
16
+ """
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ Copyright © 2024, United States Government, as represented by the Administrator
5
+ of the National Aeronautics and Space Administration. All rights reserved.
6
+
7
+ The “"Fault Model Design tools - fmdtools version 2"” software is licensed
8
+ under the Apache License, Version 2.0 (the "License"); you may not use this
9
+ file except in compliance with the License. You may obtain a copy of the
10
+ License at http://www.apache.org/licenses/LICENSE-2.0.
11
+
12
+ Unless required by applicable law or agreed to in writing, software distributed
13
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
15
+ specific language governing permissions and limitations under the License.
16
+ """
17
+
18
+ from fmdtools.define.container.mode import Mode
19
+ from fmdtools.define.block.function import Function
20
+ from fmdtools.define.block.action import Action
21
+ from fmdtools.define.architecture.action import ActionArchitecture
22
+ from fmdtools.define.architecture.function import FunctionArchitecture
23
+ from fmdtools.define.container.state import State
24
+ from fmdtools.define.flow.base import Flow
25
+
26
+
27
+ class OutcomeStates(State):
28
+ """State tracking the number of actions and perceptions performed."""
29
+
30
+ num_perceptions: int = 0
31
+ num_actions: int = 0
32
+
33
+
34
+ class Outcome(Flow):
35
+
36
+ __slots__ = ()
37
+ container_s = OutcomeStates
38
+
39
+
40
+ class HazardState(State):
41
+ """Whether a hazard is present, percieved, or mitigated by the human."""
42
+
43
+ present: bool = False
44
+ percieved: bool = False
45
+ mitigated: bool = False
46
+
47
+
48
+ class Hazard(Flow):
49
+
50
+ __slots__ = ()
51
+ container_s = HazardState
52
+
53
+
54
+ class ActionMode(Mode):
55
+ fm_args = ('failed', 'unable')
56
+ mode: str = 'nominal'
57
+ exclusive = True
58
+
59
+
60
+ class Perceive(Action):
61
+ """A user's perception abilities/behaviors for percieving the hazard."""
62
+
63
+ __slots__ = ('hazard', 'outcome')
64
+ container_m = ActionMode
65
+ flow_hazard = Hazard
66
+ flow_outcome = Outcome
67
+
68
+ def behavior(self, time):
69
+ if not self.m.in_mode('failed', 'unable'):
70
+ self.hazard.s.percieved = self.hazard.s.present
71
+ self.outcome.s.num_perceptions += self.hazard.s.percieved
72
+ else:
73
+ self.hazard.s.percieved = False
74
+ self.m.remove_fault('failed', 'nom')
75
+
76
+ def percieved(self):
77
+ return self.hazard.s.percieved
78
+
79
+
80
+ class Act(Action):
81
+ """User actions to mitigate the hazard."""
82
+
83
+ __slots__ = ('hazard', 'outcome')
84
+ container_m = ActionMode
85
+ flow_hazard = Hazard
86
+ flow_outcome = Outcome
87
+
88
+ def behavior(self, time):
89
+ if not self.m.in_mode('failed', 'unable'):
90
+ self.outcome.s.num_actions += 1
91
+ self.hazard.s.mitigated = True
92
+ elif self.m.in_mode('failed'):
93
+ self.hazard.s.mitigated = False
94
+ self.m.remove_fault('failed', 'nom')
95
+ else:
96
+ self.hazard.s.mitigated = False
97
+
98
+ def acted(self):
99
+ return not self.m.in_mode('failed')
100
+
101
+
102
+ class Done(Action):
103
+ """User state after performing the action."""
104
+
105
+ __slots__ = ('hazard')
106
+ flow_hazard = Hazard
107
+
108
+ def behavior(self, time):
109
+ if not self.hazard.s.present:
110
+ self.hazard.s.mitigated = False
111
+
112
+ def ready(self):
113
+ return not self.hazard.s.present
114
+
115
+
116
+ class Human(ActionArchitecture):
117
+ """Overall human action sequence graph specifying what the user will do when."""
118
+ initial_action = "perceive"
119
+
120
+ def init_architecture(self, *args, **kwargs):
121
+ # flows from external fxn/model can be defined here,
122
+ self.add_flow("hazard", Hazard)
123
+ # along with flows internal to the ASG class
124
+ self.add_flow("outcome", fclass=Outcome)
125
+
126
+ self.add_act("perceive", Perceive, "outcome", "hazard")
127
+ self.add_act("act", Act, "outcome", "hazard")
128
+ self.add_act("done", Done, "hazard")
129
+
130
+ self.add_cond("perceive", "act", "percieved", self.acts['perceive'].percieved)
131
+ self.add_cond("act", "done", "acted", self.acts['act'].acted)
132
+ self.add_cond("done", "perceive", "ready", self.acts['done'].ready)
133
+
134
+
135
+ class DetectHazard(Function):
136
+ """Function containing the human."""
137
+
138
+ __slots__ = ('hazard')
139
+ container_m = Mode
140
+ arch_aa = Human
141
+ flow_hazard = Hazard
142
+
143
+
144
+ class ProduceHazard(Function):
145
+ """Function producing Hazards."""
146
+
147
+ __slots__ = ('hazard',)
148
+ flow_hazard = Hazard
149
+
150
+ def dynamic_behavior(self, time):
151
+ if not time % 4:
152
+ self.hazard.s.present = True
153
+ else:
154
+ self.hazard.s.present = False
155
+
156
+
157
+ class PassStates(State):
158
+ """Whether or not the hazard is ultimately passed or mitigated."""
159
+
160
+ hazards_mitigated: int = 0
161
+ hazards_propagated: int = 0
162
+
163
+
164
+ class PassHazard(Function):
165
+ """Accumulates total hazards/mitigations."""
166
+
167
+ __slots__ = ('hazard',)
168
+ container_s = PassStates
169
+ flow_hazard = Hazard
170
+
171
+ def dynamic_behavior(self, time):
172
+ if self.hazard.s.present and self.hazard.s.mitigated:
173
+ self.s.hazards_mitigated += 1
174
+ elif self.hazard.s.present and not self.hazard.s.mitigated:
175
+ self.s.hazards_propagated += 1
176
+
177
+
178
+ class HazardModel(FunctionArchitecture):
179
+ """Overall model of the human in context."""
180
+
181
+ __slots__ = ()
182
+ default_sp = dict(end_time=60, dt=1.0)
183
+
184
+ def init_architecture(self, **kwargs):
185
+ self.add_flow("hazard", Hazard)
186
+ self.add_fxn("produce_hazard", ProduceHazard, 'hazard')
187
+ self.add_fxn("detect_hazard", DetectHazard, 'hazard')
188
+ self.add_fxn("pass_hazard", PassHazard, 'hazard')
189
+
190
+
191
+ if __name__ == '__main__':
192
+ import fmdtools.sim.propagate as prop
193
+ mdl = HazardModel()
194
+ result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard',
195
+ 'act_unable', time=4,
196
+ desired_result='graph')
197
+ result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard',
198
+ 'perceive_failed', time=4,
199
+ desired_result='graph')
200
+
201
+ result_fault.graph.draw()
202
+ ex_fxn = DetectHazard('detect_hazard')
203
+ result_indiv, hist_indiv = prop.nominal(ex_fxn,
204
+ disturbances={5:{'aa.flows.hazard.s.present':True}})
205
+ fig, axs = hist_indiv.plot_line('aa.flows.hazard.s.present',
206
+ 'aa.flows.hazard.s.percieved',
207
+ 'aa.flows.hazard.s.mitigated', figsize=(10,5))
208
+
209
+ result_fault, mdlhist_fault = prop.one_fault(mdl, 'detect_hazard',
210
+ 'perceive_failed', time=4,
211
+ desired_result='graph.fxns.detect_hazard.aa')
212
+ result_fault.graph.fxns.detect_hazard.aa.draw_graphviz(layout='dot')
@@ -0,0 +1,6 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Tue May 16 12:44:04 2023
4
+
5
+ @author: dhulse
6
+ """