FA-71556 / Seismic magnitude estimation / Open access
Wood-Anderson amplitude simulation: trapezoid integration · case 01
Displacement amplitudes shift by half a sample of velocity.
ROOT CAUSE
Rectangle integration uses only the current sample.
VERIFIED REPAIR
Integrate with the trapezoid rule.
Unsuccessful approach: Omitting dt returns counts-seconds per sample, not metres.
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] + 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 3', [[-701, 88, -234, -70, -529, -1002, 304, -1260, -994, 400], 100000000.0, 0.01], 0.1598], ['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 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 6', [[967, -475, -512, 255, 516, 486, -840, 288], 1500000000.0, 0.01], 0.0088], ['trace 11', [[415, 520, -255, 348, 660, -938], 500000000.0, 0.02], 0.0541], ['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 9', [[1140, 675, -129, 1466, 1180, 1409, 1273, 156], 500000000.0, 0.02], 0.0699], ['trace 16', [[1183, 1265, 1030, 749, -390], 500000000.0, 0.02], 0.0798], ['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 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 12', [[-597, -489, -301, -271, -999, -558, -230, -970, -1048], 500000000.0, 0.02], 0.0514], ['trace 21', [[561, 856, 710, 319, 742, 1285, -221, 763], 100000000.0, 0.01], 0.0864], ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| trace 0 | 0.083 | 0.0492 | Failed |
| trace 1 | 0.1924 | 0.1913 | Failed |
| trace 2 | 0.0957 | 0.0842 | Failed |
| trace 3 | 0.2045 | 0.1598 | Failed |
| trace 4 | 0.3534 | 0.2646 | Failed |
| trace 5 | 0.0202 | 0.0136 | Failed |
| trace 6 | 0.0161 | 0.0088 | Failed |
| trace 7 | 0.0978 | 0.0764 | Failed |
SHA-256 / 11fe8369dab40646068964cbb31f91653c3543279bad516f4bb4470417272e76
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]))
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 3', [[-701, 88, -234, -70, -529, -1002, 304, -1260, -994, 400], 100000000.0, 0.01], 0.1598], ['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 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 6', [[967, -475, -512, 255, 516, 486, -840, 288], 1500000000.0, 0.01], 0.0088], ['trace 11', [[415, 520, -255, 348, 660, -938], 500000000.0, 0.02], 0.0541], ['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 9', [[1140, 675, -129, 1466, 1180, 1409, 1273, 156], 500000000.0, 0.02], 0.0699], ['trace 16', [[1183, 1265, 1030, 749, -390], 500000000.0, 0.02], 0.0798], ['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 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 12', [[-597, -489, -301, -271, -999, -558, -230, -970, -1048], 500000000.0, 0.02], 0.0514], ['trace 21', [[561, 856, 710, 319, 742, 1285, -221, 763], 100000000.0, 0.01], 0.0864], ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| trace 0 | 2.4606 | 0.0492 | Failed |
| trace 1 | 19.1256 | 0.1913 | Failed |
| trace 2 | 8.424 | 0.0842 | Failed |
| trace 3 | 15.9786 | 0.1598 | Failed |
| trace 4 | 26.4576 | 0.2646 | Failed |
| trace 5 | 0.6777 | 0.0136 | Failed |
| trace 6 | 0.8776 | 0.0088 | Failed |
| trace 7 | 3.8189 | 0.0764 | Failed |
SHA-256 / ac27b0a7551e9fe24bd1b08fad245dd9cc835965e7c5d1452a49ee4276e9c17f
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 3', [[-701, 88, -234, -70, -529, -1002, 304, -1260, -994, 400], 100000000.0, 0.01], 0.1598], ['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 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 6', [[967, -475, -512, 255, 516, 486, -840, 288], 1500000000.0, 0.01], 0.0088], ['trace 11', [[415, 520, -255, 348, 660, -938], 500000000.0, 0.02], 0.0541], ['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 9', [[1140, 675, -129, 1466, 1180, 1409, 1273, 156], 500000000.0, 0.02], 0.0699], ['trace 16', [[1183, 1265, 1030, 749, -390], 500000000.0, 0.02], 0.0798], ['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 0', [[-399, 158, 716, 1343, 399, -234, 349, 919], 500000000.0, 0.02], 0.0492], ['trace 12', [[-597, -489, -301, -271, -999, -558, -230, -970, -1048], 500000000.0, 0.02], 0.0514], ['trace 21', [[561, 856, 710, 319, 742, 1285, -221, 763], 100000000.0, 0.01], 0.0864], ['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| trace 0 | 0.0492 | 0.0492 | Passed |
| trace 1 | 0.1913 | 0.1913 | Passed |
| trace 2 | 0.0842 | 0.0842 | Passed |
| trace 3 | 0.1598 | 0.1598 | Passed |
| trace 4 | 0.2646 | 0.2646 | Passed |
| trace 5 | 0.0136 | 0.0136 | Passed |
| trace 6 | 0.0088 | 0.0088 | Passed |
| trace 7 | 0.0764 | 0.0764 | Passed |
SHA-256 / bc9e803c11cdb4b389cecbca58750cafdd04371a7d3dcfff6bfe5a2f0570fc3c
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.664974+00:00.
Case digest / 4ebe052b5a690847fc36142819ecfb6395807c3fa14db4991896b1ace0628d6c