Viewing contents of file '../idllib/sdss/allpro/find_radec_fchart.pro'
PRO find_radec_fchart, ra, dec, fchart, pstruct, $
clr=clr, radius=radius, maxsize=maxsize, tol=tol, $
atldir=atldir, $
nonoise=nonoise, $
nocirc=nocirc, $
circra=circra, circdec=circdec, $
nodisplay=nodisplay, psfile=psfile, $
usesao=usesao, silent=silent, $
photoid=photoid, $
objx=objx, objy=objy, $
_extra=extra, runuse=runuse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;+
;
; NAME:
; FIND_RADEC_FCHART
;
; PURPOSE:
; Create a finding chart for the input coordinates.
;
; CALLING SEQUENCE:
; find_radec_fchart, ra, dec [, fchart, pstruct,
; clr=clr, radius=radius, maxsize=maxsize, tol=tol,
; atldir=atldir,
; nonoise=nonoise,
; nocirc=nocirc,
; circra=circra, circdec=circdec,
; nodisplay=nodisplay, psfile=psfile,
; usesao=usesao, silent=silent,
; photoid=photoid, objx=objx, objy=objy,
; _extra=extra ]
;
; INPUTS:
; ra, dec: position of interest in degrees.
;
; OPTIONAL INPUTS:
; clr: bandpass of images from which to create finding chart.
; Must be an integer [r,g,u,i,z] -> [0,1,2,3,4]
; Default is red (2)
; radius: Half length of the square finding chart in pixels.
; maxsize: maximum size for atlas images; sent to atlas images. If
; your images are being clipped off, you should increase
; maxsize. default = [500,500]
; tol: Tolerance for finding nearby object in arcseconds.
; Default is 100.
; circra, circdec: Other positions to circle besides ra,dec
; runuse: find_radec may return more than one run. Set this value
; to an integer to choose which run.
; _extra: Extra plotting keywords.
;
; KEYWORD PARAMETERS:
; nonoise: Set for no noise in fchart.
; usesao: Use sao to plot image.
;
; OPTIONAL OUTPUTS:
; pstruct: A photo structure containing all objects in the frame
; of ra,dec as well as the two frames before and after (if
; its the first or last frame then it uses next two or
; previous two.
; fchart: The finding chart
; photoid: Returns Id of nearest object.
; altdir: atlas directory
;
; CALLED ROUTINES:
;
; FIND_RADEC
; TSOBJ_NAME
; RUN_DIR
; READ_PHOTO_COL
; FCHART_CIRC_RADEC
; CIRC_RADEC
; (SAO)
;
; PROCEDURE:
;
; Use find_radec to get the run, camcol, and field of an object that
; is nearby to ra,dec and then read in the nearby objects. Then create
; a finding chart and circle the ra,dec postion.
;
; REVISION HISTORY:
; Author: Erin Scott Sheldon UofMich 10/15/99
;
;
;-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF N_params() EQ 0 THEN BEGIN
print,'-Syntax: find_radec_fchart, ra, dec [, fchart, pstruct, '
print,' clr=clr, radius=radius, maxsize=maxsize, tol=tol,'
print,' atldir=atldir, '
print,' nonoise=nonoise,'
print,' nocirc=nocirc, '
print,' circra=circra, circdec=circdec, '
print,' nodisplay=nodisplay, psfile=psfile, '
print,' usesao=usesao, silent=silent, '
print,' photoid=photoid, objx=objx, objy=objy, '
print,' _extra=extra ]'
print,''
print,'Use doc_library,"find_radec_fchart" for more help.'
return
ENDIF
IF n_elements(clr) EQ 0 THEN clr=2
IF n_elements(radius) EQ 0 THEN radius = 300
IF n_elements(tol) EQ 0 THEN tolerance = 100/3600. ELSE tolerance=tol*3600.
IF NOT keyword_set(usesao) THEN usesao = 0
IF n_elements(maxsize) EQ 0 THEN maxsize = [500,500]
delvarx, fchart
find_radec, ra, dec, run, camcol, field, /silent
IF run[0] EQ -1 THEN return
;; only use first match
IF n_elements(runuse) EQ 0 THEN runuse = 0
;; use !run_status to get the right rerun
wr=where(!run_status.run EQ run[runuse])
rerun = !run_status[wr].rerun
fetch_dir, run[runuse], camcol[runuse], rerun, dir, atldir
fetch_file_list, dir, files, fnums,fieldmax=fmax, fieldmin=fmin
IF field[runuse] EQ fmin THEN BEGIN
start = field[runuse]
nframes = 2
ENDIF ELSE IF field[runuse] EQ fmax THEN BEGIN
start = field[runuse]-1
nframes = 2
ENDIF ELSE BEGIN
start = field[runuse]-1
nframes = 3
ENDELSE
read_tsobj, dir, pstruct, start=start, nframes=nframes
sendra = ra
senddec = dec
IF (n_elements(circra) NE 0) AND (n_elements(circdec) NE 0) THEN BEGIN
sendra = [ra,circra]
senddec = [dec, circdec]
ENDIF
fchart_circ_radec, pstruct, sendra, senddec, fchart, maxsize=maxsize, $
dir=atldir, clr=clr, radius=radius, tol=tolerance, $
nonoise=nonoise, $
nodisplay=nodisplay, psfile=psfile, $
silent=silent, $
photoid=objid, $
objx=objx, objy=objy, $
nocirc=nocirc, $
_extra=extra
photoid = objid
IF usesao THEN sao, fchart,'histeq'
return
END