Generating Fragility Curves for Seismic Risk Assessment

In the field of performance-based earthquake engineering, fragility curves are indispensable tools. These probabilistic functions describe the likelihood that a structure or component will exceed a certain damage state when subjected to varying levels of seismic intensity—typically measured using Spectral Acceleration (Sa) or Peak Ground Acceleration (PGA).

At QuakeLogic, we help researchers, engineers, and emergency planners develop and automate fragility analysis as part of seismic resilience studies. This blog post introduces a fully open-source Python script developed by our team that reads structural response data and generates fragility curves for multiple damage states.

What Are Fragility Curves?

A fragility curve is a cumulative distribution function (CDF) that defines the conditional probability:

P(Damage ≥ State | Intensity Measure)

This means that, for a given level of shaking (e.g., 0.3g Sa), the curve tells you the probability that a structure will exceed a limit-state such as Moderate or Complete damage.

We typically use lognormal distributions to model fragility because they capture the exponential rise in damage probability with increasing shaking intensity.

Engineering Demand Parameters (EDPs) and Intensity Measures (IMs)

In seismic fragility analysis, the relationship is between:

  • EDP (Engineering Demand Parameter): A measurable response of the structure.
  • IM (Intensity Measure): A scalar value representing the strength of ground shaking.

Common EDPs:

  • Maximum interstory drift ratio (MIDR) – most widely used for buildings
  • Peak floor acceleration
  • Residual drift
  • Relative displacement
  • Roof displacement
  • Member strains or rotations (for local component fragility)

Common IMs:

  • PGA (Peak Ground Acceleration)
  • Sa(T1) – Spectral acceleration at fundamental period (T1)
  • PGV (Peak Ground Velocity)
  • Arias Intensity
  • CAV (Cumulative Absolute Velocity)

Choosing the right IM and EDP depends on the structure type, the available data, and the analysis objective.

Understanding the Fragility Curve Plot

The plot generated by the code shows the fragility curves for multiple damage states. Here’s how to read it:

  • X-axis: Intensity Measure (IM)
    In our example, this is Sa(T1) (spectral acceleration), but it can be PGA, PGV, or any other meaningful measure of shaking intensity.
  • Y-axis: Probability of Exceedance
    This is the probability that the structure’s response (EDP) will exceed the defined threshold for each damage state.

Interpretation:

A steeper curve implies a rapid transition from low to high damage probability — common for brittle systems or clearly defined performance thresholds.Methodology Overview

As the intensity of shaking (IM) increases, the probability of damage naturally increases.

Fragility curves slope upwards — from 0 to 1 — showing this increasing probability.

Robust structures have curves that shift rightward, indicating a lower probability of damage at a given IM.

  1. Input Data: Simulated or observed structural responses (e.g., drift ratios) vs. seismic intensities.
  2. Damage States: Thresholds for damage classification (e.g., 1%, 3%, 4%, 5% drift).
  3. Binning: The Sa values are grouped and used to calculate the fraction of samples exceeding each damage threshold.
  4. Curve Fitting: We fit a lognormal CDF to the exceedance probabilities using non-linear regression.
  5. Visualization: Fragility curves are plotted for each damage state.

Example Output

Input Format (input.txt)

A simple tab-separated file with the following columns:

Sa_T1_g    MaxDrift_ratio
0.1        0.0043
0.15       0.0098
...        ...

You can download an example file here.

Python Code: Fragility Curve Generator

################################################################################
# Fragility Curve Generator for Seismic Risk Analysis
#
# This script calculates and visualizes fragility curves for structural
# components or systems based on nonlinear response data from a suite of
# ground motions.
#
# Fragility curves represent the conditional probability that a structure
# will exceed a predefined damage state for a given ground motion intensity
# measure (IM), typically spectral acceleration (Sa). These curves are
# essential tools for probabilistic seismic risk assessment and
# performance-based earthquake engineering.
#
# The script uses a lognormal cumulative distribution function (CDF) to fit
# observed probabilities of exceedance derived from drift thresholds and
# structural response data. Drift ratios are compared against damage state
# thresholds to calculate these probabilities at various IM bins.
#
# Generated by: QuakeLogic Inc.
# Contact: support@quakelogic.net
################################################################################

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import lognorm
from scipy.optimize import curve_fit

def run():
    try:
        df = pd.read_csv("input.txt", sep='\t')
    except FileNotFoundError:
        print("❌ input.txt not found. Please ensure it exists in the working directory.")
        return

    IMs = df['Sa_T1_g'].values
    EDPs = df['MaxDrift_ratio'].values

    damage_states = {
        'Slight': 0.01,
        'Moderate': 0.03,
        'Extensive': 0.04,
        'Complete': 0.05
    }

    fragility_results = {}
    unique_IMs = np.linspace(min(IMs), max(IMs), 20)
    tolerance = 0.05

    for ds, threshold in damage_states.items():
        prob_exceed = []
        for im in unique_IMs:
            edp_subset = EDPs[np.abs(IMs - im) < tolerance]
            if len(edp_subset) > 0:
                prob = np.mean(edp_subset >= threshold)
            else:
                prob = 0
            prob_exceed.append(prob)

        def lognorm_cdf(x, mu, sigma):
            return lognorm.cdf(x, s=sigma, scale=np.exp(mu))

        prob_array = np.array(prob_exceed)
        if np.all(prob_array == 0) or np.all(prob_array == 1):
            print(f"⚠️ Skipping '{ds}' — flat probability distribution (all 0s or all 1s)")
            fragility_results[ds] = (np.nan, np.nan)
            continue

        try:
            popt, _ = curve_fit(lognorm_cdf, unique_IMs, prob_exceed, p0=[np.log(np.mean(unique_IMs)), 0.5])
            mu, sigma = popt
            fragility_results[ds] = (mu, sigma)
            print(f"✔️ Fitted '{ds}': mu = {mu:.3f}, sigma = {sigma:.3f}")
        except Exception as e:
            print(f"❌ Failed to fit for '{ds}': {e}")
            fragility_results[ds] = (np.nan, np.nan)

    plt.figure(figsize=(10, 6))
    x_vals = np.linspace(min(IMs), max(IMs), 300)
    for ds, (mu, sigma) in fragility_results.items():
        if np.isnan(mu): continue
        plt.plot(x_vals, lognorm.cdf(x_vals, s=sigma, scale=np.exp(mu)), label=ds)

    plt.ylim(0, 1)
    plt.xlabel("Spectral Acceleration Sa(T1) [g]", fontsize=12)
    plt.ylabel("Probability of Exceedance", fontsize=12)
    plt.title("Seismic Fragility Curves by Damage State", fontsize=14)
    plt.grid(True, linestyle='--', alpha=0.7)
    plt.legend(title="Damage State")
    plt.tight_layout()
    plt.savefig("fragility_curves_combined.png", dpi=300)
    plt.show()
    print("📈 Fragility plot saved as 'fragility_curves_combined.png'")

if __name__ == '__main__':
    run()

Summary

This fragility analysis tool allows engineers and researchers to:

  • Automate fragility curve generation from drift or response data
  • Visualize performance thresholds for multiple damage states
  • Incorporate results into risk models or decision-making tools

Need Help?

QuakeLogic Inc. provides advanced tools and consulting for:

  • Earthquake early warning systems
  • Structural health monitoring (SHM)
  • Fragility model development
  • Shake table testing and seismic instrumentation

📧 Reach out to us anytime: support@quakelogic.net

🌍 Understanding P-Waves and S-Waves: Earth’s Early Earthquake Messengers

When the Earth rumbles, seismic waves are the carriers of its message — rippling through the ground, shaking buildings, and providing valuable insight into the structure of our planet. Among these waves, P-waves and S-waves are the first responders. But what are they, how do they differ, and why do they matter so much in earthquake monitoring and early warning systems?

Let’s break it down.

🔹 What is a P-Wave?

P-wave stands for Primary wave — and true to the name, it’s the first seismic wave to arrive at a recording station after an earthquake occurs.

⚙️ Key Characteristics:

  • Type: Compressional (Longitudinal) wave
  • Motion: Particles move back and forth in the same direction as the wave travels
  • Speed: Fastest seismic wave (~5–8 km/s in the crust)
  • Medium: Travels through solids, liquids, and gases
  • Damage Potential: Generally low — it’s more of an early signal than a shaker

🎧 Analogy:

Think of how sound travels in air: the molecules compress and expand. P-waves do the same in rock — they compress and dilate the material as they pass.

🔹 What is an S-Wave?

S-wave stands for Secondary wave, because it arrives after the P-wave.

⚙️ Key Characteristics:

  • Type: Shear (Transverse) wave
  • Motion: Particles move perpendicular to the direction the wave is traveling — like side-to-side or up-and-down
  • Speed: Slower than P-waves (~3–4.5 km/s)
  • Medium: Only travels through solids — blocked by fluids like water or molten rock
  • Damage Potential: Higher shaking intensity, causes most of the ground motion we feel

🎧 Analogy:

Imagine shaking a rope up and down — the wave moves forward, but the rope oscillates vertically. That’s how S-waves move through the ground.

📊 Side-by-Side Comparison

FeatureP-WaveS-Wave
Full NamePrimary WaveSecondary Wave
TypeCompressional / LongitudinalShear / Transverse
Particle MotionBack-and-forth (in wave direction)Side-to-side or up-and-down
SpeedFastest (~5–8 km/s)Slower (~3–4.5 km/s)
MediumSolids, liquids, gasesSolids only
Arrival TimeFirstSecond
DamageMinimalSignificant shaking

🛰️ Why Are These Waves Important?

Both waves play critical roles in earthquake science and early warning systems:

  • P-waves act as an early warning signal. Systems like Taiwan’s P-Alert and algorithms like Prof. Y.M. Wu’s Pd method use the first few seconds of the P-wave to estimate earthquake magnitude and issue warnings before the damaging S-wave arrives.
  • S-waves are typically responsible for the actual shaking people feel and the structural damage during an earthquake.

With each second of early warning, we gain the opportunity to save lives, pause critical infrastructure, and reduce casualties.

📉 How Do They Look on a Seismogram?

On a typical seismogram:

  • P-waves appear as small, fast, high-frequency wiggles.
  • S-waves follow with larger amplitude and lower frequency, marking the start of strong shaking.

🔚 Final Thoughts

Understanding P-waves and S-waves isn’t just a scientific curiosity — it’s the foundation of modern earthquake early warning (EEW) systems. These waves help us detect earthquakes in real time, reduce risk, and save lives before the most damaging ground motions arrive.

If you’re looking for a reliable and cost-effective solution, we highly recommend the P-Alert sensor. Engineered for rapid P-wave detection and early warning, P-Alert offers real-time alerts, easy deployment, and proven performance in high-seismic-risk regions like Taiwan and beyond.

Protect your people and infrastructure — choose P-Alert.

Tired of Low-Frequency Noise Harassment? QuakeLogic Has the Solution.

If you’ve ever been bothered by a deep, persistent rumble in your home—something you feel more than hear—you’re not alone. Across the country, families are reporting a disturbing rise in low-frequency noise harassment, often caused intentionally by neighbors using subwoofers, industrial equipment, or other infrasound sources. The effects can be both physical and psychological: headaches, stress, loss of sleep, and a deep sense of unease in your own space.

This isn’t just a nuisance. It’s harassment. And it’s hard to prove—until now.


Why Low-Frequency Noise Is Dangerous to Your Health

Infrasound (low-frequency sound below 20 Hz) is often imperceptible to the human ear—but your body still feels it, and the long-term exposure can have serious consequences:

🧠 Headaches & Migraines – Constant infrasound exposure can trigger tension and pain, even when you’re unaware of the source.
🛌 Sleep Disturbance & Fatigue – These low-frequency vibrations can disrupt deep sleep cycles, leaving you exhausted, irritable, and less focused.
💓 Increased Stress & Anxiety – The body interprets infrasound as a warning signal, activating your stress response and leading to chronic anxiety.
🎯 Cognitive Impairment – Extended exposure has been linked to reduced concentration, memory issues, and mental fog.
🩺 Cardiovascular Strain – Some studies suggest that long-term infrasound exposure can increase blood pressure and heart rate.

This is more than an annoyance—it’s a silent health threat. If you’re experiencing symptoms without a clear cause, infrasound may be the hidden culprit.


The Power of Infrasound Detection at Your Fingertips

At QuakeLogic, we believe everyone has the right to peace in their own home. That’s why we proudly offer the Raspberry Boom Seismo-Acoustic Monitor, a powerful, affordable tool designed to detect and pinpoint infrasound disturbances.

Our infrasound sensor is built with advanced technology capable of detecting low-frequency sound waves that conventional microphones can’t capture. These invisible sound waves can penetrate walls, travel long distances, and cause real harm—but Raspberry Boom gives you the power to fight back.

With it, you can:

Detect and log infrasound events in real-time
Identify patterns and timing of the harassment
Pinpoint the source with location tracking when used in a small sensor network
Create compelling evidence for police reports or legal action
Reclaim peace in your home and protect your loved ones


Why Raspberry Boom Is the Best Choice

  • Plug & Play Simplicity – No technical background? No problem. Raspberry Boom comes with free, user-friendly software to get you started immediately.
  • Live Monitoring and History Logs – Stay aware of what’s happening and when.
  • Affordable Protection – Priced with families in mind, this powerful tool includes free shipping and is available right now on our website.
  • Trusted by Scientists and Homeowners – Raspberry Boom is part of a global infrasound network trusted by researchers worldwide.

A Smart Investment in Peace of Mind

Low-frequency noise harassment is real, and it’s affecting more people every day. Whether you suspect a neighbor is deliberately targeting you, or you’re just unsure of what’s causing that strange vibration in your home, Raspberry Boom gives you the power to know, prove, and act.

🛒 Buy now and protect your peace:
👉 https://products.quakelogic.net/product/rsboom-seismo-acoustic-monitor/

🔒 Protect your family.
🧘‍♀️ Regain your peace.
⚖️ Build your case with real, scientific data.

Seeing (and hearing) is believing. Don’t let invisible noise take over your life—let QuakeLogic help you fight back.