Tutorials

Incident-based walkthroughs with runnable notebooks.

These tutorials are designed to be practical, reproducible, and physics transparent. Each one links to a notebook that can be run locally with the same API and constants system used in production integrations.

API Reference Tutorials Use Cases README

Quick Start

From installation to first consequence result

Install the package, load materials, select a release scenario, run a source model, then feed that output to dispersion and effect models.

pip install deepsafety

from deepsafety import DeepSafetyClient

client = DeepSafetyClient("http://127.0.0.1:8000")
materials = client.list_materials("gasoline")
scenario = client.select_release_scenario({
    "scenarioType": "worst_case",
    "equipmentType": "tank",
    "inventoryMass": 5000,
    "siteTopography": "urban"
})

Scenario Logic

Realistic vs worst-case vs conservative runs

Deep Safety keeps scenario mode explicit so teams can compare outcomes instead of embedding assumptions inside an opaque controller.

Mode Intent Typical use
realistic_case Best-estimate operating conditions Operational planning and day-to-day risk decisions
worst_case Bounding assumptions Regulatory screening and envelope checks
conservative-analysis Intentional overestimation Safety margin and sensitivity studies

Incident Walkthrough

Buncefield-style vapor cloud workflow

This notebook shows how to configure a tank-overfill style release, build source and dispersion screening outputs, and evaluate blast proxy metrics with explicit assumptions and constants.

Source -> dispersion -> VCE screening
W_TNT = m_fuel * DeltaH_c * eta / DeltaH_TNT
Z = R / W_TNT^(1/3)

Incident Walkthrough

CSB-style toxic release and effect workflow

This notebook demonstrates a toxic release chain using source, Gaussian dispersion, toxic criteria lookup, and probit-based effect estimation for population screening.

Toxic load and response
L_toxic = C^n * t
Y = a + b * ln(L_toxic)
Pr = 0.5 * [1 + erf((Y - 5) / sqrt(2))]

Verification

Change a constant and measure the impact

The tutorial notebooks include a sensitivity section where one constant is overridden per request to show how outputs shift in a controlled and auditable way.

{
  "constants": {
    "fire.default_radiative_fraction": 0.4
  }
}

This pattern is useful for design-margin studies and assumption reviews without forking model code.

Endpoint Workbook

One notebook tour across the full API endpoint surface

A single realistic workbook that walks through materials, scenarios, source terms, dispersion, fire and explosion, health and hygiene, prevention/reactivity/relief, hazard evaluation, and GIS/sign integration in sequence.