def read_DDTpos(inhdr):
    """
    Read reference wavelength and DDT-estimated position from DDTLREF and
    DDT[X|Y]P keywords.  Will raise KeyError if keywords are not available.
    """

    try:
        lddt = inhdr['DDTLREF']  # Ref. wavelength [A]
        xddt = inhdr['DDTXP']    # Predicted position [spx]
        yddt = inhdr['DDTYP']
    except KeyError as err:
        raise KeyError("File has no DDT-related keywords (%s)" % err)

    # Some sanity check
    if not (abs(xddt) < 7 and abs(yddt) < 7):
        raise KeyError(
            "Invalid DDT position: %.2f x %.2f is outside FoV" % (xddt, yddt))

    return lddt, xddt, yddt