Viewing contents of file '../idllib/uit/pro/darkspot.pro'
pro DarkSpot,header, WINDOW = window
;+
; PROCEDURE:
; DARKSPOT
; PURPOSE:
; Draw circles around UIT's infamous dead spots, including compensating
; for GEOMed images. Image should be displayed in the current window.
;
; CALLING SEQUENCE:
; DARKSPOT, HEADER, [ Window = ]
;
; INPUTS:
; HEADER - FITS header of UIT image in the window.
;
; Table of dark spots is loaded from the files A_SPOTS.DAT and
; B_SPOTS.DAT, which are in the UIT_DATA directory.
;
; KEYWORD INPUTS:
; Window - If specified, the routine will use the window number given
; rather than the current window.
;
; SIDE EFFECTS:
; The currently selected window may change during the running of the
; routine, but will be back to the original at the exit.
;
; SVExtast will add the SV parameters (mimicing the same parameters in
; FLIGHT13 headers) if they are not present in the original header. This
; will save the necessity to make another look-up in the data base.
; HISTORY:
; Written J.D. Offenberg, STX, Dec, 1991
; Updated to use ASTROMETRY structures. J.D.Offenberg, HSTX, Jan 1993
; Updated for new ASTROMETRY structures W. Landsman Jan 1994
;-
On_error,2
DEF_DIR = getlog('UIT_DATA')
if N_Params() LT 1 then begin
print,'Syntax - DARKSPOT, HEADER, Xll, Yll, [ Window = ]
return
endif
;----------------------
;Check to be sure that the first parameter is exists and is a header.
SHD = Size(Header)
HD_OK = 1
IF SHD(0) ne 1 then HD_OK = 0 $ ;Header must be an array
ELSE IF SHD(2) ne 7 then HD_OK = 0 ;Header must be an array of strings
IF HD_OK EQ 0 then begin
message,/inf,"First parameter must be a FITS header"
return
endIF
;----------------------
;Find out which camera (A or B) was used. If not supplied in the header, find
;out from the user.
FILTER = sxpar(header,"FILTER")
IF Datatype(FILTER) ne "STR" then FILTER = "X"
AorB = strupcase(strmid(strtrim(FILTER),0,1))
While not(AorB eq "A") and not(AorB eq "B") do BEGIN
Message,/inf,"The header does not specify a UIT camera!"
read,"Please specify UIT Camera (A or B):",AorB
AorB = strupcase(strmid(strtrim(AorB),0,1))
endWHILE
Spot_List = Def_Dir+AorB+"_spot.DAT"
old_window = !window
;-----------------------
;Select the proper window to draw the circles (Current window unless otherwise
;specified).
If not(keyword_set(Window)) then window = !window
chan, window
;-----------------------
;Read in appropriate list of dark spots
readcol,Spot_List,Xim,Yim,diam,/silent
Xim = Xim + 0.5
Yim = Yim + 0.5
;------------------------
;Compute the scaling of the image: If the output image is not 512 x 512, then
;we need to scale the DIAM appropriately.
uit_Extast,header, astr
SVExtast,header,old_astr,old_rot
XPIX = sqrt((old_astr.cd(0,0)^2 + old_astr.cd(1,0)^2))*3600
YPIX = sqrt((old_astr.cd(0,1)^2 + old_astr.cd(1,1)^2))*3600
XSCL = XPIX/4.54660
YSCL = YPIX/4.54660
Xim = Xim/Xscl
Yim = Yim/Yscl
XPIX2 = sqrt((astr.cd(0,0)^2 + astr.cd(1,0)^2))*3600
YPIX2 = sqrt((astr.cd(0,1)^2 + astr.cd(1,1)^2))*3600
XSCL2 = XPIX2/4.54660
YSCL2 = YPIX2/4.54660
DIAM = diam/((XSCL2 + YSCL2)/2.)
;-----------------------
;Compute BDR astrometry and current astrometry. Use to compensate for
;the possibility that the image has been GEOMed, HASTROMed or otherwise rotated.
UIT_XY2AD, Xim, Yim, old_astr, RA, dec
UIT_AD2XY, Ra, Dec, astr, Txim, Tyim
;------------------------
;Compute the tv coordinates based on the image coordinates now selected and
;draw the circles. ZOOM_XY will compensate if a subimage was plotted using
;CTV or CTVSCL.
zoom_xy,txim,tyim,xtv,ytv
n = n_elements(xim)
for I=0,n-1 do tvcircle,diam(I),xtv(I),ytv(I)
chan,old_window
end