;+ ; NAME fits_annotate_cp.pro ; ; PURPOSE Annotate a FITS image. ; ; SYNTAX fits_annotate, hdu ; ; hdu: FITS header ; xdim: x-axis dimension ; ydim: y-axis dimension ; xb: x-axis border for annotation ; yb: y-axis border for annotation ; ; HISTORY Andrew L. Stanger HAO/NCAR 14 September 2001 ; 28 Dec 2005: update for SMM C/P. ;- PRO fits_annotate_cp, hdu, hdu_hk, xdim, ydim, xb, yb, wmin=wmin, wmax=wmax print, '*** fits_annotate_cp ***' ;--------------------------------------------------------------------------- ; Define fonts. ;--------------------------------------------------------------------------- ; bfont = '-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1' bfont = '-*-times-bold-r-normal-*-16-*-100-100-*-*-*-*' ; bfont = (get_dfont (bfont))(0) IF (bfont EQ '') THEN bfont = 'fixed' bfont = -1 bfont = 0 ; lfont = '-misc-fixed-bold-r-normal--13-100-100-100-c-70-iso8859-1' ; lfont = '-*-lucida-*-r-*-*-14-*-*-*-*-*-*-*' lfont = '-*-helvetica-*-r-*-*-14-*-*-*-*-*-*-*' lfont = '-*-helvetica-*-r-*-*-10-*-*-*-*-*-*-*' ; lfont = (get_dfont (lfont))(0) IF (lfont EQ '') THEN lfont = 'fixed' lfont = -1 tfont = '-*-itc bookman-*-r-*-*-14-*-*-*-*-*-*-*' ; tfont = (get_dfont (tfont))(0) IF (tfont EQ '') THEN tfont = 'fixed' tfont = -1 ;--- Character sizes: xoff = 2 yoff = 2 x1 = 7 x2 = 10 x3 = 14 y1 = 9 y2 = 10 y3 = 18 xend = xdim + xb - x1 yend = ydim + yb - y1 cfac = 1.0 IF (STRLOWCASE (!version.os) EQ 'irix') THEN cfac = 1.0 IF (STRLOWCASE (!version.os) EQ 'sunos' ) THEN cfac = 2.0 cs1 = cfac * 1.0 ; character size cs2 = cfac * 1.4 cs3 = cfac * 2.0 x1 = FIX (x1 * cs1 + 0.5) x2 = FIX (x1 * cs2 + 0.5) x3 = FIX (x1 * cs3 + 0.5) y1 = FIX (y1 * cs1 + 0.5) y2 = FIX (y1 * cs2 + 0.5) y3 = FIX (y1 * cs3 + 0.5) ;--- Color assignments for annotation. white = 255 red = 254 green = 253 blue = 252 grey = 251 yellow = 250 black = 0 ;--- Get information from FITS header. object = fxpar (hdu, 'OBJECT') type_obs = fxpar (hdu, 'TYPE-OBS') origin = fxpar (hdu, 'ORIGIN') telescop = STRTRIM (fxpar (hdu, 'TELESCOP'), 2) instrume = STRTRIM (fxpar (hdu, 'INSTRUME'), 2) date_obs = fxpar (hdu, 'DATE-OBS') time_obs = fxpar (hdu, 'TIME-OBS') xcen = fxpar (hdu, 'CRPIX1') ycen = fxpar (hdu, 'CRPIX2') bunit = fxpar (hdu, 'BUNIT') datamin = fxpar (hdu, 'DATAMIN') datamax = fxpar (hdu, 'DATAMAX') dispmin = fxpar (hdu, 'DISPMIN') dispmax = fxpar (hdu, 'DISPMAX') crradius = fxpar (hdu, 'CRRADIUS') dataform = fxpar (hdu, 'DATAFORM') colorfil = fxpar (hdu, 'COLORFIL') glfilter = fxpar (hdu, 'GLFILTER') polaroid = fxpar (hdu, 'POLAROID') sector = fxpar (hdu, 'SECTOR') calmir = fxpar (hdu, 'CALMIR') expdur = fxpar (hdu, 'EXPDUR') scroll = fxpar (hdu, 'SCROLL') time_img = time_obs + ' UT' dmin = datamin dmax = datamax IF (dispmin NE dispmax) THEN $ BEGIN dmin = dispmin dmax = dispmax END IF (KEYWORD_SET (wmin)) THEN dmin = wmin IF (KEYWORD_SET (wmax)) THEN dmax = wmax print, 'dispmin/dispmax: ', dispmin, dispmax print, 'dmin/dmax: ', dmin, dmax iexpdur = FIX (expdur + 0.5) iscroll = FIX (scroll + 0.5) calmir = STRTRIM (calmir, 2) IF (calmir EQ 'IN') THEN $ img_source = 'Cal.Reticle' $ ELSE img_source = object sdatamin = STRTRIM (STRING (datamin, FORMAT='(E8.2)'), 2) IF (datamin EQ 0.0) THEN $ sdatamin = STRTRIM (STRING (datamin, FORMAT='(I4)' ), 2) sdatamax = STRTRIM (STRING (datamax, FORMAT='(E8.2)'), 2) IF (datamax EQ 0.0) THEN $ sdatamax = STRTRIM (STRING (datamax, FORMAT='(I4)' ), 2) sdispmin = STRTRIM (STRING (dispmin, FORMAT='(E8.2)'), 2) IF (dispmin EQ 0.0) THEN $ sdispmin = STRTRIM (STRING (dispmin, FORMAT='(I4)' ), 2) sdispmax = STRTRIM (STRING (dispmax, FORMAT='(E8.2)'), 2) IF (dispmax EQ 0.0) THEN $ sdispmax = STRTRIM (STRING (dispmax, FORMAT='(I4)' ), 2) IF (dmin GE 10000.0 OR dmin LT 1.0) THEN $ sdmin = STRTRIM (STRING (dmin, FORMAT='(E8.2)'), 2) IF (dmin LT 10000.0 AND dmin GT 1.0) THEN $ sdmin = STRTRIM (STRING (dmin, FORMAT='(F9.1)'), 2) IF (dmin EQ 0.0) THEN $ sdmin = STRTRIM (STRING (dmin, FORMAT='(I4)' ), 2) print, 'dmax: ', dmax IF (dmax GE 10000.0 OR dmax LT 1.0) THEN $ BEGIN print, '>10k dmax: ', dmax sdmax = STRTRIM (STRING (dmax, FORMAT='(E8.2)'), 2) END if (dmax LT 10000.0 AND dmax GT 1.0) THEN $ BEGIN print, '<10k dmax: ', dmax sdmax = STRTRIM (STRING (dmax, FORMAT='(F9.1)'), 2) END if (dmax EQ 0.0) THEN $ BEGIN print, 'zero dmax: ', dmax sdmax = STRTRIM (STRING (dmax, FORMAT='(I4)' ), 2) END sexpdur = STRTRIM (STRING (iexpdur, FORMAT='(I4)' ), 2) sexpdur = STRTRIM (STRING ( expdur, FORMAT='(F7.3)'), 2) sscroll = STRTRIM (STRING (iscroll, FORMAT='(I4)' ), 2) pixrs = crradius ;--- Draw box around image. wvec, 0, yb, 0, yb+ydim-1, grey wvec, 0, yb+ydim-1, xdim+xb-1, yb+ydim-1, grey wvec, 0, yb+ydim-1, 0, yb+ydim-1, grey wvec, xb, yb, xdim+xb-1, yb, grey wvec, xdim+xb-1, yb, xdim+xb-1, ydim+yb-1, grey wvec, xdim+xb-1, ydim+yb-1, xb, ydim+yb-1, grey wvec, xb, ydim+yb-1, xb, yb, grey wvec, 0, yb, xb, yb, grey ;--- Annotate image. ylab = yend - yoff ydat = ylab - y2 XYOUTS, xoff, ylab, 'DATE', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, date_obs, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'TIME', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, time_img, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'OBJECT', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, 'SUN:' + img_source, $ /device, font=bfont, charsize=cs2, color=black ; --- Intensity components. lcc = fxpar (hdu_hk, 'LCC') lfc = fxpar (hdu_hk, 'LFC') lvig = fxpar (hdu_hk, 'LVIG') lstr = fxpar (hdu_hk, 'LSTR') print, 'lcc/lfc/lvig/lstr: ', lcc, lfc, lvig, lstr IF (object EQ 'CORONA') THEN $ pixval = 'K-CORONA' $ ELSE pixval = 'CALIBRATION' IF (lfc EQ 0) THEN pixval = '(K+F)' IF (lstr EQ 0) THEN pixval = 'S+' + pixval IF (lvig EQ 0) THEN pixval = pixval + '*V' IF (lcc EQ 0) THEN pixval = pixval + '/C' pixval = STRTRIM (pixval, 2) print, 'pixval: ', pixval lenpixval = STRLEN (pixval) xloc = (xb - (lenpixval * x2)) / 2 xloc = xoff IF (xloc < 0) THEN xloc = xoff ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xloc, ylab,'INTENSITY SOURCE', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xloc, ydat, pixval, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'TYPE-OBS', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, type_obs, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'FILTER', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, colorfil, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'POLAROID', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, polaroid, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'SECTOR', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sector, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'EXPOSURE', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sexpdur, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'SPACECRAFT ROLL', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sscroll, $ /device, font=bfont, charsize=cs2, color=black ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'TELESCOPE', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, telescop, $ ; /device, font=bfont, charsize=cs2, color=black ; ylab = ylab - y2 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'INSTRUMENT', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, instrume, $ ; /device, font=bfont, charsize=cs2, color=black ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'OBJECT', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, object, $ ; /device, font=bfont, charsize=cs2, color=black ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'TYPE-OBS', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, type_obs, $ ; /device, font=bfont, charsize=cs2, color=black ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'DATA FORM', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, dataform, $ ; /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'DATA MIN', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sdatamin, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'DATA MAX', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sdatamax, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'DISP MIN', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sdmin, $ /device, font=bfont, charsize=cs2, color=black ylab = ylab - y1 - y2 - y1 ydat = ylab - y2 XYOUTS, xoff, ylab, 'DISP MAX', $ /device, font=lfont, charsize=cs1, color=red XYOUTS, xoff, ydat, sdmax, $ /device, font=bfont, charsize=cs2, color=black ; print, 'wmin: ', wmin ; IF (KEYWORD_SET (wmin) OR wmin EQ 0.0) THEN $ ; IF (KEYWORD_SET (wmin)) THEN $ ; BEGIN ; wmin = STRTRIM (STRING (wmin, FORMAT='(E8.2)'), 2) ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'WMIN', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, wmin, $ ; /device, font=bfont, charsize=cs2, color=black ; END ; IF (KEYWORD_SET (wmax)) THEN $ ; BEGIN ; wmax = STRTRIM (STRING (wmax, FORMAT='(E8.2)'), 2) ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'WMAX', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, wmax, $ ; /device, font=bfont, charsize=cs2, color=black ; END ; ylab = ylab - y1 - y2 - y1 ; ydat = ylab - y2 ; XYOUTS, xoff, ylab, 'BRIGHTNESS UNIT', $ ; /device, font=lfont, charsize=cs1, color=red ; XYOUTS, xoff, ydat, bunit, $ ; /device, font=bfont, charsize=cs2, color=black ; --- Draw sun circle. gMINCOL = xb gMAXCOL = xb + xdim - 1 gMINROW = yb gMAXROW = yb + ydim - 1 radius = 1.0 angmin = 0.0 angmax = 360.0 anginc = 10.0 suncir_cp, radius, angmin, angmax, anginc, cindex, $ xcen, ycen, pixrs, scroll, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW ; --- Draw radial lines. rmin = 1.0 rmax = 1.5 rinc = 0.2 anginc = 30.0 dotsize = 1 sunray, rmin, rmax, rinc, anginc, dotsize, $ xcen, ycen, pixrs, scroll, cindex, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW rmin = 0.1 rmax = 1.5 rinc = 0.1 anginc = 90.0 dotsize = 1 sunray, rmin, rmax, rinc, anginc, dotsize, $ xcen, ycen, pixrs, scroll, cindex, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW ;--- Draw north pointer. cirrad = 1.0 tiprad = 0.4 cindex = 250 cp_north, xcen, ycen, pixrs, scroll, cirrad, tiprad, cindex, $ gMINCOL, gMAXCOL, gMINROW, gMAXROW ;--- Create color bar array. collin = bindgen (256) collin = rebin (collin, 512) colbar = bytarr (512, 12) for i = 0, 11 DO $ colbar [*, i] = collin [*] ;--- Draw color bar. xc1 = xb + (xdim - 256) / 2 xc2 = xc1 + 256 yc1 = yb - 50 yc2 = yb - 30 xc1 = 127 xc2 = 638 yc1 = 20 yc2 = 31 tv, colbar, xc1, yc1 ;--- Draw border around color bar. plots, [xc1-1, yc1-1], /device, color=251 plots, [xc1-1, yc2+1], /device, color=251, /CONTINUE plots, [xc1-1+514, yc2+1], /device, color=251, /CONTINUE plots, [xc1-1+514, yc1-1], /device, color=251, /CONTINUE plots, [xc1-1, yc1-1], /device, color=251, /CONTINUE ;--- Draw tick marks below color bar. plots, [xc1, yc1- 3], /device, color=251 plots, [xc1, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+ 63, yc1- 3], /device, color=251 plots, [xc1+ 63, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+127, yc1- 3], /device, color=251 plots, [xc1+127, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+191, yc1- 3], /device, color=251 plots, [xc1+191, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+255, yc1- 3], /device, color=251 plots, [xc1+255, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+319, yc1- 3], /device, color=251 plots, [xc1+319, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+382, yc1- 3], /device, color=251 plots, [xc1+382, yc1- 7], /device, color=251, /CONTINUE plots, [xc1+447, yc1- 3], /device, color=251 plots, [xc1+447, yc1- 7], /device, color=251, /CONTINUE plots, [xc2, yc1- 3], /device, color=251 plots, [xc2, yc1- 7], /device, color=251, /CONTINUE ;--- Label color bar. XYOUTS, xc1 - x1 / 2, yc1 - 9 - y1, '0', /device, $ charsize=cs1, color=black XYOUTS, xc1 + 127 - 2*x1 / 2, yc1 - 9 - y1, '63', /device, $ charsize=cs1, color=black XYOUTS, xc1 + 255 - 3*x1 / 2, yc1 - 9 - y1, '127', /device, $ charsize=cs1, color=black XYOUTS, xc1 + 383 - 3*x1 / 2, yc1 - 9 - y1, '191', /device, $ charsize=cs1, color=black XYOUTS, xc1 + 512 - 6*x1 / 2, yc1 - 9 - y1, '255', /device, $ charsize=cs1, color=black ; --- Draw title. smm_title = 'HAO SMM Coronagraph' lentit = STRLEN (smm_title) print, 'lentit: ', lentit print, 'x3: ', x3 xloc = xb + (xdim - (lentit * x3)) / 2 ylab = yc2 + (yb - yc2 - y3) / 2 + FIX (y3 * 0.2) print, 'xloc: ', xloc print, 'yb, y3, ylab: ', yb, y3, ylab XYOUTS, xloc, ylab, smm_title, $ /device, font=bfont, charsize=cs3, color=red print, '<<<<<<< Leaving fits_annotate_cp' RETURN END