Skip to content

idaholab/BAHAMAS

Repository files navigation

BAHAMAS

Bayesian and Human Reliability Analysis-Aided Method for the Reliability Analysis of Software (BAHAMAS)

BAHAMAS architecture

Figure: BAHAMAS Bayesian Belief Network (BBN)

BAHAMAS evaluates software failures by tracking defect introduction and defect removal activities across the software development life cycle (SDLC), estimating the defects that remain in the software, and propagating those effects to software failure probability.

Quick Links

Overview

The BAHAMAS Bayesian Belief Network (BBN) includes:

  • Red nodes for defect introduction driven by human error during each SDLC stage
  • Blue nodes for defect removal activities during the SDLC
  • Purple nodes for defect types that remain in the software at each stage
  • Yellow nodes for the defect types remaining after the full SDLC
  • Green nodes for resulting software failure probability

In practical terms, BAHAMAS links SDLC activities, human reliability, defect propagation, and unsafe control actions into a single reliability assessment workflow.

Quick Start

Install

conda create -n bahamas_libs python=3.13
conda activate bahamas_libs
pip install --verbose --editable .

Run the web app

cd app
streamlit run app.py

Run the CLI

conda activate bahamas_libs
cd /path/to/BAHAMAS/examples
python ../bahamas/main.py -i bbn.toml

Installation Details

If you want to install dependencies manually instead of installing the package directly:

pip install toml streamlit==1.35 streamlit-aggrid==1.1.5 numpy>=1.24 pandas==2.3 scipy openpyxl pytest plotly kaleido matplotlib streamlit-option-menu jsonpointer streamlit_extras

You can also install the package in non-editable mode:

pip install --verbose .

Run tests with:

pytest

Usage

Web App

Launch the Streamlit application:

cd app
streamlit run app.py

CLI

Run BAHAMAS from the command line with a TOML input file:

conda activate bahamas_libs
cd /path/to/BAHAMAS/examples
python ../bahamas/main.py -i bbn.toml

Example Input

[BBN]
[BBN.params]
samples = 40000
seed = 2

[BBN.files]
task = "../data/Task_List.xlsx"
defect = "../data/Defect_Data.xlsx"
approx = "../data/sdlc_macro.xlsx"

[BBN.analysis]
type = "precise"

Example Output

CLI screen output
06-Aug-25 09:39:54 BAHAMAS              INFO     Welcome!
06-Aug-25 09:39:54 BAHAMAS              INFO     Input file: ../data/Task_List.xlsx
06-Aug-25 09:39:54 BAHAMAS              WARNING  Default output file ../data/out_Task_List.xlsx will be used
06-Aug-25 09:39:54 BAHAMAS.ODC          INFO     Construct ODC Conditional Distribution for each SDLC stage
06-Aug-25 09:39:54 BAHAMAS.UCA          INFO     Construct UCA ODC defect correlation distribution.
06-Aug-25 09:39:54 BAHAMAS.BBN          INFO     Sampling HEP and DCP
06-Aug-25 09:39:54 BAHAMAS.HEP          INFO     Calculate SDLC "Concept" stage HEP
06-Aug-25 09:39:54 BAHAMAS.DCP          INFO     Calculate DCP for SDLC "Concept" stage
06-Aug-25 09:39:54 BAHAMAS.HEP          INFO     Calculate SDLC "Requirement" stage HEP
06-Aug-25 09:39:54 BAHAMAS.DCP          INFO     Calculate DCP for SDLC "Requirement" stage
06-Aug-25 09:39:54 BAHAMAS.HEP          INFO     Calculate SDLC "Design" stage HEP
06-Aug-25 09:39:54 BAHAMAS.DCP          INFO     Calculate DCP for SDLC "Design" stage
06-Aug-25 09:39:54 BAHAMAS.HEP          INFO     Calculate SDLC "Implementation" stage HEP
06-Aug-25 09:39:54 BAHAMAS.DCP          INFO     Calculate DCP for SDLC "Implementation" stage
06-Aug-25 09:39:54 BAHAMAS.HEP          INFO     Calculate SDLC "Testing" stage HEP
06-Aug-25 09:39:54 BAHAMAS.DCP          INFO     Calculate DCP for SDLC "Testing" stage
06-Aug-25 09:39:54 BAHAMAS.HEP          INFO     Calculate SDLC "Install and Maintenance" stage HEP
06-Aug-25 09:39:54 BAHAMAS.DCP          INFO     Calculate DCP for SDLC "Install and Maintenance" stage
06-Aug-25 09:39:54 BAHAMAS.BBN          INFO     Sampling ODC
06-Aug-25 09:39:54 BAHAMAS.BBN          INFO     Sampling UCA
06-Aug-25 09:39:54 BAHAMAS.BBN          INFO     Compute marginal ODC
06-Aug-25 09:39:54 BAHAMAS.BBN          INFO     BBN Propagation
06-Aug-25 09:39:54 BAHAMAS.BBN          INFO     Compute UCA and total failure probabilities
06-Aug-25 09:39:56 BAHAMAS              INFO     Software total failure: 2.9825182468709206e-05 with std 1.4002568043296736e-05
06-Aug-25 09:39:56 BAHAMAS              INFO     UCA type: UCA-A, Mean: 7.127925281781246e-06, STD: 3.4908455837352817e-06
06-Aug-25 09:39:56 BAHAMAS              INFO     UCA type: UCA-B, Mean: 1.3451519498232246e-05, STD: 6.3548059571775254e-06
06-Aug-25 09:39:56 BAHAMAS              INFO     UCA type: UCA-C, Mean: 4.900300523766049e-06, STD: 2.4943170792606996e-06
06-Aug-25 09:39:56 BAHAMAS              INFO     UCA type: UCA-D, Mean: 4.345437164929662e-06, STD: 2.336590212125128e-06
06-Aug-25 09:39:56 BAHAMAS              INFO      ... Complete!

Plots

SDLC Stage Failure Probabilities Based on Human Error Propagation

SDLC Stage Failure Probabilities Based on Human Error Propagation

Software Orthogonal Defect Classification Failure Probabilities

Software Orthogonal Defect Classification Failure Probabilities

Software Unsafe Control Action Failure Probabilities

Software Unsafe Control Action Failure Probabilities

Total Software Failure Probability

Total Software Failure Probability

Acknowledgement

This code was developed with the assistance of AI tools to aid in code generation, debugging, and optimization. The final implementation has been reviewed and verified by the author to ensure accuracy and adherence to project requirements.

About

BAHAMAS quantifies software reliability and common-cause failures using Bayesian and HRA-aided methods, especially under limited data. It evaluates DI&C system architectures, estimates safety margins, and supports reliability assessments throughout the software development lifecycle.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages