Skip to content

HST tint_for: NICMOS polariser branch unreachable in practice #21

@rfrenchseti

Description

@rfrenchseti

The HST tint_for elif chain at src/picmaker/instruments/hst.py:126-139 has branches that are documented but unreachable for the real-world instrument IDs they target.

Evidence

if 'NIC' in inst_id:  # noqa: SIM114
    wavelength *= 3.5
elif ('WFC3' in inst_id or 'IR' in inst_id) and wavelength < 200:  # noqa: SIM114
    wavelength *= 3.5
elif ('ACS' in inst_id or 'SBC' in inst_id) and wavelength < 200:
    wavelength *= 3.5
elif filter_name.startswith('FQUV'):
    wavelength = 300
elif filter_name.startswith('FQCH4'):
    wavelength = 900
elif filter_name == 'POL0S':
    wavelength = 110 * 3.5
elif filter_name == 'POL0L':
    wavelength = 220 * 3.5

The filter-name overrides only fire when none of 'NIC' in inst_id, 'WFC3' in inst_id, 'IR' in inst_id, 'ACS' in inst_id, 'SBC' in inst_id matched.

  • For a real WFPC2 FQUV1 filter, inst_id is 'WFPC2', which doesn't contain any of those substrings, so the FQUV* branch fires. Good.
  • For NICMOS POL0S / POL0L, 'NIC' in inst_id is true, so the polariser branches never fire. The unit test at tests/test_misc_branches.py:730-740 reaches them only by using inst_id='OTHER'.

The docstring at hst.py:96-98 says "NICMOS polarisers POL0S / POL0L are pinned to 110 nm and 220 nm before the NICMOS x3.5 scaling" — which is not what the code does today.

Impact

Low — current tests pin both the unreachable case (under realistic inst_id) and the reachable case (under inst_id='OTHER'), so behaviour is locked in. No known incorrect output in practice because NICMOS polariser images aren't routinely tinted with this code path, but the docstring and code disagree.

Suggested fix

Either:

  1. Reorder the chain so filter-name overrides take precedence over instrument-name scaling, or
  2. Explicitly fold the POL0S / POL0L special case into the NICMOS branch (matching the docstring's stated intent: pin to 110/220 nm before the x3.5 scaling).

Both options are behavioural changes and will require updating tests/test_misc_branches.py accordingly, so this should be treated as a separate effort.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions