View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Analysis of bug 414

Frank Valdes wrote on Nov 18, 1998

A recently discovered bug is reported in bug log entry 414 (also
included below) and related entry 409.  Below is more detailed analysis
and explanation of the effect of the bug.

The effect of having the interpolation weights not sum to 1 is a doppler
shift of the dispersion.  The dispersion is evaluated from two
dispersion functions f1(x) and f2(x) by the formula

        lambda1 = f1(x)
        lambda2 = f2(x)
(1)     lambda = w1 * lambda1 + w2 * lambda2

Normally lambda1 and lambda2 will be very close (otherwise the spectrograph
is not very stable) so

        lambda = (w1 + w2) * lambda1

so

        z = w1 + w2 - 1

The bug log is inaccurate in calling the problem a "truncation to three
digits".  The weights are rounded to three digits but the round-off
formating has numerical precision effects.  The roundoff error to three
significant digits is rare and happens only when the fourth significant
digit is computationally 0.000499999999xxx and 0.0005000000xxx.  But it
is possible to end up with

        w1 = 0.404  or   w1 = 0.415
        w2 = 0.595       w2 = 0.586

so

        z = -0.001  or   z = 0.001

As I said this effect should be rare but when it happens it will impart
a discrete doppler shift.  For precise radial velocity work where the
arc calibrated spectra are also zero point calibrated to night sky lines
or other sources then this effect will be removed.

The correction to the dispersion evaluation routine mentioned in bug log 414
is to change eq 1 above to

        lambda = (w1 * lambda1 + w2 * lambda2) / (w1 + w2)

where everything is done in double precision.  Then regardless of the
values of w1 and w2 there will be no systematic error.


Frank Valdes



NUMBER: 414
MODULE: dispcor
SYSTEM: V2.10-2.11.1
DATE:   Tue Nov 17 10:20:38 MST 1998
FROM:   valdes

BUG:    If the weights when interpolating between two dispersion reference
        solutions are given to more than three digits in the REFSPEC
        keywords they are internally truncated to three digits.  Using
        DISPCOR to produce non-linear dispersion coefficients in the image
        headers will have the three digit weights which may not add up to 1
        to the level of 0.1%.  This can cause small shifts in the evaluated
        wavelengths.  If DISPCOR is used to linearize the dispersion the
        same effect will apply.  This bug is related to bug 409.  The
        workaround solution is to make sure the weights in the REFSPEC
        keywords add up to 1 within the first three digits.  THIS BUG
        CAN CAUSE SYSTEMATIC ERRORS IN RADIAL VELOCITY MEASUREMENTS
        WHEN USING MULTIPLE WEIGHTED DISPERSION SOLUTIONS.

STATUS: In future releases all occurences of the weight values in the
        REFSPEC keywords and in the non-linear coefficients will use
        eight significant digits.  Furthermore, the dispersion function
        evaluation for multiple weighted dispersion functions will
        normalize the weights to avoid any systematic error regardless
        of the weight values.

Frank Valdes wrote on Dec 03, 1998

Someone who has looked at hundreds of radial velocity spectra using the arc
spectra interpolation feature reports that bug 414 is rare and occurs only
in the special circumstance where the roundoff to 3 digits in the weights
has the fourth digit of 5 and the weights both round down or up.  In those
cases the radial velocity was clearly off; i.e. the bug is not systematic
at some small level but is a "catastrophic" error.  The fix for the next
release was verified as correct.

Frank Valdes
NOAO IRAF Group

Last post on Dec 03, 1998