pro disp1dtmap_s1, img, x0, y0, nout, nout0, tit, f, fmt
;
nx = n_elements(img(*,0))
ny = n_elements(img(0,*))
xmat = (lindgen(nx, ny) mod nx) - nx/2
ymat = (lindgen(nx, ny) / nx ) - ny/2
rmat = sqrt(xmat^2 + ymat^2)
ss = where(rmat lt nx/2-1)
;
dev = stdev(img(ss), avg)
;avg = total(img(ss))/n_elements(ss)
;
tv2, congrid(bytscl(img), nout0, nout0), nout*x0, nout*y0
mk_refbar, nout*x0+(nout0*1.2), nout*y0, min(img), max(img), ysiz=180, fmt=fmt, /delta, size=f, average=avg, dev=dev
xyouts2, nout*x0+nout0/2, nout*y0+nout0, align=0.5, tit, /dev, size=f
;
end
;------------------------------------------------------------------------------
pro disp1dtmap, serial, m1, m2, lctr, cont, m2cont, head, hc=hc
;
;HISTORY:
;V1.0	17-Feb-94 (MDM)
;V1.1	18-Feb-94 (MDM) - Display the center line/continuum intensity ratio
;			- Write the date/time of the last image.
;V2.0	18-Feb-94 (MDM) - Moved the display portion outside of the calculation
;			  portion.
;V2.01	18-Feb-94 (MDM) - Added /HC option
;V2.02	23-Feb-94 (MDM) - Display the difference image of M2 at solar line
;			  and M2 at continuum
;			- Updated MK_REFBAR to show the average too.
;
progver = 'DISP1DTMAP  Ver 2.02'
;
save_device = !d.name
if (keyword_set(hc)) then set_plot, 'ps
;
if (n_elements(m1) eq 0) then begin
    print, 'Reading: ', map_filnam(serial, 0, item='_m1slc'), ' and others'
    m1 = rfits( map_filnam(serial, 0, item='_m1slc'), head=head)
    m2 = rfits( map_filnam(serial, 0, item='_m2slc'), head=head)
    lctr = rfits( map_filnam(serial, 0, item='_islc'), head=head)
    cont = rfits( map_filnam(serial, 0, item='_icon'), head=head)
    m2cont = rfits( map_filnam(serial, 0, item='_m2con'), head=head)
end
;
nout = 256
nout0 = nout*0.85	;image size
nxout = nout*3.0
nyout = nout*4.0
;
case !d.name of
   'X': wdef, 1, nxout, nyout
   'Z': device, set_res=[nxout, nyout]
   'PS': tv2, nxout, nyout, /init
end
;
if (!d.name eq 'PS') then f = 0.8 else f = 0.95
;
dattim = gt_day(sxpar(head, 'DATE-OBS'),/str) + '  ' +  sxpar(head, 'TIME-OBS')		;convert to letter notation
;
xyouts2, nxout*0.75, nout*3.6, align=0.5, 'Series: ' + string(serial), siz=2, /dev
xyouts2, nxout/2, nout*3.25, progver, /dev
xyouts2, nxout/2, nout*3.2, 'Image Made: ' + !stime, /dev
xyouts2, nxout/2, nout*3.0, 'Last Image in Set Taken: ' + dattim, /dev, siz=f
;
disp1dtmap_s1, m1, 0, 2, nout, nout0, 'M1 at Solar Line Center (mA)', f*.8, '(f7.2)'
disp1dtmap_s1, m2, 1.5, 2, nout, nout0, 'M2 at Solar Line Center (mA)', f*.8, '(f7.2)'

disp1dtmap_s1, lctr, 0, 1, nout, nout0, 'Intensity at Line Center', f*.8, '(f7.2)'
disp1dtmap_s1, cont, 1.5, 1, nout, nout0, 'Intensity at Continuum', f*.8, '(f7.2)'

disp1dtmap_s1, m2cont, 0, 0, nout, nout0, 'M2 at Continuum (mA)', f*.8, '(f7.2)'
disp1dtmap_s1, lctr/cont, 1.5, 0, nout, nout0, 'Line Center/Continuum', f*.8, '(f7.4)'

disp1dtmap_s1, m2-m2cont, 0, 3, nout, nout0, 'M2 Solar Line - M2 Cont', f*.8, '(f7.2)'

if (!d.name eq 'PS') then pprint
if (keyword_set(hc)) then set_plot, save_device
end
