FUNCTION ReplLinInt, array

;+
; NAME:
;	Replace by Linear Interpolation
; PURPOSE:
;	Replaces the values between the first and the last element
;	of "array" by the linear interpolation of
;	the values in array(minimum) and array(maximum).
; CALLING SEQUENCE:
;	result = ArrayInterp( array )
; INPUT: 
;	array: 1D vector to change
; RESULT:
;	the interpolated array.
; PROCEDURE:
;	1. computes slope and least value
;	2. replaces values in "array" by slope*i + leastValue
;-
; MODIFICATION HISTORY:
;	Created in December 1991 by A.Csillaghy
;		Inst. of Astronomy, ETH Zurich

  IF N_Params() EQ 0 THEN BEGIN
    Error, 1, 'ReplLinInt'
    RETURN, 0
  END

  dist = N_Elements( array )
  IF dist LT 2 THEN RETURN, array

  leastVal = array( 0 )
  slope = Float( array(dist-1) - leastVal ) / dist

  RETURN, [leastVal + slope*FIndGen( dist-1 ), array( dist-1)]

END ; replace by interpolation
