pro plot_eit_mirror, Item, code=qcode, extend_range=extend_range, $
yrange=yrange,notime=notime,hc=hc,filein=filein, $
noverbose=noverbose,qstop=qstop,noprint=noprint
;+
; NAME:
; plot_eit_mirror
; PURPOSE:
; Plot the EIT mirror reflectivity
; CALLING SEQUENCE:
; plot_eit_mirror, mirror
; plot_eit_mirror, code=2, /notime, /hc, yra=[1.e-6,.1]
; plot_eit_mirror, /extend_range, filein=filein
; OPTIONAL INPUT/OUTPUT:
; mirror - Data structure from the EIT effective area file (era*genx)
; If mirror is not defined, the era*genx file will be read.
; filein - By default the EIT effective area file is read:
; concat_dir('SSW_EIT_RESPONSE','era*.genx')
; Use filein='your_file_name' to override the default.
; OPTIONAL INPUT KEYWORDS:
; code 0: Plot measurements and model
; 1: Plot ratio of model/measurements
; 2: Same as 0, but also over plot corrected model (Default)
; extend_range If set, extend the wavelength ranges by +/- 50 A
; notime - If set, do not put the time on the plot
; yrange - Vector of length 2 equal to desired min and max y-axis range
; /hc - If set, send to PostScript printer
; /noprint - If both /hc and /noprint are set, create PostScript file
; but do not print it
; /noverbose - Don't give the explanations when running.
; CALLS:
; eit_witness to obtain the witness mirror data.
; HISTORY:
; 10-Jun-95, J. R. Lemen (LPARL), Written.
;-
if n_elements(qcode) eq 0 then qcode = 2
if (qcode lt 0) or (qcode gt 2) then begin
on_error,1 ; Return to the caller
message,string('Invalid value of code =',qcode)
endif
; Call eit_eff_area to read the EIT effective area file:
if n_elements(Item) eq 0 then $
dum = eit_eff_area(0,filein=filein,area_str=Item) ; Read the era*genx file
; Allow input item to be either the entire data structure from era*.genx file
; or just Item.mirror
tag_pos = tag_index(Item, 'mirror')
if tag_pos ne -1 then mirror = item.(tag_pos) else mirror = Item
!p.multi = [0,2,2]
sector = gt_EITsector(indgen(4),/short) ; Get a list of sectors
sector = sector(sort(sector)) ; Wavelength order
if keyword_set(hc) then set_plot,'PS'
tit = string(sector)+' A mirror double reflectivity'
xtit = 'Wavelength (A)'
if !d.name eq 'PS' then begin
device,/land,/inch,xsize=9.,ysize=6.5,xoff=1.,yoff=11-1.
!x.thick=3 & !y.thick=3 & !p.thick=3 & !p.charthick=3.6
font = 0
endif else font = -1
xrange = [0,0]
if n_elements(yrange) ne 0 then yran = yrange else yran = [0,0]
xlab_pos = [.95,.95,.95,.95]
ylab_pos = [.9 ,.1 ,.9 ,.9 ]
ylab_pos = [.9 ,.9 ,.9 ,.9 ]
align = [1.,1.,1.,1.]
for j=0,3 do begin
; -------------------------------------------
; Get the witness mirror values and the model:
; -------------------------------------------
eit_witness,fix(sector(j)),ww0,rr0
i = (where(mirror.name eq sector(j)))(0)
ww1 = mirror(i).wave
rr1 = mirror(i).ref_model ; Model calculation
ref2 = mirror(i).ref_corr ; Corrected model
band = mirror(i).band
factors1 = rr1/ref2
ww2 = [ww1,ww0] & ww2 = ww2(sort(ww2))
factors2 = dspline(ww1,factors1,ww2,interp=0)
factors0 = dspline(ww1,factors1,ww0,interp=0)
; eit_mirror,sector(j),ww1,rr1,ref2,band=band,ddir=ddir, $
; factors0=factors0,factors2=factors2, wave2=ww2
; --------------------------------------------
; Plot the results
; --------------------------------------------
wmin = min(ww0) & wmax = max(ww0) ; Range witness measurements
if keyword_set(extend_range) then xrange = [wmin-50,wmax+50]
if (qcode eq 0) or (qcode eq 2) then begin
plot_io,ww0,rr0,xtit=xtit,psym=4,xstyle=2, $
xr=xrange,yr=yran,font=font
if qcode eq 2 then line=2 else line=0
oplot,ww1,rr1,line=line
; The Plot labels have to be put on by hand:
xx = !x.crange(0)+xlab_pos(i)*(!x.crange(1)-!x.crange(0))
yy = 10.^(!y.crange(0)+ylab_pos(i)*(!y.crange(1)-!y.crange(0)))
xyouts,xx,yy,font=font,align=align(i), $
string((['(a)','(b)','(c)','(d)'])(j)+' '+sector(j)+' A')
xyouts,.5,1.,/norm,'Double Mirror Reflectivity',font=font,align=.5,chars=1.5
endif
ij = where(ww2 ge wmin and ww2 le wmax,nc)
; Short wavelength side:
ij1 = where((ww2 le wmin) and (ww2 ge (wmin-band)),nc)
; Long wavelength side:
ij2 = where((ww2 ge wmax) and (ww2 le (wmax+band)),nc)
if qcode eq 1 then begin
if keyword_set(extend_range) then xrange1=xrange $
else xrange1=[min(ww0)-2*band,max(ww0)+2*band]
plot,ww0,factors0,psym=4,chars=1.,symsiz=1.3, $
tit=sector(j)+': Ratio of Theory/Data', $
xtitle='Wavelength(A)',xrange=xrange1, font=font
oplot,ww2(ij1),factors2(ij1),thick=4
oplot,ww2(ij2),factors2(ij2),thick=4
oplot,ww2,factors2
endif ; qcode eq 1
if qcode eq 2 then begin
oplot,ww1,rr1/dspline(ww2,factors2,ww1,interp=0),thick=2
endif
endfor
if !d.name eq 'PS' then begin
if not keyword_set(notime) then begin
text = string('Plot done at: ',!stime,format='(2a)')
if n_elements(filein) ne 0 then $
text = text+string(' File: ',filein,format='(2a)') else $
text = text+string(' Version: ',mirror(0).Version, format='(2a)')
xyouts,0.5,-0.05,/norm,alig=.5,text
endif
pprint,/reset,noprint=noprint
endif
clearplot & !x.thick=0 & !y.thick=0 & !p.thick=0 & !p.charthick=0
if not keyword_set(noverbose) then begin
case qcode of
0: begin
text = ['- Diamonds are the witness mirror measurements']
text = [text,'- Curves are the model calculations.']
endcase
1: begin
text = ['- Diamonds are the correction factors at the wavelengths']
text = [text,' of the witness mirror measurements.']
text = [text,'- The curves are the correction factors (theory/data).']
text = [text,'- The thick portion shows the region over which the']
text = [text,' correction factors have been extrapolated to unity.']
endcase
2: begin
text = ['- Diamonds are the witness mirror measurements']
text = [text,'- Thin curves are the model calculations.']
text = [text,'- Thick curves are the model calculations forced to the data.']
endcase
endcase
more,text
endif ; not keyword_set(noverbose)
if keyword_set(qstop) then stop
end
Last revised: - Wed May 9 21:45:09 2007- F. Auchère