FAILURE MAP
← Case archive

FA-71566 / Seismic magnitude estimation / Open access

Wood-Anderson amplitude simulation: peak definition · case 01

Negative-going pulses are ignored.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Only the positive displacement maximum is used.

VERIFIED REPAIR

Take the maximum absolute displacement.

Unsuccessful approach: Peak-to-peak amplitude doubles a symmetric pulse.

Case contract

Velocity-sensor counts, sensitivity counts per m/s, sample interval s. Remove the mean, convert to m/s, integrate with the trapezoid rule from 0, take the maximum absolute displacement, multiply by the Wood-Anderson gain 2080 and convert to mm. Return mm rounded to 1e-4, None for an empty trace.

Why this case matters

Wood-Anderson amplitudes are the input to local magnitude.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(counts, sens, dt):
    if not counts:
        return None
    mean = sum(counts) / len(counts)
    vel = [(c - mean) / sens for c in counts]
    disp = [0.0]
    for i in range(1, len(vel)):
        disp.append(disp[-1] + 0.5 * (vel[i - 1] + vel[i]) * dt)
    peak = max(disp)
    return round(peak * 2080 * 1000, 4)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trace 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 1', [[-438, -422, -845, 107, -288, 724, -435, -632, 690], 100000000.0, 0.01], 0.1913], ['trace 2', [[8, 47, 118, -519, -421, -54, -238, -121], 100000000.0, 0.01], 0.0842], ['trace 3', [[-701, 88, -234, -70, -529, -1002, 304, -1260, -994, 400], 100000000.0, 0.01], 0.1598], ['trace 4', [[-686, 544, 277, -1046, -766, -1235, 329, -1152, -874, 219], 100000000.0, 0.01], 0.2646], ['trace 5', [[1259, -39, 1475, 880, 416, 768, 982, -232], 1500000000.0, 0.02], 0.0136], ['trace 6', [[967, -475, -512, 255, 516, 486, -840, 288], 1500000000.0, 0.01], 0.0088], ['trace 7', [[22, -1189, -875, -394, 216], 500000000.0, 0.02], 0.0764]], [['trace 7', [[22, -1189, -875, -394, 216], 500000000.0, 0.02], 0.0764], ['trace 8', [[491, -743, 168, -106], 100000000.0, 0.01], 0.0662], ['trace 9', [[1140, 675, -129, 1466, 1180, 1409, 1273, 156], 500000000.0, 0.02], 0.0699], ['trace 10', [[295, -693, -527, -749, -313, 39, 217, -925, 433], 1500000000.0, 0.01], 0.0137], ['trace 11', [[415, 520, -255, 348, 660, -938], 500000000.0, 0.02], 0.0541], ['trace 12', [[-597, -489, -301, -271, -999, -558, -230, -970, -1048], 500000000.0, 0.02], 0.0514], ['trace 13', [[297, 1086, -65, 508, 67, 1363, 160, 857, 322], 500000000.0, 0.02], 0.0276], ['trace 14', [[338, -532, -974, 859, 966, 558], 100000000.0, 0.01], 0.3151]], [['trace 13', [[297, 1086, -65, 508, 67, 1363, 160, 857, 322], 500000000.0, 0.02], 0.0276], ['trace 14', [[338, -532, -974, 859, 966, 558], 100000000.0, 0.01], 0.3151], ['trace 15', [[143, 170, -64, 138, 634], 100000000.0, 0.01], 0.0761], ['trace 16', [[1183, 1265, 1030, 749, -390], 500000000.0, 0.02], 0.0798], ['trace 17', [[423, -354, -610, -304, 513, -195, -84, 296], 1500000000.0, 0.02], 0.0218], ['trace 18', [[914, 28, -594, 554, -691, 34, 863, 716, -229, 744], 100000000.0, 0.01], 0.2909], ['trace 19', [[1319, 651, 570, 304, 1072], 1500000000.0, 0.01], 0.0057], ['trace 20', [[412, -143, -251, 353, -172], 1500000000.0, 0.01], 0.002]], [['trace 17', [[423, -354, -610, -304, 513, -195, -84, 296], 1500000000.0, 0.02], 0.0218], ['trace 21', [[561, 856, 710, 319, 742, 1285, -221, 763], 100000000.0, 0.01], 0.0864], ['trace 22', [[-228, 382, -252, 552, 320, -776], 100000000.0, 0.01], 0.1517], ['trace 23', [[-486, 859, 193, 1092, 1350, -353], 500000000.0, 0.02], 0.0717], ['trace 24', [[-179, 4, 317, 984], 1500000000.0, 0.02], 0.0136], ['trace 25', [[-431, 933, -842, 85, -489, -992, -686, -918], 500000000.0, 0.02], 0.1153], ['trace 26', [[-347, -149, -735, -306, -1255], 1500000000.0, 0.01], 0.0064], ['trace 29', [[-178, 10, 1361, 707, 1375, 364, 582, 1449, 423], 1500000000.0, 0.01], 0.0106]], [['trace 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 4', [[-686, 544, 277, -1046, -766, -1235, 329, -1152, -874, 219], 100000000.0, 0.01], 0.2646], ['trace 20', [[412, -143, -251, 353, -172], 1500000000.0, 0.01], 0.002], ['trace 28', [[-1202, -1275, 528, -292, -12, -129, -528, 349], 100000000.0, 0.01], 0.2021], ['trace 29', [[-178, 10, 1361, 707, 1375, 364, 582, 1449, 423], 1500000000.0, 0.01], 0.0106], ['asymmetric pulse', [[0, 800, 1200, 400, -200, -100], 1000000000.0, 0.01], 0.0239], ['empty', [[], 1000000000.0, 0.01], None], ['offset step', [[1000, 1000, 3000, 1000, 1000], 1000000000.0, 0.01], 0.0166]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
trace 00.04920.0492Passed
trace 10.00.1913Failed
trace 20.08420.0842Passed
trace 30.15980.1598Passed
trace 40.26460.2646Passed
trace 50.01360.0136Passed
trace 60.00220.0088Failed
trace 70.00.0764Failed

SHA-256 / e4d0c12294de63d4fc98b2da78cffa5e83458672240a70319191a84ae89a1291

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(counts, sens, dt):
    if not counts:
        return None
    mean = sum(counts) / len(counts)
    vel = [(c - mean) / sens for c in counts]
    disp = [0.0]
    for i in range(1, len(vel)):
        disp.append(disp[-1] + 0.5 * (vel[i - 1] + vel[i]) * dt)
    peak = max(disp) - min(disp)
    return round(peak * 2080 * 1000, 4)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trace 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 1', [[-438, -422, -845, 107, -288, 724, -435, -632, 690], 100000000.0, 0.01], 0.1913], ['trace 2', [[8, 47, 118, -519, -421, -54, -238, -121], 100000000.0, 0.01], 0.0842], ['trace 3', [[-701, 88, -234, -70, -529, -1002, 304, -1260, -994, 400], 100000000.0, 0.01], 0.1598], ['trace 4', [[-686, 544, 277, -1046, -766, -1235, 329, -1152, -874, 219], 100000000.0, 0.01], 0.2646], ['trace 5', [[1259, -39, 1475, 880, 416, 768, 982, -232], 1500000000.0, 0.02], 0.0136], ['trace 6', [[967, -475, -512, 255, 516, 486, -840, 288], 1500000000.0, 0.01], 0.0088], ['trace 7', [[22, -1189, -875, -394, 216], 500000000.0, 0.02], 0.0764]], [['trace 7', [[22, -1189, -875, -394, 216], 500000000.0, 0.02], 0.0764], ['trace 8', [[491, -743, 168, -106], 100000000.0, 0.01], 0.0662], ['trace 9', [[1140, 675, -129, 1466, 1180, 1409, 1273, 156], 500000000.0, 0.02], 0.0699], ['trace 10', [[295, -693, -527, -749, -313, 39, 217, -925, 433], 1500000000.0, 0.01], 0.0137], ['trace 11', [[415, 520, -255, 348, 660, -938], 500000000.0, 0.02], 0.0541], ['trace 12', [[-597, -489, -301, -271, -999, -558, -230, -970, -1048], 500000000.0, 0.02], 0.0514], ['trace 13', [[297, 1086, -65, 508, 67, 1363, 160, 857, 322], 500000000.0, 0.02], 0.0276], ['trace 14', [[338, -532, -974, 859, 966, 558], 100000000.0, 0.01], 0.3151]], [['trace 13', [[297, 1086, -65, 508, 67, 1363, 160, 857, 322], 500000000.0, 0.02], 0.0276], ['trace 14', [[338, -532, -974, 859, 966, 558], 100000000.0, 0.01], 0.3151], ['trace 15', [[143, 170, -64, 138, 634], 100000000.0, 0.01], 0.0761], ['trace 16', [[1183, 1265, 1030, 749, -390], 500000000.0, 0.02], 0.0798], ['trace 17', [[423, -354, -610, -304, 513, -195, -84, 296], 1500000000.0, 0.02], 0.0218], ['trace 18', [[914, 28, -594, 554, -691, 34, 863, 716, -229, 744], 100000000.0, 0.01], 0.2909], ['trace 19', [[1319, 651, 570, 304, 1072], 1500000000.0, 0.01], 0.0057], ['trace 20', [[412, -143, -251, 353, -172], 1500000000.0, 0.01], 0.002]], [['trace 17', [[423, -354, -610, -304, 513, -195, -84, 296], 1500000000.0, 0.02], 0.0218], ['trace 21', [[561, 856, 710, 319, 742, 1285, -221, 763], 100000000.0, 0.01], 0.0864], ['trace 22', [[-228, 382, -252, 552, 320, -776], 100000000.0, 0.01], 0.1517], ['trace 23', [[-486, 859, 193, 1092, 1350, -353], 500000000.0, 0.02], 0.0717], ['trace 24', [[-179, 4, 317, 984], 1500000000.0, 0.02], 0.0136], ['trace 25', [[-431, 933, -842, 85, -489, -992, -686, -918], 500000000.0, 0.02], 0.1153], ['trace 26', [[-347, -149, -735, -306, -1255], 1500000000.0, 0.01], 0.0064], ['trace 29', [[-178, 10, 1361, 707, 1375, 364, 582, 1449, 423], 1500000000.0, 0.01], 0.0106]], [['trace 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 4', [[-686, 544, 277, -1046, -766, -1235, 329, -1152, -874, 219], 100000000.0, 0.01], 0.2646], ['trace 20', [[412, -143, -251, 353, -172], 1500000000.0, 0.01], 0.002], ['trace 28', [[-1202, -1275, 528, -292, -12, -129, -528, 349], 100000000.0, 0.01], 0.2021], ['trace 29', [[-178, 10, 1361, 707, 1375, 364, 582, 1449, 423], 1500000000.0, 0.01], 0.0106], ['asymmetric pulse', [[0, 800, 1200, 400, -200, -100], 1000000000.0, 0.01], 0.0239], ['empty', [[], 1000000000.0, 0.01], None], ['offset step', [[1000, 1000, 3000, 1000, 1000], 1000000000.0, 0.01], 0.0166]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
trace 00.0930.0492Failed
trace 10.19130.1913Passed
trace 20.10320.0842Failed
trace 30.2330.1598Failed
trace 40.33050.2646Failed
trace 50.01570.0136Failed
trace 60.0110.0088Failed
trace 70.07640.0764Passed

SHA-256 / e9a6e829e4e612bc9ba6507768038bd6cc5aabe0f583e67788c66a90942429f1

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(counts, sens, dt):
    if not counts:
        return None
    mean = sum(counts) / len(counts)
    vel = [(c - mean) / sens for c in counts]
    disp = [0.0]
    for i in range(1, len(vel)):
        disp.append(disp[-1] + 0.5 * (vel[i - 1] + vel[i]) * dt)
    peak = max(abs(x) for x in disp)
    return round(peak * 2080 * 1000, 4)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trace 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 1', [[-438, -422, -845, 107, -288, 724, -435, -632, 690], 100000000.0, 0.01], 0.1913], ['trace 2', [[8, 47, 118, -519, -421, -54, -238, -121], 100000000.0, 0.01], 0.0842], ['trace 3', [[-701, 88, -234, -70, -529, -1002, 304, -1260, -994, 400], 100000000.0, 0.01], 0.1598], ['trace 4', [[-686, 544, 277, -1046, -766, -1235, 329, -1152, -874, 219], 100000000.0, 0.01], 0.2646], ['trace 5', [[1259, -39, 1475, 880, 416, 768, 982, -232], 1500000000.0, 0.02], 0.0136], ['trace 6', [[967, -475, -512, 255, 516, 486, -840, 288], 1500000000.0, 0.01], 0.0088], ['trace 7', [[22, -1189, -875, -394, 216], 500000000.0, 0.02], 0.0764]], [['trace 7', [[22, -1189, -875, -394, 216], 500000000.0, 0.02], 0.0764], ['trace 8', [[491, -743, 168, -106], 100000000.0, 0.01], 0.0662], ['trace 9', [[1140, 675, -129, 1466, 1180, 1409, 1273, 156], 500000000.0, 0.02], 0.0699], ['trace 10', [[295, -693, -527, -749, -313, 39, 217, -925, 433], 1500000000.0, 0.01], 0.0137], ['trace 11', [[415, 520, -255, 348, 660, -938], 500000000.0, 0.02], 0.0541], ['trace 12', [[-597, -489, -301, -271, -999, -558, -230, -970, -1048], 500000000.0, 0.02], 0.0514], ['trace 13', [[297, 1086, -65, 508, 67, 1363, 160, 857, 322], 500000000.0, 0.02], 0.0276], ['trace 14', [[338, -532, -974, 859, 966, 558], 100000000.0, 0.01], 0.3151]], [['trace 13', [[297, 1086, -65, 508, 67, 1363, 160, 857, 322], 500000000.0, 0.02], 0.0276], ['trace 14', [[338, -532, -974, 859, 966, 558], 100000000.0, 0.01], 0.3151], ['trace 15', [[143, 170, -64, 138, 634], 100000000.0, 0.01], 0.0761], ['trace 16', [[1183, 1265, 1030, 749, -390], 500000000.0, 0.02], 0.0798], ['trace 17', [[423, -354, -610, -304, 513, -195, -84, 296], 1500000000.0, 0.02], 0.0218], ['trace 18', [[914, 28, -594, 554, -691, 34, 863, 716, -229, 744], 100000000.0, 0.01], 0.2909], ['trace 19', [[1319, 651, 570, 304, 1072], 1500000000.0, 0.01], 0.0057], ['trace 20', [[412, -143, -251, 353, -172], 1500000000.0, 0.01], 0.002]], [['trace 17', [[423, -354, -610, -304, 513, -195, -84, 296], 1500000000.0, 0.02], 0.0218], ['trace 21', [[561, 856, 710, 319, 742, 1285, -221, 763], 100000000.0, 0.01], 0.0864], ['trace 22', [[-228, 382, -252, 552, 320, -776], 100000000.0, 0.01], 0.1517], ['trace 23', [[-486, 859, 193, 1092, 1350, -353], 500000000.0, 0.02], 0.0717], ['trace 24', [[-179, 4, 317, 984], 1500000000.0, 0.02], 0.0136], ['trace 25', [[-431, 933, -842, 85, -489, -992, -686, -918], 500000000.0, 0.02], 0.1153], ['trace 26', [[-347, -149, -735, -306, -1255], 1500000000.0, 0.01], 0.0064], ['trace 29', [[-178, 10, 1361, 707, 1375, 364, 582, 1449, 423], 1500000000.0, 0.01], 0.0106]], [['trace 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 4', [[-686, 544, 277, -1046, -766, -1235, 329, -1152, -874, 219], 100000000.0, 0.01], 0.2646], ['trace 20', [[412, -143, -251, 353, -172], 1500000000.0, 0.01], 0.002], ['trace 28', [[-1202, -1275, 528, -292, -12, -129, -528, 349], 100000000.0, 0.01], 0.2021], ['trace 29', [[-178, 10, 1361, 707, 1375, 364, 582, 1449, 423], 1500000000.0, 0.01], 0.0106], ['asymmetric pulse', [[0, 800, 1200, 400, -200, -100], 1000000000.0, 0.01], 0.0239], ['empty', [[], 1000000000.0, 0.01], None], ['offset step', [[1000, 1000, 3000, 1000, 1000], 1000000000.0, 0.01], 0.0166]]]
for label, args, expected in fixtures[N - 1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
trace 00.04920.0492Passed
trace 10.19130.1913Passed
trace 20.08420.0842Passed
trace 30.15980.1598Passed
trace 40.26460.2646Passed
trace 50.01360.0136Passed
trace 60.00880.0088Passed
trace 70.07640.0764Passed

SHA-256 / 661ec23f6fe303b80ef2e5bbd7f2f8828c60fb720603039a6d613f6f68b4d3c6

Verification & scope

Stipulated deterministic teaching model of a seismological magnitude procedure; constants and tables are fixed by the contract and no claim of agency or standards conformance is made. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:48:30.797531+00:00.

Case digest / bff4cd9c641d8f6702cea61bd25b571bda2daab7baf464f889a3ad9cf0014fc5