Viewing contents of file '../idllib/uit/pro/charcurve.pro'
PRO CHARCURVE, intensity, ind, HDFILE=hdfile, HDENTRY=hdentry
;+
; NAME:
; CHARCURVE
; PURPOSE:
; To fetch the UIT characteristic curve from its file and return it to the
; calling level.
;
; CALLING SEQUENCE:
; CHARCURVE, Intensity [, Ind, HDFILE=, HDENTRY= ]
;
; INPUTS:
; Ind The optional index in the curve file of the desired curve.
; This defaults to 0.
;
; OUTPUTS:
; Intensity This is a 4096 element integer array containing the
; characteristic curve.
;
; KEYWORDS:
; HDFILE If specified, the H&D curve is extracted from this file.
; Otherwise, it is retreived from UIT_DATA:newhd.dat
; HDENTRY If specified, the H&D curve is assumed to be this entry
; in the file. Otherwise, it is assumed to be Ind. This
; keyword overrides the Ind parameter.
;
; RESTRICTIONS:
; The intensity must be specified.
;
; PROCEDURE:
; The file is opened and associated to a 4096 element integer array. The
; desired element is stored in the argument, the file is closed, and
; execution returns to the calling level.
;
; MODIFICATION HISTORY:
; Written by Robert H. Cornett, STX, 24 April 1988.
; Modified to the current H&D curve. Documentation added. IND added.
; Michael R. Greason, STX, 9 December 1988.
; Again modified to a new H&D curve. MRG, STX, 27 March 1990.
; Adapted to the new H&D curve. The keywords added. MRG, STX,
; MRG, STX, 3 October 1991.
;-
; Make sure INTENSITY has been specified; if not,
; skip everything.
;
On_error,2
if N_params() EQ 0 then begin
print,'Syntax - CHARCURVE, intensity, [ Ind, HDFILE = , HDENTRY = ]
return
endif
IF n_params(0) GE 1 THEN BEGIN
;
; Set defaults.
;
IF (keyword_set(hdfile)) THEN intfil = hdfile $ ; Filename
ELSE intfil = osfcnvrt('UIT_DATA:newhd.dat')
hdsize = 4096 ; # H&D curve elements.
IF (keyword_set(hdentry)) THEN BEGIN ; H&D file entry.
inddef = hdentry
ENDIF ELSE BEGIN
IF (n_params(0) LT 2) THEN inddef = 0 $
ELSE inddef = ind
ENDELSE
;
; Open characteristic curve file.
;
get_lun, u
openr, u, intfil
int = assoc(u, intarr(hdsize))
;
; Get the curve and store it in the argument.
;
intensity = int(inddef)
;
; Close curve file.
;
free_lun, u
ENDIF
;
RETURN
END