broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference_x': (d['rx']-d['sx']-(d['bx']+1)/2)/d['bx']+1, 'reference_y': (d['ry']-d['sy']-(d['by']+1)/2)/d['by']+1, 'plate_scale': d['scale']*d['bx'], 'spectral_step': d['disp']*d['by'], 'footprint_pixels': d['bx']+d['by'], 'last_center_x': d['sx']+(d['bx']+1)/2+(d['nx']-1)*d['bx']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 11.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 13, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 2: [({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 12.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 14, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.333333333333334, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 3: [({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 13.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 15, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.666666666666666, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 4: [({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 14.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 16, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 5: [({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 15.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 17, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.333333333333333, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

evaluation_group: astro-binned-detector-centers

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference_x': (d['rx']-d['sx']-(d['bx']+1)/2)/d['bx']+1, 'reference_y': (d['ry']-d['sy']-(d['by']+1)/2)/d['by']+1, 'plate_scale': d['scale']*d['bx'], 'spectral_step': d['disp']*d['by'], 'footprint_pixels': d['bx']**2, 'last_center_x': d['sx']+(d['bx']+1)/2+(d['nx']-1)*d['bx']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 11.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 13, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 2: [({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 12.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 14, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.333333333333334, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 3: [({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 13.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 15, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.666666666666666, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 4: [({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 14.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 16, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 5: [({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 15.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 17, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.333333333333333, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

prompt:
The adapter reports an incorrect footprint pixels while other fields remain valid.

Pixel centers are one-based. A bin of bx by by starts at zero-based crop sx,sy. Its first center is start+(bin+1)/2. The supplied dispersion and plate scales are per unbinned pixel; bin integral weights count physical contributing pixels. Output fields are defined by: reference_x = (d['rx']-d['sx']-(d['bx']+1)/2)/d['bx']+1; reference_y = (d['ry']-d['sy']-(d['by']+1)/2)/d['by']+1; plate_scale = d['scale']*d['bx']; spectral_step = d['disp']*d['by']; footprint_pixels = d['bx']*d['by']; last_center_x = d['sx']+(d['bx']+1)/2+(d['nx']-1)*d['bx']

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference_x': (d['rx']-d['sx']-(d['bx']+1)/2)/d['bx']+1, 'reference_y': (d['ry']-d['sy']-(d['by']+1)/2)/d['by']+1, 'plate_scale': d['scale']*d['bx'], 'spectral_step': d['disp']*d['by'], 'footprint_pixels': d['bx']*d['by'], 'last_center_x': d['sx']+d['nx']*d['bx']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 11.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 13, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 2: [({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 12.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 14, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.333333333333334, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 3: [({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 13.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 15, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.666666666666666, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 4: [({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 14.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 16, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 5: [({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 15.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 17, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.333333333333333, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

evaluation_group: astro-binned-detector-centers

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference_x': (d['rx']-d['sx']-(d['bx']+1)/2)/d['bx']+1, 'reference_y': (d['ry']-d['sy']-(d['by']+1)/2)/d['by']+1, 'plate_scale': d['scale']*d['bx'], 'spectral_step': d['disp']*d['by'], 'footprint_pixels': d['bx']*d['by'], 'last_center_x': d['sx']+(d['bx']+1)/2+d['nx']*d['bx']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 11.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 13, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 13, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 5.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 2: [({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 12.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 14, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.333333333333334, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 14, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 3: [({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 13.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 15, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 4.666666666666666, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 15, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 6.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 4: [({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 14.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 16, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.25, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.0, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 16, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.25, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})], 5: [({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 1, 'by': 1, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 15.0, 'reference_y': 18.0, 'plate_scale': 3, 'spectral_step': 5, 'footprint_pixels': 1, 'last_center_x': 14.0}), ({'rx': 17, 'ry': 21, 'sx': 0, 'sy': 0, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 8.75, 'reference_y': 5.625, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 23.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 3, 'by': 2, 'scale': 3, 'disp': 5, 'nx': 12, 'ny': 16}, {'reference_x': 5.333333333333333, 'reference_y': 9.25, 'plate_scale': 9, 'spectral_step': 10, 'footprint_pixels': 6, 'last_center_x': 37.0}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': -2, 'disp': -3, 'nx': 12, 'ny': 16}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': -4, 'spectral_step': -12, 'footprint_pixels': 8, 'last_center_x': 25.5}), ({'rx': 17, 'ry': 21, 'sx': 2, 'sy': 3, 'bx': 2, 'by': 4, 'scale': 3, 'disp': 5, 'nx': 1, 'ny': 1}, {'reference_x': 7.75, 'reference_y': 4.875, 'plate_scale': 6, 'spectral_step': 20, 'footprint_pixels': 8, 'last_center_x': 3.5})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

prompt:
The adapter reports an incorrect last center x while other fields remain valid.

Pixel centers are one-based. A bin of bx by by starts at zero-based crop sx,sy. Its first center is start+(bin+1)/2. The supplied dispersion and plate scales are per unbinned pixel; bin integral weights count physical contributing pixels. Output fields are defined by: reference_x = (d['rx']-d['sx']-(d['bx']+1)/2)/d['bx']+1; reference_y = (d['ry']-d['sy']-(d['by']+1)/2)/d['by']+1; plate_scale = d['scale']*d['bx']; spectral_step = d['disp']*d['by']; footprint_pixels = d['bx']*d['by']; last_center_x = d['sx']+(d['bx']+1)/2+(d['nx']-1)*d['bx']

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']-d['r'], 'pixel': d['L']+1-d['p'], 'increment': -d['step'], 'quadratic': d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

evaluation_group: astro-spectral-axis-reversal

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1+d['r'], 'pixel': d['L']+1-d['p'], 'increment': -d['step'], 'quadratic': d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

prompt:
The adapter reports an incorrect reference while other fields remain valid.

Reverse a finite spectral pixel axis of length L using one-based pixel labels. Reference pixel, edge pixel coordinates, dispersion coefficients, and velocity-increment metadata must describe the same physical samples. Quadratic coefficient is unchanged under reversal about the reference. Output fields are defined by: reference = d['L']+1-d['r']; pixel = d['L']+1-d['p']; increment = -d['step']; quadratic = d['q']; velocity_increment = -d['vel']; interval = [d['L']+1-d['hi'],d['L']+1-d['lo']]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1-d['r'], 'pixel': d['p'], 'increment': -d['step'], 'quadratic': d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

evaluation_group: astro-spectral-axis-reversal

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1-d['r'], 'pixel': d['L']-d['p'], 'increment': -d['step'], 'quadratic': d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

prompt:
The adapter reports an incorrect pixel while other fields remain valid.

Reverse a finite spectral pixel axis of length L using one-based pixel labels. Reference pixel, edge pixel coordinates, dispersion coefficients, and velocity-increment metadata must describe the same physical samples. Quadratic coefficient is unchanged under reversal about the reference. Output fields are defined by: reference = d['L']+1-d['r']; pixel = d['L']+1-d['p']; increment = -d['step']; quadratic = d['q']; velocity_increment = -d['vel']; interval = [d['L']+1-d['hi'],d['L']+1-d['lo']]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1-d['r'], 'pixel': d['L']+1-d['p'], 'increment': d['step'], 'quadratic': d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

evaluation_group: astro-spectral-axis-reversal

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1-d['r'], 'pixel': d['L']+1-d['p'], 'increment': abs(d['step']), 'quadratic': d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

prompt:
The adapter reports an incorrect increment while other fields remain valid.

Reverse a finite spectral pixel axis of length L using one-based pixel labels. Reference pixel, edge pixel coordinates, dispersion coefficients, and velocity-increment metadata must describe the same physical samples. Quadratic coefficient is unchanged under reversal about the reference. Output fields are defined by: reference = d['L']+1-d['r']; pixel = d['L']+1-d['p']; increment = -d['step']; quadratic = d['q']; velocity_increment = -d['vel']; interval = [d['L']+1-d['hi'],d['L']+1-d['lo']]

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1-d['r'], 'pixel': d['L']+1-d['p'], 'increment': -d['step'], 'quadratic': -d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

evaluation_group: astro-spectral-axis-reversal

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'reference': d['L']+1-d['r'], 'pixel': d['L']+1-d['p'], 'increment': -d['step'], 'quadratic': abs(d['q']) if d['step']>0 else -d['q'], 'velocity_increment': -d['vel'], 'interval': [d['L']+1-d['hi'],d['L']+1-d['lo']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 1, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 6, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 6, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 15, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 20, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 6, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 7, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 2: [({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 2, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 7, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 7, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 14, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 21, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 0, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 7, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 6, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 3: [({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 3, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 8, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 8, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 13, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 22, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -1, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 8, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 5, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 4: [({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 4, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 9, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 9, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 12, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 23, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -2, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 9, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 4, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})], 5: [({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 1, 'r': 5, 'p': 1, 'step': 2, 'q': 3, 'vel': 5, 'lo': 1, 'hi': 1}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [1, 1]}), ({'L': 20, 'r': 10, 'p': 3, 'step': -3, 'q': 3, 'vel': -7, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': 3, 'quadratic': 3, 'velocity_increment': 7, 'interval': [12, 19]}), ({'L': 20, 'r': 10, 'p': 3, 'step': 2, 'q': 0, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': 11, 'pixel': 18, 'increment': -2, 'quadratic': 0, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 20, 'r': 24, 'p': 20, 'step': 2, 'q': 3, 'vel': 5, 'lo': 2, 'hi': 9}, {'reference': -3, 'pixel': 1, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [12, 19]}), ({'L': 12, 'r': 10, 'p': 3, 'step': 2, 'q': 3, 'vel': 5, 'lo': 3, 'hi': 4}, {'reference': 3, 'pixel': 10, 'increment': -2, 'quadratic': 3, 'velocity_increment': -5, 'interval': [9, 10]})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), 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)

prompt:
The adapter reports an incorrect quadratic while other fields remain valid.

Reverse a finite spectral pixel axis of length L using one-based pixel labels. Reference pixel, edge pixel coordinates, dispersion coefficients, and velocity-increment metadata must describe the same physical samples. Quadratic coefficient is unchanged under reversal about the reference. Output fields are defined by: reference = d['L']+1-d['r']; pixel = d['L']+1-d['p']; increment = -d['step']; quadratic = d['q']; velocity_increment = -d['vel']; interval = [d['L']+1-d['hi'],d['L']+1-d['lo']]

split: open-access