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

N = 1
observations = []
def solve(d):
    return {'lsr_frequency': d['f']+d['a']+d['b'], 'geocentric_frequency': d['f']+d['a']-d['g'], 'apply_barycentric': d['f'] if d['bary_done'] else d['f']+d['a'], 'apply_lsr': d['f'] if d['lsr_done'] else d['f']+d['b'], 'recover_topocentric': d['f']-d['a']-d['b'], 'lsr_from_geocenter': d['f']+d['a']+d['b']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 104, 'apply_lsr': 107, 'recover_topocentric': 89, 'lsr_from_geocenter': 109}), ({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 100, 'apply_lsr': 107, 'recover_topocentric': 89, 'lsr_from_geocenter': 109}), ({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 104, 'apply_lsr': 100, 'recover_topocentric': 89, 'lsr_from_geocenter': 109}), ({'f': 100, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 100, 'geocentric_frequency': 100, 'apply_barycentric': 100, 'apply_lsr': 100, 'recover_topocentric': 100, 'lsr_from_geocenter': 100}), ({'f': 100, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 99, 'geocentric_frequency': 95, 'apply_barycentric': 97, 'apply_lsr': 102, 'recover_topocentric': 101, 'lsr_from_geocenter': 104}), ({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 100, 'apply_lsr': 100, 'recover_topocentric': 89, 'lsr_from_geocenter': 109})], 2: [({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 105, 'apply_lsr': 108, 'recover_topocentric': 90, 'lsr_from_geocenter': 110}), ({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 101, 'apply_lsr': 108, 'recover_topocentric': 90, 'lsr_from_geocenter': 110}), ({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 105, 'apply_lsr': 101, 'recover_topocentric': 90, 'lsr_from_geocenter': 110}), ({'f': 101, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 101, 'geocentric_frequency': 101, 'apply_barycentric': 101, 'apply_lsr': 101, 'recover_topocentric': 101, 'lsr_from_geocenter': 101}), ({'f': 101, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 100, 'geocentric_frequency': 96, 'apply_barycentric': 98, 'apply_lsr': 103, 'recover_topocentric': 102, 'lsr_from_geocenter': 105}), ({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 101, 'apply_lsr': 101, 'recover_topocentric': 90, 'lsr_from_geocenter': 110})], 3: [({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 106, 'apply_lsr': 109, 'recover_topocentric': 91, 'lsr_from_geocenter': 111}), ({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 102, 'apply_lsr': 109, 'recover_topocentric': 91, 'lsr_from_geocenter': 111}), ({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 106, 'apply_lsr': 102, 'recover_topocentric': 91, 'lsr_from_geocenter': 111}), ({'f': 102, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 102, 'geocentric_frequency': 102, 'apply_barycentric': 102, 'apply_lsr': 102, 'recover_topocentric': 102, 'lsr_from_geocenter': 102}), ({'f': 102, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 101, 'geocentric_frequency': 97, 'apply_barycentric': 99, 'apply_lsr': 104, 'recover_topocentric': 103, 'lsr_from_geocenter': 106}), ({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 102, 'apply_lsr': 102, 'recover_topocentric': 91, 'lsr_from_geocenter': 111})], 4: [({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 107, 'apply_lsr': 110, 'recover_topocentric': 92, 'lsr_from_geocenter': 112}), ({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 103, 'apply_lsr': 110, 'recover_topocentric': 92, 'lsr_from_geocenter': 112}), ({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 107, 'apply_lsr': 103, 'recover_topocentric': 92, 'lsr_from_geocenter': 112}), ({'f': 103, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 103, 'geocentric_frequency': 103, 'apply_barycentric': 103, 'apply_lsr': 103, 'recover_topocentric': 103, 'lsr_from_geocenter': 103}), ({'f': 103, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 102, 'geocentric_frequency': 98, 'apply_barycentric': 100, 'apply_lsr': 105, 'recover_topocentric': 104, 'lsr_from_geocenter': 107}), ({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 103, 'apply_lsr': 103, 'recover_topocentric': 92, 'lsr_from_geocenter': 112})], 5: [({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 108, 'apply_lsr': 111, 'recover_topocentric': 93, 'lsr_from_geocenter': 113}), ({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 104, 'apply_lsr': 111, 'recover_topocentric': 93, 'lsr_from_geocenter': 113}), ({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 108, 'apply_lsr': 104, 'recover_topocentric': 93, 'lsr_from_geocenter': 113}), ({'f': 104, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 104, 'geocentric_frequency': 104, 'apply_barycentric': 104, 'apply_lsr': 104, 'recover_topocentric': 104, 'lsr_from_geocenter': 104}), ({'f': 104, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 103, 'geocentric_frequency': 99, 'apply_barycentric': 101, 'apply_lsr': 106, 'recover_topocentric': 105, 'lsr_from_geocenter': 108}), ({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 104, 'apply_lsr': 104, 'recover_topocentric': 93, 'lsr_from_geocenter': 113})]}
for i, (record, expected) in enumerate(fixtures[N]):
    check('astronomical fixture %s' % i, solve(record), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: astro-spectral-reference-frame-chain

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

N = 1
observations = []
def solve(d):
    return {'lsr_frequency': d['f']+d['a']+d['b'], 'geocentric_frequency': d['f']+d['a']-d['g'], 'apply_barycentric': d['f'] if d['bary_done'] else d['f']+d['a'], 'apply_lsr': d['f'] if d['lsr_done'] else d['f']+d['b'], 'recover_topocentric': d['f']-d['a']-d['b'], 'lsr_from_geocenter': d['f']+d['b']}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 104, 'apply_lsr': 107, 'recover_topocentric': 89, 'lsr_from_geocenter': 109}), ({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 100, 'apply_lsr': 107, 'recover_topocentric': 89, 'lsr_from_geocenter': 109}), ({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 104, 'apply_lsr': 100, 'recover_topocentric': 89, 'lsr_from_geocenter': 109}), ({'f': 100, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 100, 'geocentric_frequency': 100, 'apply_barycentric': 100, 'apply_lsr': 100, 'recover_topocentric': 100, 'lsr_from_geocenter': 100}), ({'f': 100, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 99, 'geocentric_frequency': 95, 'apply_barycentric': 97, 'apply_lsr': 102, 'recover_topocentric': 101, 'lsr_from_geocenter': 104}), ({'f': 100, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 111, 'geocentric_frequency': 102, 'apply_barycentric': 100, 'apply_lsr': 100, 'recover_topocentric': 89, 'lsr_from_geocenter': 109})], 2: [({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 105, 'apply_lsr': 108, 'recover_topocentric': 90, 'lsr_from_geocenter': 110}), ({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 101, 'apply_lsr': 108, 'recover_topocentric': 90, 'lsr_from_geocenter': 110}), ({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 105, 'apply_lsr': 101, 'recover_topocentric': 90, 'lsr_from_geocenter': 110}), ({'f': 101, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 101, 'geocentric_frequency': 101, 'apply_barycentric': 101, 'apply_lsr': 101, 'recover_topocentric': 101, 'lsr_from_geocenter': 101}), ({'f': 101, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 100, 'geocentric_frequency': 96, 'apply_barycentric': 98, 'apply_lsr': 103, 'recover_topocentric': 102, 'lsr_from_geocenter': 105}), ({'f': 101, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 112, 'geocentric_frequency': 103, 'apply_barycentric': 101, 'apply_lsr': 101, 'recover_topocentric': 90, 'lsr_from_geocenter': 110})], 3: [({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 106, 'apply_lsr': 109, 'recover_topocentric': 91, 'lsr_from_geocenter': 111}), ({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 102, 'apply_lsr': 109, 'recover_topocentric': 91, 'lsr_from_geocenter': 111}), ({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 106, 'apply_lsr': 102, 'recover_topocentric': 91, 'lsr_from_geocenter': 111}), ({'f': 102, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 102, 'geocentric_frequency': 102, 'apply_barycentric': 102, 'apply_lsr': 102, 'recover_topocentric': 102, 'lsr_from_geocenter': 102}), ({'f': 102, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 101, 'geocentric_frequency': 97, 'apply_barycentric': 99, 'apply_lsr': 104, 'recover_topocentric': 103, 'lsr_from_geocenter': 106}), ({'f': 102, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 113, 'geocentric_frequency': 104, 'apply_barycentric': 102, 'apply_lsr': 102, 'recover_topocentric': 91, 'lsr_from_geocenter': 111})], 4: [({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 107, 'apply_lsr': 110, 'recover_topocentric': 92, 'lsr_from_geocenter': 112}), ({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 103, 'apply_lsr': 110, 'recover_topocentric': 92, 'lsr_from_geocenter': 112}), ({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 107, 'apply_lsr': 103, 'recover_topocentric': 92, 'lsr_from_geocenter': 112}), ({'f': 103, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 103, 'geocentric_frequency': 103, 'apply_barycentric': 103, 'apply_lsr': 103, 'recover_topocentric': 103, 'lsr_from_geocenter': 103}), ({'f': 103, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 102, 'geocentric_frequency': 98, 'apply_barycentric': 100, 'apply_lsr': 105, 'recover_topocentric': 104, 'lsr_from_geocenter': 107}), ({'f': 103, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 114, 'geocentric_frequency': 105, 'apply_barycentric': 103, 'apply_lsr': 103, 'recover_topocentric': 92, 'lsr_from_geocenter': 112})], 5: [({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 108, 'apply_lsr': 111, 'recover_topocentric': 93, 'lsr_from_geocenter': 113}), ({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': False}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 104, 'apply_lsr': 111, 'recover_topocentric': 93, 'lsr_from_geocenter': 113}), ({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': False, 'lsr_done': True}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 108, 'apply_lsr': 104, 'recover_topocentric': 93, 'lsr_from_geocenter': 113}), ({'f': 104, 'a': 0, 'b': 0, 'g': 0, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 104, 'geocentric_frequency': 104, 'apply_barycentric': 104, 'apply_lsr': 104, 'recover_topocentric': 104, 'lsr_from_geocenter': 104}), ({'f': 104, 'a': -3, 'b': 2, 'g': 2, 'bary_done': False, 'lsr_done': False}, {'lsr_frequency': 103, 'geocentric_frequency': 99, 'apply_barycentric': 101, 'apply_lsr': 106, 'recover_topocentric': 105, 'lsr_from_geocenter': 108}), ({'f': 104, 'a': 4, 'b': 7, 'g': 2, 'bary_done': True, 'lsr_done': True}, {'lsr_frequency': 115, 'geocentric_frequency': 106, 'apply_barycentric': 104, 'apply_lsr': 104, 'recover_topocentric': 93, 'lsr_from_geocenter': 113})]}
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 lsr from geocenter while other fields remain valid.

A finite spectral frame adapter supplies topocentric frequency f and additive shifts a=topocentric-to-barycentric, b=barycentric-to-LSR, and g=geocentric-to-barycentric. These are stipulated precomputed coordinate shifts in common units, not physical velocity or Doppler formulas. Provenance booleans mark shifts already applied. Output fields are defined by: lsr_frequency = d['f']+d['a']+d['b']; geocentric_frequency = d['f']+d['a']-d['g']; apply_barycentric = d['f'] if d['bary_done'] else d['f']+d['a']; apply_lsr = d['f'] if d['lsr_done'] else d['f']+d['b']; recover_topocentric = d['f']-d['a']-d['b']; lsr_from_geocenter = d['f']+d['g']+d['b']

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'].split('-')[-1], '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']]}
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'][:3], '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']]}
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 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}[d['unit'].lower()], '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']]}
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'], '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']]}
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 frequency hz 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': d['crpix'] or 1, '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']]}
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': 0 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']]}
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 reference pixel 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