{"abstract":"With saturating stages the output differs from gain-at-input: loud inputs are no longer clipped in the first stage.","category":"Digital signal filters","checks":7,"contract":"Input [gain, sections, limit, samples]; each section [b0, b1, b2, a1, a2] is a direct-form-I biquad (a0 = 1) with its own state. The input is scaled by gain, each section output is clamped to [-limit, limit] and the clamped value is both stored as that section's output state and fed to the next section. Return exact fraction strings.","evaluation_group":"w2-digital_signal_filters-sos-cascade-saturation","failed_approach":"The attempted repair scales at both input and output, applying the gain twice.","family":"w2-digital_signal_filters-sos-cascade-saturation-input-gain-placement","id":"FA-91626","implementations":{"attempt":{"sha256":"8adef47a79091a025f9bcd59e70e5c40fe00bc56ce140268f8dbbfd83c9f4c12","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    gain, secs, lim, xs = Fraction(x[0]), x[1], Fraction(x[2]), x[3]\n    coefs = [[Fraction(v) for v in s] for s in secs]\n    states = [[Fraction(0)] * 4 for _ in coefs]\n    out = []\n    for v in xs:\n        u = gain * v\n        for k, (b0, b1, b2, a1, a2) in enumerate(coefs):\n            st = states[k]\n            y = b0 * u + b1 * st[0] + b2 * st[1] - a1 * st[2] - a2 * st[3]\n            y = max(-lim, min(lim, y))\n            st[:] = [u, st[0], y, st[2]]\n            u = y\n        out.append(str(gain * u))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: gain before saturation', ['3', [['1', '0', '0', '-1/2', '0']], '2', [1, 1, 1]], ['2', '2', '2']], ['regression: three sections', ['1/2', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4'], ['1', '0', '0', '-1/2', '0']], '5', [3, 0, -3, 1]], ['3', '5', '19/4', '9/8']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']]], [['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['regression: random cascade 4', ['2', [['1', '-1', '0', '1/4', '0']], '2', [-3, -2, 2, 1, -2]], ['-2', '2', '2', '-2', '-2']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']], ['control: random cascade 21', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '100', [3, 0, 2, 2, 2, 0]], ['3', '6', '19/2', '87/8', '103/8', '101/8']], ['control: random cascade 24', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '3', [1, 2, -2, -1, -3]], ['1', '5/4', '-3', '1/8', '-53/32']]], [['regression: random cascade 6', ['3', [['1', '1', '1', '-1/2', '1/4']], '3', [-1, 2, 0, 1, 1, -1]], ['-3', '3/2', '3', '3', '3', '3']], ['regression: random cascade 11', ['2', [['1', '1', '1', '-1/2', '1/4'], ['1', '0', '0', '-1/2', '0'], ['1', '0', '0', '-1/2', '0']], '2', [3, -2, 1, 0, 2, -2]], ['2', '2', '2', '1/2', '2', '2']], ['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['control: random cascade 25', ['1', [['2', '0', '1', '0', '1/4']], '5', [-2, 3, -2, -2, 2]], ['-4', '5', '-5', '-9/4', '13/4']], ['control: random cascade 26', ['1', [['1', '-1', '0', '1/4', '0']], '100', [-1, 1, -2, 1]], ['-1', '9/4', '-57/16', '249/64']], ['control: random cascade 27', ['1', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '3', [2, -1, 3, 1]], ['3/2', '5/4', '9/8', '45/16']], ['control: random cascade 30', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '5', [3, 0, 0, 2, 3]], ['3', '5', '5', '5', '5']]], [['regression: random cascade 13', ['1/2', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0']], '3', [-3, -3, 3, 1]], ['-3/2', '-3', '-3/8', '5/4']], ['regression: random cascade 17', ['3', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4']], '2', [1, 1, 0, 0]], ['2', '2', '2', '2']], ['regression: random cascade 5', ['2', [['1', '0', '0', '-1/2', '0']], '2', [2, 0]], ['2', '1']], ['control: random cascade 32', ['1', [['1', '1', '1', '-1/2', '1/4'], ['3', '0', '0', '0', '0'], ['3', '0', '0', '0', '0']], '2', [1, -3, 3, 1, -3]], ['2', '-2', '0', '2', '2']], ['control: random cascade 35', ['1', [['1', '0', '0', '-1/2', '0']], '3', [0, -2]], ['0', '-2']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']]], [['regression: random cascade 19', ['2', [['1', '0', '0', '-1/2', '0']], '5', [3, -3, 0, 0]], ['5', '-7/2', '-7/4', '-7/8']], ['regression: random cascade 20', ['3', [['1/2', '1/2', '0', '0', '0']], '5', [-1, -3, -3]], ['-3/2', '-5', '-5']], ['repair check: random cascade 9', ['3', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '100', [-2, 1]], ['-6', '15/2']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"22828736a0fd9a72a96e262e66466bcd2908a90fe769a965654edbc0c49af0e8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    gain, secs, lim, xs = Fraction(x[0]), x[1], Fraction(x[2]), x[3]\n    coefs = [[Fraction(v) for v in s] for s in secs]\n    states = [[Fraction(0)] * 4 for _ in coefs]\n    out = []\n    for v in xs:\n        u = v\n        for k, (b0, b1, b2, a1, a2) in enumerate(coefs):\n            st = states[k]\n            y = b0 * u + b1 * st[0] + b2 * st[1] - a1 * st[2] - a2 * st[3]\n            y = max(-lim, min(lim, y))\n            st[:] = [u, st[0], y, st[2]]\n            u = y\n        out.append(str(gain * u))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: gain before saturation', ['3', [['1', '0', '0', '-1/2', '0']], '2', [1, 1, 1]], ['2', '2', '2']], ['regression: three sections', ['1/2', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4'], ['1', '0', '0', '-1/2', '0']], '5', [3, 0, -3, 1]], ['3', '5', '19/4', '9/8']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']]], [['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['regression: random cascade 4', ['2', [['1', '-1', '0', '1/4', '0']], '2', [-3, -2, 2, 1, -2]], ['-2', '2', '2', '-2', '-2']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']], ['control: random cascade 21', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '100', [3, 0, 2, 2, 2, 0]], ['3', '6', '19/2', '87/8', '103/8', '101/8']], ['control: random cascade 24', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '3', [1, 2, -2, -1, -3]], ['1', '5/4', '-3', '1/8', '-53/32']]], [['regression: random cascade 6', ['3', [['1', '1', '1', '-1/2', '1/4']], '3', [-1, 2, 0, 1, 1, -1]], ['-3', '3/2', '3', '3', '3', '3']], ['regression: random cascade 11', ['2', [['1', '1', '1', '-1/2', '1/4'], ['1', '0', '0', '-1/2', '0'], ['1', '0', '0', '-1/2', '0']], '2', [3, -2, 1, 0, 2, -2]], ['2', '2', '2', '1/2', '2', '2']], ['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['control: random cascade 25', ['1', [['2', '0', '1', '0', '1/4']], '5', [-2, 3, -2, -2, 2]], ['-4', '5', '-5', '-9/4', '13/4']], ['control: random cascade 26', ['1', [['1', '-1', '0', '1/4', '0']], '100', [-1, 1, -2, 1]], ['-1', '9/4', '-57/16', '249/64']], ['control: random cascade 27', ['1', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '3', [2, -1, 3, 1]], ['3/2', '5/4', '9/8', '45/16']], ['control: random cascade 30', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '5', [3, 0, 0, 2, 3]], ['3', '5', '5', '5', '5']]], [['regression: random cascade 13', ['1/2', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0']], '3', [-3, -3, 3, 1]], ['-3/2', '-3', '-3/8', '5/4']], ['regression: random cascade 17', ['3', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4']], '2', [1, 1, 0, 0]], ['2', '2', '2', '2']], ['regression: random cascade 5', ['2', [['1', '0', '0', '-1/2', '0']], '2', [2, 0]], ['2', '1']], ['control: random cascade 32', ['1', [['1', '1', '1', '-1/2', '1/4'], ['3', '0', '0', '0', '0'], ['3', '0', '0', '0', '0']], '2', [1, -3, 3, 1, -3]], ['2', '-2', '0', '2', '2']], ['control: random cascade 35', ['1', [['1', '0', '0', '-1/2', '0']], '3', [0, -2]], ['0', '-2']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']]], [['regression: random cascade 19', ['2', [['1', '0', '0', '-1/2', '0']], '5', [3, -3, 0, 0]], ['5', '-7/2', '-7/4', '-7/8']], ['regression: random cascade 20', ['3', [['1/2', '1/2', '0', '0', '0']], '5', [-1, -3, -3]], ['-3/2', '-5', '-5']], ['repair check: random cascade 9', ['3', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '100', [-2, 1]], ['-6', '15/2']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"35329acf616c13378601ad8281d5ac3582da9c9678cf3f637e2d329ad800b089","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    gain, secs, lim, xs = Fraction(x[0]), x[1], Fraction(x[2]), x[3]\n    coefs = [[Fraction(v) for v in s] for s in secs]\n    states = [[Fraction(0)] * 4 for _ in coefs]\n    out = []\n    for v in xs:\n        u = gain * v\n        for k, (b0, b1, b2, a1, a2) in enumerate(coefs):\n            st = states[k]\n            y = b0 * u + b1 * st[0] + b2 * st[1] - a1 * st[2] - a2 * st[3]\n            y = max(-lim, min(lim, y))\n            st[:] = [u, st[0], y, st[2]]\n            u = y\n        out.append(str(u))\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: gain before saturation', ['3', [['1', '0', '0', '-1/2', '0']], '2', [1, 1, 1]], ['2', '2', '2']], ['regression: three sections', ['1/2', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4'], ['1', '0', '0', '-1/2', '0']], '5', [3, 0, -3, 1]], ['3', '5', '19/4', '9/8']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']]], [['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['regression: random cascade 4', ['2', [['1', '-1', '0', '1/4', '0']], '2', [-3, -2, 2, 1, -2]], ['-2', '2', '2', '-2', '-2']], ['repair check: random cascade 0', ['1/2', [['1', '1', '1', '-1/2', '1/4']], '100', [3, -1, 0, 2, -3, 3]], ['3/2', '7/4', '3/2', '13/16', '-15/32', '9/16']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']], ['control: random cascade 21', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '100', [3, 0, 2, 2, 2, 0]], ['3', '6', '19/2', '87/8', '103/8', '101/8']], ['control: random cascade 24', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '3', [1, 2, -2, -1, -3]], ['1', '5/4', '-3', '1/8', '-53/32']]], [['regression: random cascade 6', ['3', [['1', '1', '1', '-1/2', '1/4']], '3', [-1, 2, 0, 1, 1, -1]], ['-3', '3/2', '3', '3', '3', '3']], ['regression: random cascade 11', ['2', [['1', '1', '1', '-1/2', '1/4'], ['1', '0', '0', '-1/2', '0'], ['1', '0', '0', '-1/2', '0']], '2', [3, -2, 1, 0, 2, -2]], ['2', '2', '2', '1/2', '2', '2']], ['regression: random cascade 2', ['1/2', [['2', '0', '1', '0', '1/4']], '3', [3, 0]], ['3', '0']], ['control: random cascade 25', ['1', [['2', '0', '1', '0', '1/4']], '5', [-2, 3, -2, -2, 2]], ['-4', '5', '-5', '-9/4', '13/4']], ['control: random cascade 26', ['1', [['1', '-1', '0', '1/4', '0']], '100', [-1, 1, -2, 1]], ['-1', '9/4', '-57/16', '249/64']], ['control: random cascade 27', ['1', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '3', [2, -1, 3, 1]], ['3/2', '5/4', '9/8', '45/16']], ['control: random cascade 30', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '1', '1', '-1/2', '1/4']], '5', [3, 0, 0, 2, 3]], ['3', '5', '5', '5', '5']]], [['regression: random cascade 13', ['1/2', [['2', '0', '1', '0', '1/4'], ['1/2', '1/2', '0', '0', '0']], '3', [-3, -3, 3, 1]], ['-3/2', '-3', '-3/8', '5/4']], ['regression: random cascade 17', ['3', [['1', '1', '1', '-1/2', '1/4'], ['2', '0', '1', '0', '1/4']], '2', [1, 1, 0, 0]], ['2', '2', '2', '2']], ['regression: random cascade 5', ['2', [['1', '0', '0', '-1/2', '0']], '2', [2, 0]], ['2', '1']], ['control: random cascade 32', ['1', [['1', '1', '1', '-1/2', '1/4'], ['3', '0', '0', '0', '0'], ['3', '0', '0', '0', '0']], '2', [1, -3, 3, 1, -3]], ['2', '-2', '0', '2', '2']], ['control: random cascade 35', ['1', [['1', '0', '0', '-1/2', '0']], '3', [0, -2]], ['0', '-2']], ['control: two sections saturating', ['1', [['2', '0', '1', '0', '1/4'], ['3', '0', '0', '0', '0']], '4', [2, 2, -1, 0]], ['4', '4', '-3', '3']], ['control: random cascade 3', ['1', [['1', '0', '0', '-1/2', '0'], ['2', '0', '1', '0', '1/4'], ['1', '-1', '0', '1/4', '0']], '2', [-1, 0, -3, 0, 0]], ['-2', '3/2', '-11/8', '11/32', '-11/128']]], [['regression: random cascade 19', ['2', [['1', '0', '0', '-1/2', '0']], '5', [3, -3, 0, 0]], ['5', '-7/2', '-7/4', '-7/8']], ['regression: random cascade 20', ['3', [['1/2', '1/2', '0', '0', '0']], '5', [-1, -3, -3]], ['-3/2', '-5', '-5']], ['repair check: random cascade 9', ['3', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '100', [-2, 1]], ['-6', '15/2']], ['control: random cascade 7', ['1', [['1', '-1', '0', '1/4', '0'], ['1', '0', '0', '-1/2', '0']], '2', [1, 3, 1]], ['1', '2', '-1']], ['control: random cascade 8', ['1', [['1/2', '1/2', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '100', [-3, 3, -2, -2, 1]], ['-3/2', '-3/4', '1/8', '-31/16', '-47/32']], ['control: random cascade 10', ['1', [['1', '0', '0', '-1/2', '0'], ['1', '-1', '0', '1/4', '0']], '2', [-3, -1, 0]], ['-2', '1/2', '7/8']], ['control: random cascade 14', ['1', [['3', '0', '0', '0', '0'], ['1', '0', '0', '-1/2', '0']], '5', [-2, 3]], ['-5', '5/2']]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic bounded teaching model with a stipulated toy contract; exact rational arithmetic or fixed-decimal rounding keeps outputs strict JSON. It is not a production DSP library and claims no standards conformance. 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-digital_signal_filters-sos-cascade-saturation-input-gain-placement","generated_at":"2026-09-29T14:51:37.626099+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Cascaded second-order sections with per-stage saturation model fixed-point IIR hardware; state sharing or gain staging slips change clipping.","repair":"Scale the input before the first section.","root_cause":"The scalar gain multiplies the cascade output instead of the input.","sha256":"d94c0b625e9f2a7f56a1a645e0c3f542aa2200b45dbee997a70961335d122468","title":"SOS cascade applies the gain after the last section · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.468,"exit_code":1,"observations":[{"actual":["6","6","6"],"check":"regression: gain before saturation","expected":["2","2","2"],"passed":false},{"actual":["3/2","5/2","19/8","9/16"],"check":"regression: three sections","expected":["3","5","19/4","9/8"],"passed":false},{"actual":["3/4","7/8","3/4","13/32","-15/64","9/32"],"check":"repair check: random cascade 0","expected":["3/2","7/4","3/2","13/16","-15/32","9/16"],"passed":false},{"actual":["4","4","-3","3"],"check":"control: two sections saturating","expected":["4","4","-3","3"],"passed":true},{"actual":["-2","3/2","-11/8","11/32","-11/128"],"check":"control: random cascade 3","expected":["-2","3/2","-11/8","11/32","-11/128"],"passed":true},{"actual":["1","2","-1"],"check":"control: random cascade 7","expected":["1","2","-1"],"passed":true},{"actual":["-3/2","-3/4","1/8","-31/16","-47/32"],"check":"control: random cascade 8","expected":["-3/2","-3/4","1/8","-31/16","-47/32"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: gain before saturation\", \"actual\": [\"6\", \"6\", \"6\"], \"expected\": [\"2\", \"2\", \"2\"], \"passed\": false}, {\"check\": \"regression: three sections\", \"actual\": [\"3/2\", \"5/2\", \"19/8\", \"9/16\"], \"expected\": [\"3\", \"5\", \"19/4\", \"9/8\"], \"passed\": false}, {\"check\": \"repair check: random cascade 0\", \"actual\": [\"3/4\", \"7/8\", \"3/4\", \"13/32\", \"-15/64\", \"9/32\"], \"expected\": [\"3/2\", \"7/4\", \"3/2\", \"13/16\", \"-15/32\", \"9/16\"], \"passed\": false}, {\"check\": \"control: two sections saturating\", \"actual\": [\"4\", \"4\", \"-3\", \"3\"], \"expected\": [\"4\", \"4\", \"-3\", \"3\"], \"passed\": true}, {\"check\": \"control: random cascade 3\", \"actual\": [\"-2\", \"3/2\", \"-11/8\", \"11/32\", \"-11/128\"], \"expected\": [\"-2\", \"3/2\", \"-11/8\", \"11/32\", \"-11/128\"], \"passed\": true}, {\"check\": \"control: random cascade 7\", \"actual\": [\"1\", \"2\", \"-1\"], \"expected\": [\"1\", \"2\", \"-1\"], \"passed\": true}, {\"check\": \"control: random cascade 8\", \"actual\": [\"-3/2\", \"-3/4\", \"1/8\", \"-31/16\", \"-47/32\"], \"expected\": [\"-3/2\", \"-3/4\", \"1/8\", \"-31/16\", \"-47/32\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.425,"exit_code":1,"observations":[{"actual":["3","9/2","21/4"],"check":"regression: gain before saturation","expected":["2","2","2"],"passed":false},{"actual":["5/2","5/2","5/2","1/2"],"check":"regression: three sections","expected":["3","5","19/4","9/8"],"passed":false},{"actual":["3/2","7/4","3/2","13/16","-15/32","9/16"],"check":"repair check: random cascade 0","expected":["3/2","7/4","3/2","13/16","-15/32","9/16"],"passed":true},{"actual":["4","4","-3","3"],"check":"control: two sections saturating","expected":["4","4","-3","3"],"passed":true},{"actual":["-2","3/2","-11/8","11/32","-11/128"],"check":"control: random cascade 3","expected":["-2","3/2","-11/8","11/32","-11/128"],"passed":true},{"actual":["1","2","-1"],"check":"control: random cascade 7","expected":["1","2","-1"],"passed":true},{"actual":["-3/2","-3/4","1/8","-31/16","-47/32"],"check":"control: random cascade 8","expected":["-3/2","-3/4","1/8","-31/16","-47/32"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: gain before saturation\", \"actual\": [\"3\", \"9/2\", \"21/4\"], \"expected\": [\"2\", \"2\", \"2\"], \"passed\": false}, {\"check\": \"regression: three sections\", \"actual\": [\"5/2\", \"5/2\", \"5/2\", \"1/2\"], \"expected\": [\"3\", \"5\", \"19/4\", \"9/8\"], \"passed\": false}, {\"check\": \"repair check: random cascade 0\", \"actual\": [\"3/2\", \"7/4\", \"3/2\", \"13/16\", \"-15/32\", \"9/16\"], \"expected\": [\"3/2\", \"7/4\", \"3/2\", \"13/16\", \"-15/32\", \"9/16\"], \"passed\": true}, {\"check\": \"control: two sections saturating\", \"actual\": [\"4\", \"4\", \"-3\", \"3\"], \"expected\": [\"4\", \"4\", \"-3\", \"3\"], \"passed\": true}, {\"check\": \"control: random cascade 3\", \"actual\": [\"-2\", \"3/2\", \"-11/8\", \"11/32\", \"-11/128\"], \"expected\": [\"-2\", \"3/2\", \"-11/8\", \"11/32\", \"-11/128\"], \"passed\": true}, {\"check\": \"control: random cascade 7\", \"actual\": [\"1\", \"2\", \"-1\"], \"expected\": [\"1\", \"2\", \"-1\"], \"passed\": true}, {\"check\": \"control: random cascade 8\", \"actual\": [\"-3/2\", \"-3/4\", \"1/8\", \"-31/16\", \"-47/32\"], \"expected\": [\"-3/2\", \"-3/4\", \"1/8\", \"-31/16\", \"-47/32\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.867,"exit_code":0,"observations":[{"actual":["2","2","2"],"check":"regression: gain before saturation","expected":["2","2","2"],"passed":true},{"actual":["3","5","19/4","9/8"],"check":"regression: three sections","expected":["3","5","19/4","9/8"],"passed":true},{"actual":["3/2","7/4","3/2","13/16","-15/32","9/16"],"check":"repair check: random cascade 0","expected":["3/2","7/4","3/2","13/16","-15/32","9/16"],"passed":true},{"actual":["4","4","-3","3"],"check":"control: two sections saturating","expected":["4","4","-3","3"],"passed":true},{"actual":["-2","3/2","-11/8","11/32","-11/128"],"check":"control: random cascade 3","expected":["-2","3/2","-11/8","11/32","-11/128"],"passed":true},{"actual":["1","2","-1"],"check":"control: random cascade 7","expected":["1","2","-1"],"passed":true},{"actual":["-3/2","-3/4","1/8","-31/16","-47/32"],"check":"control: random cascade 8","expected":["-3/2","-3/4","1/8","-31/16","-47/32"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: gain before saturation\", \"actual\": [\"2\", \"2\", \"2\"], \"expected\": [\"2\", \"2\", \"2\"], \"passed\": true}, {\"check\": \"regression: three sections\", \"actual\": [\"3\", \"5\", \"19/4\", \"9/8\"], \"expected\": [\"3\", \"5\", \"19/4\", \"9/8\"], \"passed\": true}, {\"check\": \"repair check: random cascade 0\", \"actual\": [\"3/2\", \"7/4\", \"3/2\", \"13/16\", \"-15/32\", \"9/16\"], \"expected\": [\"3/2\", \"7/4\", \"3/2\", \"13/16\", \"-15/32\", \"9/16\"], \"passed\": true}, {\"check\": \"control: two sections saturating\", \"actual\": [\"4\", \"4\", \"-3\", \"3\"], \"expected\": [\"4\", \"4\", \"-3\", \"3\"], \"passed\": true}, {\"check\": \"control: random cascade 3\", \"actual\": [\"-2\", \"3/2\", \"-11/8\", \"11/32\", \"-11/128\"], \"expected\": [\"-2\", \"3/2\", \"-11/8\", \"11/32\", \"-11/128\"], \"passed\": true}, {\"check\": \"control: random cascade 7\", \"actual\": [\"1\", \"2\", \"-1\"], \"expected\": [\"1\", \"2\", \"-1\"], \"passed\": true}, {\"check\": \"control: random cascade 8\", \"actual\": [\"-3/2\", \"-3/4\", \"1/8\", \"-31/16\", \"-47/32\"], \"expected\": [\"-3/2\", \"-3/4\", \"1/8\", \"-31/16\", \"-47/32\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}