[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]


TABINV Source code in tabinv.pro

TABINV

Name
       TABINV
Purpose
       To find the effective index of a function value in an ordered vector.
Calling Sequence
       TABINV, XARR, X, IEFF, [/FAST]
Input Parameters
       XARR - the vector array to be searched, must be monotonic
               increasing or decreasing
       X    - the function value(s) whose effective
               index is sought (scalar or vector)
Output Parameters
       IEFF - the effective index or indices of X in XARR
               real or double precision, same # of elements as X
Keyword Parameters
       /FAST - If this keyword is set, then the input vector is not checked
               for monotonicity, in order to improve the program speed.
Restrictions
       TABINV will abort if XARR is not monotonic.  (Equality of
       neighboring values in XARR is allowed but results may not be
       unique.)  This requirement may mean that input vectors with padded
       zeroes could cause routine to abort.
Procedure
       VALUE_LOCATE() is used to find the values XARR[I]
       and XARR[I+1] where XARR[I] < X < XARR[I+1].
       IEFF is then computed using linear interpolation
       between I and I+1.
               IEFF = I + (X-XARR[I]) / (XARR[I+1]-XARR[I])
       Let N = number of elements in XARR
               if x < XARR[0] then IEFF is set to 0
               if x > XARR[N-1] then IEFF is set to N-1
Example
       Set all flux values of a spectrum (WAVE vs FLUX) to zero
       for wavelengths less than 1150 Angstroms.
       IDL> tabinv, wave, 1150.0, I
       IDL> flux[ 0:fix(I) ] = 0.
Procedures Used
       None
Revision History
       Adapted from the IUE RDAF                     January, 1988
       More elegant code  W. Landsman                August, 1989
       Mod to work on 2 element decreasing vector    August, 1992
       Converted to IDL V5.0   W. Landsman   September 1997
       Updated for V5.3 to use VALUE_LOCATE()     W. Landsman January 2000
       Work when both X and Xarr are integers     W. Landsman August 2001

Last modified by pro2html on 2004 March 31 at 03:57 UTC

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

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