[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Achtung: ab Mitte Oktober neue Adresse und Telefon-Nummern!
Attention: effective from middle of October new address and telephone numbers!
[Uni logo]


LINTERP Source code in linterp.pro

LINTERP

Name
       LINTERP
Purpose
       Linearly interpolate tabulated 1-d data from one grid to a new one.
Explanation
       The results of LINTERP are numerically equivalent to the RSI
       INTERPOL() function, but note the following:
         (1) LINTERP is a procedure rather than a function
         (2) INTERPOL() extrapolates beyond the end points whereas LINTERP
             truncates to the endpoints (or uses the MISSING keyword)
         (3) LINTERP (unlike INTERPOL) uses the intrinsic INTERPOLATE function
                 and thus may have a speed advantage
         (4) LINTERP always converts the new grid vector to floating point
                (because INTERPOLATE does this) whereas INTERPOL() will
                 keep double precision if supplied.
       Use QUADTERP for quadratic interpolation.
Calling Sequence
       LINTERP, Xtab, Ytab, Xint, Yint, [MISSING =, /NoInterp ]
Input Parameters
       Xtab -  Vector containing the current independent variable grid.
               Must be monotonic increasing or decreasing
       Ytab -  Vector containing the current dependent variable values at
               the XTAB grid points.
       Xint -  Scalar or vector containing the new independent variable grid
               points for which interpolated value(s) of the dependent
               variable are sought.    Note that -- due to a limitation of the
               intrinsic INTERPOLATE() function -- Xint is always converted to
               floating point internally.
Output Parameters
       Yint  -  Scalar or vector with the interpolated value(s) of the
               dependent variable at the XINT grid points.
               YINT is double precision if XTAB or YTAB are double,
               otherwise YINT is REAL*4
Keyword Parameters
       MISSING - Scalar specifying YINT value(s) to be assigned, when Xint
               value(s) are outside of the range of Xtab.     Default is to
               truncate the out of range YINT value(s) to the nearest value
               of YTAB.   See the help for the INTERPOLATE function.
       /NoINTERP - If supplied then LINTERP returns the YTAB value(s)
               associated with the closest XTAB value(s)rather than
               interpolating.
Example
       To linearly interpolate from a spectrum wavelength-flux pair
       WAVE, FLUX to another wavelength grid defined as:
       WGRID = [1540., 1541., 1542., 1543., 1544, 1545.]
       IDL>  LINTERP, WAVE, FLUX, WGRID, FGRID
       FGRID will be a 6 element vector containing the values of FLUX
       linearly interpolated onto the WGRID wavelength scale
Procedure
       Uses TABINV to calculate the effective index of the values
       in Xint in the table Xtab.  The resulting index is used
       with the intrinsic INTERPOLATE function to find the corresponding
       Yint value in Ytab.  Unless the MISSING keyword is supplied, out
       of range Yint values are truncated to the nearest value of Ytab.
Procedures Used
       TABINV, ZPARCHECK
Revision History
       Adapted from the IUE RDAF,  W. Landsman      October, 1988
       Modified to use the new INTERPOLATE function        June, 1992
       Modified to always return REAL*4             October, 1992
       Added MISSING keyword                        August, 1993
       Converted to IDL V5.0   W. Landsman   September 1997
       Added NoInterp keyword  W. Landsman      July 1999
       Work for unsigned, 64 bit integers  W. Landsman  October 2001

Last modified by pro2html on 2001 October 18 at 03:39 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically