Viewing contents of file '../idllib/iuedac/iuelib/pro/com_abcal.pro'
;******************************************************************************
;+
;*NAME:
;
; COM_ABCAL
;
;*CLASS:
;
; Spectral Calibration
;
;*CATEGORY:
;
; IUESIPS
;
;*PURPOSE:
;
; Procedure to apply IUE absolute calibration to high dispersion
; spectra being processed by BCOMP.
;
;*CALLING SEQUENCE:
;
; COM_ABCAL,H,WAVE,FNET,EXPS,FABS
;
;*PARAMETERS:
;
; H (REQ) (IO) (1) (I)
; Header record. Entries are updated to describe the
; approppriate calibration used.
;
; WAVE (REQ) (I) (1) (F D)
; Wavelength vector.
;
; FNET (REQ) (I) (1) (F D)
; Net flux in IUE flux units.
;
; EXPS (REQ) (I) (1) (F D)
; Exposure time in seconds.
;
; FABS (REQ) (O) (1) (F D)
; Flux in ergs/s/cm2/A.
;
;*EXAMPLES:
;
;*SYSTEM VARIABLES USED:
;
; !iuer.dat
;
;*COMMON BLOCKS:
;
; none
;
;*INTERACTIVE INPUT:
;
; none
;
;*SUBROUTINES CALLED:
;
; PARCHECK
; IFITSRD
; QUADTERP
;
;*FILES USED:
;
; !iuer.dat IUECAL3.FIT
; !iuer.dat IUECAL.FIT
;
;*SIDE EFFECTS:
;
;*RESTRICTIONS:
;
; This procedure should only be used with IUESIPS data.
;
;*NOTES:
;
;*PROCEDURE:
;
; This procedure applies IUE absolute calibration to high dispersion
; spectra. The procedure uses either !IUER.DAT IUECAL3.FIT or
; !IUER.DAT IUECAL.FIT as calibration files. The procedure uses quadratic
; interpolation in the tables to get inverse sensitivity for each
; element of wave. The calibration is applied and the procedure returns.
;
;*I_HELP nn:
;
;*MODIFICATION HISTORY:
;
; 2/25/91 RWT replace IUECAL2 with IUECAL3 & UPDATE PROLOG
; 3-01-91 PJL unix/sun modification; added PARCHECK and
; call print
; 4-10-91 KBC branch pathname strings based on operating system type
; 7-22-91 PJL cleaned up; changed logical; tested on SUN and VAX;
; updated prolog
; 8 Nov 93 PJL replace IUECAL.DAT with IUECAL.FIT and IUECAL3.DAT with
; IUECAL3.FIT; added IFITSRD; IUESIPS only restriction
; 2 Sep 94 LLT replace environment variables with system structure !iuer
;-
;******************************************************************************
pro com_abcal,h,wave,fnet,exps,fabs
;
npar = n_params(0)
if (npar eq 0) then begin
print,'COM_ABCAL,H,WAVE,FNET,EXPS,FABS'
retall
endif ; npar eq 0
parcheck,npar,5,'COM_ABCAL'
;
; check header characteristics
;
temp = size(h)
if (temp(temp(0)+1) eq 7) then begin
print,'H vector supplied is a string.'
print,'ACTION: retall'
retall
endif ; temp(temp(0)+1) eq 7
;
ncam = h(3) mod 10 ; correct for station id
;
; Fetch sensitivity file IUECAL3.FIT for all images except LWP low
; dispersion itf1 data and high dispersion images processed with
; old software. (use IUECAL.FIT for these.)
;
floc = !iuer.dat
file = floc + 'iuecal3.fit'
npts = 100
if (ncam eq 1) then begin
if (h(0) lt 2000) then file = floc + 'iuecal.fit'
if (file eq (floc+'iuecal.fit')) then npts = 50
endif ; ncam eq 1
ifitsrd,file,ncam,main,extn,camname,wtab,/silent
ifitsrd,file,ncam,main,extn,stab,efld=4+(h(0) gt 2000),/silent
h(90) = 11
if ( (ncam ne 1) and (h(0) lt 2000) ) then h(90) = 10
;
; truncate data to valid points (& correct for sens. degrad.)
;
i = where(wtab gt 0)
wtab = wtab(i)
stab = stab(i)
;
; make quadratic interpolation in the tables to get inverse
; sensitivity for each element of wave
;
logstab = alog10(stab>1.e-16)
quadterp,wtab,logstab,wave,logsinv
sinv = 10.^logsinv
;
; apply calibration
;
fabs = sinv * fnet
if (exps gt 0) then fabs = fabs/exps
;
return
end ; com_abcal