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

N = 1
observations = []
def solve(d):
    return {'projection': d['ctype'][5:8], 'frequency_hz': d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']], 'reference_pixel': 1 if d['crpix'] is None else d['crpix'], 'dimension': d['naxis'], 'selected_suffix': next(k for k,v in d['names'].items() if v==d['name']), 'projection_parameter': d['pv'][d['world']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 8, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 8, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 8, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 8000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 8000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 8, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 8, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 8, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 2: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 9, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 9, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 9, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 9000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 9000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 9, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 9, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 9, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 3: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 10, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 10, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 10, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 10000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 10000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 10, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 10, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 10, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 4: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 11, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 11, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 11, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 11000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 11000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 11, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 11, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 11, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 5: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 12, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 12, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 12, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 12000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 12000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 12, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 12, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 12, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})]}
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-wcs-header-card-semantics

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

N = 1
observations = []
def solve(d):
    return {'projection': d['ctype'][5:8], 'frequency_hz': d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']], 'reference_pixel': 1 if d['crpix'] is None else d['crpix'], 'dimension': d['wcsaxes'], 'selected_suffix': next(k for k,v in d['names'].items() if v==d['name']), 'projection_parameter': d['pv'][d['world']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 8, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 8, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 8, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 8000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 8000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 8, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 8, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 8, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 2: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 9, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 9, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 9, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 9000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 9000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 9, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 9, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 9, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 3: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 10, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 10, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 10, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 10000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 10000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 10, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 10, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 10, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 4: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 11, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 11, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 11, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 11000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 11000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 11, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 11, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 11, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 5: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 12, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 12, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 12, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 12000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 12000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 12, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 12, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 12, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})]}
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 dimension while other fields remain valid.

A bounded FITS-like header adapter parses the projection code at CTYPE characters 5:8, supports exact case-sensitive frequency units Hz,kHz,MHz,mHz, defaults absent CRPIX to one but preserves explicit zero, resolves WCSNAME to its suffix, and binds PV parameters to world-axis number. Effective dimensionality is max(NAXIS,WCSAXES). Output fields are defined by: projection = d['ctype'][5:8]; frequency_hz = d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']]; reference_pixel = 1 if d['crpix'] is None else d['crpix']; dimension = max(d['naxis'],d['wcsaxes']); selected_suffix = next(k for k,v in d['names'].items() if v==d['name']); projection_parameter = d['pv'][d['world']]

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'projection': d['ctype'][5:8], 'frequency_hz': d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']], 'reference_pixel': 1 if d['crpix'] is None else d['crpix'], 'dimension': max(d['naxis'],d['wcsaxes']), 'selected_suffix': d['name'], 'projection_parameter': d['pv'][d['world']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 8, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 8, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 8, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 8000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 8000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 8, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 8, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 8, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 2: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 9, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 9, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 9, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 9000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 9000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 9, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 9, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 9, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 3: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 10, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 10, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 10, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 10000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 10000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 10, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 10, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 10, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 4: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 11, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 11, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 11, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 11000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 11000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 11, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 11, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 11, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 5: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 12, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 12, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 12, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 12000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 12000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 12, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 12, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 12, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})]}
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-wcs-header-card-semantics

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

N = 1
observations = []
def solve(d):
    return {'projection': d['ctype'][5:8], 'frequency_hz': d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']], 'reference_pixel': 1 if d['crpix'] is None else d['crpix'], 'dimension': max(d['naxis'],d['wcsaxes']), 'selected_suffix': d['name'][:1], 'projection_parameter': d['pv'][d['world']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 8, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 8, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 8, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 8000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 8000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 8, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 8, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 8, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 2: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 9, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 9, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 9, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 9000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 9000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 9, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 9, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 9, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 3: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 10, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 10, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 10, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 10000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 10000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 10, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 10, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 10, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 4: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 11, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 11, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 11, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 11000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 11000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 11, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 11, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 11, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 5: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 12, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 12, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 12, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 12000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 12000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 12, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 12, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 12, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})]}
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 selected suffix while other fields remain valid.

A bounded FITS-like header adapter parses the projection code at CTYPE characters 5:8, supports exact case-sensitive frequency units Hz,kHz,MHz,mHz, defaults absent CRPIX to one but preserves explicit zero, resolves WCSNAME to its suffix, and binds PV parameters to world-axis number. Effective dimensionality is max(NAXIS,WCSAXES). Output fields are defined by: projection = d['ctype'][5:8]; frequency_hz = d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']]; reference_pixel = 1 if d['crpix'] is None else d['crpix']; dimension = max(d['naxis'],d['wcsaxes']); selected_suffix = next(k for k,v in d['names'].items() if v==d['name']); projection_parameter = d['pv'][d['world']]

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'projection': d['ctype'][5:8], 'frequency_hz': d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']], 'reference_pixel': 1 if d['crpix'] is None else d['crpix'], 'dimension': max(d['naxis'],d['wcsaxes']), 'selected_suffix': next(k for k,v in d['names'].items() if v==d['name']), 'projection_parameter': d['pv'][d['pixel']]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 8, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 8, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 8, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 8000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 8000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 8, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 8, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 8, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 2: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 9, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 9, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 9, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 9000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 9000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 9, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 9, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 9, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 3: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 10, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 10, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 10, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 10000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 10000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 10, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 10, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 10, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 4: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 11, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 11, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 11, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 11000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 11000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 11, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 11, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 11, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 5: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 12, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 12, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 12, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 12000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 12000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 12, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 12, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 12, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})]}
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-wcs-header-card-semantics

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

N = 1
observations = []
def solve(d):
    return {'projection': d['ctype'][5:8], 'frequency_hz': d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']], 'reference_pixel': 1 if d['crpix'] is None else d['crpix'], 'dimension': max(d['naxis'],d['wcsaxes']), 'selected_suffix': next(k for k,v in d['names'].items() if v==d['name']), 'projection_parameter': d['pv'][0]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 8, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 8, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 8, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 8000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 8, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 8000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 8, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.008, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 8, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 8, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 2: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 9, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 9, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 9, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 9000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 9, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 9000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 9, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.009000000000000001, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 9, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 9, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 3: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 10, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 10, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 10, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 10000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 10, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 10000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 10, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.01, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 10, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 10, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 4: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 11, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 11, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 11, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 11000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 11, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 11000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 11, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.011, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 11, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 11, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})], 5: [({'ctype': 'RA---TAN-SIP', 'unit': 'mHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'DEC--SIN', 'unit': 'Hz', 'frequency': 12, 'crpix': None, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'SIN', 'frequency_hz': 12, 'reference_pixel': 1, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'GLON-CAR', 'unit': 'kHz', 'frequency': 12, 'crpix': 0, 'naxis': 4, 'wcsaxes': 2, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'CAR', 'frequency_hz': 12000, 'reference_pixel': 0, 'dimension': 4, 'selected_suffix': 'A', 'projection_parameter': 7}), ({'ctype': 'FREQ-LOG', 'unit': 'MHz', 'frequency': 12, 'crpix': 0, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'A'}, 'name': 'A', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 1, 'pixel': 2}, {'projection': 'LOG', 'frequency_hz': 12000000, 'reference_pixel': 0, 'dimension': 3, 'selected_suffix': 'A', 'projection_parameter': 5}), ({'ctype': 'RA---TAN', 'unit': 'mHz', 'frequency': 12, 'crpix': 3, 'naxis': 2, 'wcsaxes': 3, 'names': {'': 'primary', 'A': 'other'}, 'name': 'primary', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 2, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 0.012, 'reference_pixel': 3, 'dimension': 3, 'selected_suffix': '', 'projection_parameter': 7}), ({'ctype': 'DEC--TAN-SIP', 'unit': 'Hz', 'frequency': 12, 'crpix': 0, 'naxis': 1, 'wcsaxes': 1, 'names': {'': 'primary', 'A': 'target'}, 'name': 'target', 'pv': {0: 2, 1: 5, 2: 7}, 'world': 0, 'pixel': 1}, {'projection': 'TAN', 'frequency_hz': 12, 'reference_pixel': 0, 'dimension': 1, 'selected_suffix': 'A', 'projection_parameter': 2})]}
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 projection parameter while other fields remain valid.

A bounded FITS-like header adapter parses the projection code at CTYPE characters 5:8, supports exact case-sensitive frequency units Hz,kHz,MHz,mHz, defaults absent CRPIX to one but preserves explicit zero, resolves WCSNAME to its suffix, and binds PV parameters to world-axis number. Effective dimensionality is max(NAXIS,WCSAXES). Output fields are defined by: projection = d['ctype'][5:8]; frequency_hz = d['frequency']*{'Hz':1,'kHz':1000,'MHz':1000000,'mHz':0.001}[d['unit']]; reference_pixel = 1 if d['crpix'] is None else d['crpix']; dimension = max(d['naxis'],d['wcsaxes']); selected_suffix = next(k for k,v in d['names'].items() if v==d['name']); projection_parameter = d['pv'][d['world']]

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] in x["commits"]
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['replacement-digest'], expected[N-1])
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)

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

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][0] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['replacement-digest'], expected[N-1])
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:
An old sealed envelope remains revealable after a replacement commit.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision replacement-digest: Compare the reveal only with the last accepted commitment.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["reveal_round"] <= x["close"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes / same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes / outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['reveal-phase'], expected[N-1])
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)

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

N = 1
observations = []
def solve(x):
    v0 = x["revealed"] == (x["commits"][-1] if x["commits"] else None)
    v1 = x["commit_round"] < x["reveal_round"]
    v2 = None if x["withdrawn"] else x["digest"]
    v3 = [] if x["opened"] else x["payloads"][:1]
    v4 = next((p for p,v in zip(x["payloads"],x["valid"]) if v),None)
    v5 = x["nonce"] == x["required_nonce"]
    v6 = x["owner"] == x["signer"]
    v7 = x["sealed_value"] if x["opened"] else x["public_value"]
    v8 = x["lot"] == x["reveal_lot"]
    v9 = sum(1 for v in x["valid"] if v)
    return {'replacement-digest':v0,'reveal-phase':v1,'withdrawal-tombstone':v2,'replay-disclosure':v3,'first-valid-reveal':v4,'nonce-binding':v5,'signer-binding':v6,'preopening-secrecy':v7,'lot-binding':v8,'verified-reveal-count':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes / same-round premature reveal', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 1, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('two verified envelopes / outside reveal round', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 3, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [False, False, False, False, False]), ('normal contract', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('two verified envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [True, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('valid last envelope', {'digest': 'v2', 'revealed': 'v2', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('first envelope only', {'digest': 'v1', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': ['v1'], 'payloads': ['red'], 'valid': [True], 'reveal_count': 1, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('no envelopes', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': False, 'commits': [], 'payloads': [], 'valid': [], 'reveal_count': 0, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('withdrawn before opening', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': True, 'opened': False, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True]), ('opened envelope replay', {'digest': 'v2', 'revealed': 'v1', 'commit_round': 1, 'reveal_round': 2, 'close': 2, 'withdrawn': False, 'opened': True, 'commits': ['v1', 'v2'], 'payloads': ['red', 'blue'], 'valid': [False, True], 'reveal_count': 2, 'nonce': 'n', 'required_nonce': 'n', 'owner': 'alice', 'signer': 'alice', 'sealed_value': 9, 'public_value': 0, 'lot': 'A', 'reveal_lot': 'A'}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'reveal_count', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['reveal-phase'], expected[N-1])
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:
Reveal admission loses one side of the commit/reveal phase interval.

Stipulated sealed-bid envelope processing: one bidder, one lot, a commit and reveal phase. A replacement commit invalidates an earlier digest. Reveal payloads are immutable, phase counters are integers, and byte strings are represented by ordinary strings. Output named admission decisions and retained payloads. Named decision reveal-phase: Require a later phase than commitment and no phase after close.

split: open-access