Viewing contents of file '../idllib/sdss/allpro/display_atlas.pro'
pro display_atlas, objstruct, imtot, i, ret, zoom, run, camcol, $
field, obj_id, cnum, rerun=rerun, sep=sep, pa=pa, $
noprompt=noprompt,silent=silent,$
hideradec=hideradec,_extra=extra
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;+
;
; NAME:
; DISPLAY_ATLAS
;
; PURPOSE:
; Subroutine of get_atlas. Displays image.
;
; CALLING SEQUENCE
; display_atlas, objstruct, imtot, i, ret, zoom, run, camcol,
; field, obj_id, cnum, rerun=rerun, sep=sep, pa=pa,
; noprompt=noprompt,silent=silent,
; hideradec=hideradec,_extra=extra
;
; Notes: 1. If plot titles don't fit on view screen, just make screen bigger.
; 2. Might want to alter the !p.charsize commands in CASE statement
; to fit your tastes. Same with titles, etc.
;
;
; INPUTS: imtot: image containing some atlas images
; i: index of index of atlas image. May change in this program.
; ph_id: index of atlas image
; zoom: zoom or not?
; run: sdss run
; camcol: camera column
; field: field of the object
; obj_id: id of object
; cnum: the requested color indexes
; color_str: color strings ['u','g',...
; struct: a photo structure
; hideradec: if set it will not include ra dec in title
; _extra: extra keywords for plotting.
;
; OUTPUTS: i may have changed
; ret: returns 'next' or 'q' for quit
;
; REVISION HISTORY:
; Erin Scott Sheldon 3/14/99 Just a modularization.
; Dave Johnston shortened plot titles to fit more info
; Dave Johnston 5/18/99 added seperation and position angle
; (when nchild eq 2) to title
; added hideradec keyword
;-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF n_params() LT 3 THEN BEGIN
print,'-Syntax: display_atlas, imtot,i, ph_id,ret, zoom, run, camcol, field, obj_id,cnum,noprompt=noprompt,struct=struct,silent=silent,hideradec=hideradec,_extra=extra'
print,'Use doc_library, "display_atlas" for more help'
return
ENDIF
IF NOT keyword_set(silent) THEN silent=0
;; find a magnitude array
tags = tag_names(objstruct)
wmag = where(tags EQ 'COUNTS_MODEL',nmod)
IF nmod EQ 0 THEN BEGIN
wmag = where(tags EQ 'PETROCOUNTS', npet)
IF npet EQ 0 THEN BEGIN
wmag = where(tags EQ 'FIBERCOUNTS',nfib)
IF nfib EQ 0 THEN BEGIN
wmag = where(tags EQ 'PSFCOUNTS',npsf)
IF npsf EQ 0 THEN BEGIN
print
print,'ERROR: No magnitude arrays found!'
print
return
ENDIF
ENDIF
ENDIF
ENDIF
IF NOT silent THEN BEGIN
print,'DISPLAY_ATLAS: Using '+tags[wmag]
print,'------------------------------------------------'
ENDIF
IF n_elements(rerun) NE 0 THEN rerstr = '-'+ntostr(rerun) ELSE rerstr=''
IF n_elements(sep) EQ 0 THEN sep = -1
IF n_elements(pa) EQ 0 THEN pa = -1
;; We have had problems fitting all the info on the screen!
;; Need an adaptive character size.
char_old = !p.charsize
px = !p.multi[1]
py = !p.multi[2]
CASE px OF
0.: !p.charsize= 1.
1.: !p.charsize= 1.
2.: !p.charsize=.7
ELSE: !p.charsize = .3
ENDCASE
CASE py OF
3: !p.charsize=1.75*!p.charsize
4: !p.charsize=1.4*!p.charsize
5: !p.charsize=1.4*!p.charsize
ELSE:
ENDCASE
c = objstruct.(wmag[0])
mag=['','','','','']
color = ['u','g','r','i','z']
FOR jj=0,n_elements(cnum)-1 DO BEGIN
mag[cnum[jj]]=strmid( strtrim(string(c[cnum[jj]]),2), 0, 5)
ENDFOR
xtitle=''
FOR jj=0,4 DO BEGIN
IF (mag[jj] NE '') THEN BEGIN
IF (xtitle NE '') THEN xtitle=xtitle+' '
xtitle=xtitle + color[jj]+'='+mag[jj]
ENDIF
ENDFOR
subtitle=''
FOR jj=0,3 DO BEGIN
IF (mag[jj] NE '' AND mag[jj+1] NE '') THEN BEGIN
diff=strmid(strtrim(string(c[jj] - c[jj+1]),2), 0, 5)
subtitle=subtitle+' '+color[jj]+'-'+color[jj+1]+'='+diff
ENDIF
ENDFOR
xtitle=xtitle + ' ' + subtitle
title = run2string(run)+'-'+ntostr(camcol)+rerstr
title = title+ '-'+field2string(field)+'-'+ntostr(obj_id)
if not keyword_set(hideradec) then begin
radecstr, objstruct.ra, objstruct.dec, ra, dec
title=title+ ' '+ra+' '+dec
endif
IF sep NE -1 THEN BEGIN
sepst=strtrim(sep,2) ;take only one digit after decimal place
title=title+' sep: '+strmid(sepst,0,strpos(sepst,'.')+2)
title=title+' pa: '+strtrim(string(fix(pa)),2)
ENDIF
zoom_old = zoom
xtitle_old=xtitle
sub_old = subtitle
sigma_clip, imtot, mean, sigma, nsig=3.5, niter=2,/silent
rdis_setup, imtot, pls
IF sigma LT 5. THEN BEGIN
low = mean
high = mean + 25.
ENDIF ELSE BEGIN
low = mean
high = mean + 10.*sigma
ENDELSE
pls.low = low
pls.high = high
;; Display and prompt user. Zoom if requested.
REPEAT BEGIN
rdis, imtot, pls, zoom=zoom, silent=1, $
xtitle=xtitle,title=title,_extra=extra
zoom = zoom_old
IF (noprompt EQ 0) THEN BEGIN
print,''
print,'(n for next) (p for previous) (r to redisplay) (q to exit)'
redo = get_kbrd(1)
ENDIF ELSE redo='n'
IF (redo EQ 'r') THEN BEGIN
print,'------------------------------------------------'
print,'Want to zoom(y/n)? n to display original.'
zm = get_kbrd(1)
print,''
IF (zm EQ 'y') THEN BEGIN ;Zooming
zoom = 1
xtitle=''
subtitle=''
ENDIF ELSE BEGIN ;Redisplay original
rdis_setup, imtot, pls & pls.low = low & pls.high = high
xtitle=xtitle_old
subtitle=sub_old
ENDELSE
ENDIF ELSE IF (redo EQ 'p') THEN begin
IF (i EQ 0) THEN BEGIN ;At the first object.
print,'------------------------------------------------'
print,'No such object. Starting over'
print,'------------------------------------------------'
tmp = get_kbrd(1)
i = i-1
ENDIF ELSE BEGIN
i = i-2 ;Going to previous object.
ENDELSE
redo ='n'
ENDIF ELSE IF (redo EQ 'q') THEN BEGIN
print,'Quitting get_atlas'
ret = 'q'
!p.charsize=char_old
return
ENDIF ELSE BEGIN
redo = 'n'
xtitle=xtitle_old
subtitle=sub_old
ENDELSE
ENDREP UNTIL (redo EQ 'n')
ret='next'
zoom = zoom_old
!p.charsize=char_old
return
END