function eit_eff_area, item, wave, waveout=waveout, $
filters=filters, verbose=verbose, filein=filein, $
area_str=eit_area_str, text_area=text_area, qstop=qstop
;+
;NAME:
; eit_eff_area
;PURPOSE:
; Return the EIT effective area as a function of wavelength
;CALLING SEQUENCE:
; Area = eit_eff_area(index,waveout=waveout)
; Area = eit_eff_area(roadmap,wave) ;User supplies wavelengths
; Area = eit_eff_area(index,wave)
; Area = eit_eff_area(Sector,wave) ;Sector is an integer array
; Area = eit_eff_area(Sector,wave,filter=filt) ;Filt is an integer array
;
; Area_structure = eit_eff_area()
; Area_structure = eit_eff_area(filein=filein)
;INPUTS:
; Item - EIT index structure or roadmap. May be a scalar
; or an array. Sector and Filters are extracted.
;
; or - an integer scalar or array with the EIT sector number.
;OPTIONAL INPUTS:
; wave - Wavelengths at which the values of the area are
; desired. If not specified, the wavelengths are
; generated internally and returned in waveout.
;OPTIONAL INPUT KEYWORDS:
; filters - To override the values of filters in Item
; verbose - Set to provide additional information
; filein - To read a specific EIT effective area file. By
; default reads the following file:
; concat_dir('SSW_EIT_RESPONSE','era*.genx')
; Use filein='your_file_name' to override the default.
; text_area - If file is read, return the text information (string) array
;OUTPUTS:
; Returns the EIT effective area.
; Output size will be (N_elements(wave), N_elements(item))
;
;OPTIONAL OUTPUT KEYWORDS:
; waveout - If wave is not provided, then wavelengths are
; defined by eit_eff_area and returned in waveout.
;OPTIONAL INPUT/OUTPUT KEYWORD:
; area_str - The contents of the EIT effective area file is
; returned in this structure variable. If this
; variable is defined, the routine will not bother
; to re-read the file on subsequent calls.
;RESTRICTIONS:
; If filters is defined, it must be of length 1 or length n_elements(Item)
;
; NOTE: It is assumed that area.filter(0) = Entrance filter
; area.filter(1) = CCD fixed filter
; area.filter(2) = Filter wheel C+Al filter
; area.filter(3) = Filter wheel thin Al filter
; This is order is established in the routine mk_eit_area.pro
;METHOD:
; The EIT effective area file is read. If wave is specified, the
; values are interpolated in Log(area).
;HISTORY:
; 9-Jun-95, J. R. Lemen (LPARL), Written
;-
; --------------------------
; Check the input arguments:
; --------------------------
on_error,0 ; Clear the on_error condition
if (n_elements(Filters) gt 1) and (n_elements(filters) ne n_elements(Item)) then begin
on_error,1 ; Return to the caller
message,'Length of Filters must be 0, 1, or n_elements(Index)' ; Stop with an error
endif
; -------------------------------------------------
; Define the EIT effective area file name (filein):
; -------------------------------------------------
if n_elements(filein) eq 0 then begin
ddir = 'SSW_EIT_RESPONSE'
filein = concat_dir(ddir,'era*.genx')
file = findfile(filein,count=count)
if count eq 0 then begin
on_error,2 ; Return to Main
message,string('Could not find file: ',filein,format='(2a)')
endif
file = file(n_elements(file)-1)
break_file, file, disk, dir, name, ext, ver
filein = concat_dir(ddir, name+ext+ver, /notrans) ; Reconstruct the name
endif else file = filein
if not file_exist(file) then begin
on_error,1
message,string('Could not open file: ',filein) ; Stop with an error
endif
; -----------------------------
; Read the effective area file:
; -----------------------------
restgen,file=file,str=eit_area_str,text=text_area ; Read the EIT effect area file
if n_elements(wave) eq 0 then waveout = eit_area_str.area.wave else waveout = wave
sectors = gt_EITsector(Item)
case n_elements(filters) of
0: begin
siz = size(item)
typ = siz( siz(0)+1 )
if typ eq 8 then ffilters = gt_EITfilter(Item) else $
ffilters = replicate(2,n_elements(sectors))
endcase
1: ffilters = replicate(filters(0),n_elements(sectors))
else: ffilters = filters
endcase
if (min(ffilters) lt 0) or (max(ffilters) gt 4) then begin
on_error,1
message,string('Invalid value of filters: Must be 0 <= filters <= 4')
endif
out = fltarr(n_elements(waveout), n_elements(sectors))
for i=0,n_elements(sectors)-1 do begin
zz = eit_area_str.area.area(*,sectors(i))
case ffilters(i) of
0: zz = zz * eit_area_str.filter(0).trans
1: zz = zz * eit_area_str.filter(1).trans
2: zz = zz
3: zz = zz ; Half blocker
4: zz = zz ; Half blocker
endcase
if n_elements(wave) eq 0 then out(0,i) = zz else $
out(0,i) = 10.^dspline( eit_area_str.area.wave,alog10(zz>1.e-30), $
waveout, interp=0)
endfor
if keyword_set(qstop) then stop
return,out
end
Last revised: - Wed May 9 21:45:08 2007- F. Auchère