Viewing contents of file '../idllib/iuedac/iuelib/pro/flagblem.pro'
;******************************************************************************
;+
;*NAME:
;
; FLAGBLEM (RDAF General Production Library) JAN 30, l983
;
;*CLASS
;
; Data Editing
;
;*CATEGORY:
;
; IUESIPS NEWSIPS
;
;*PURPOSE:
;
; Plots expanded region around blemishes and prompts user for input
; of user flagged points. Then displays flags and unflags regions
; specified by user. Called by BSPOT.
;
;*CALLING SEQUENCE
;
; FLAGBLEM,WAVE,FLUX,EPS,mode,INX,NFLAG,NEWSIPS
;
;*PARAMETERS:
;
; WAVE (REQ) (I) (1) (R)
; Input wavelength vector in Angstroms obtained from input
; IUESIPS LBLS or NEWSIPS SILO file originally read by BSPOT and
; then passed into FLAGBLEM.
;
; FLUX (REQ) (I) (1) (R)
; Input slit_integrated flux vector obtained from input IUESIPS
; LBLS or NEWSIPS SILO file as above WAVE vector.
;
; EPS (REQ) (I) (1) (R)
; Input IUESIPS epsilon vector quality flags or NEWSIPS nu flags
; to mark questionable data at each wavelength obtained from
; input IUESIPS LBLS or NEWSIPS SILO file as above FLUX vector.
;
; MODE (OPT) (I) (0) (I)
; Determines type of interpolation to be used when user selects
; interpolation. If not specified, MODE is set to 0.
; Thus MODE is used to key interpolation step:
; 0 = use nearest good data points for interpolation.
; 1 = use cursor (horizontal) to set flux level.
;
; INX (REQ) (I) (1) (I)
; Expanded display window around blemished region. See BSPOT for
; derivation.
;
; NFLAG (REQ) (O) (0) (I)
; Flag to determine whether new points flagged by user.
;
; NEWSIPS (REQ) (I) (0) (I)
; Equals 0 for IUESIPS data. Equals 1 for NEWSIPS data.
;
;*EXAMPLES:
;
; See BSPOT.PRO prolog.
;
;*SYSTEM VARIABLES USED:
;
; none
;
;*INTERACTIVE INPUT:
;
; Prompts user to flag bright spots or blemishes
;
;*SUBROUTINES CALLED:
;
; PARCHECK
; BS_PLOTFLAG
; BS_FLAG
;
;*FILES USED:
;
; Those established by BSPOT.PRO.
;
;*SIDE EFFECTS:
;
;*NOTES:
;
;*PROCEDURE:
;
; Instructions are printed for flagging bright spots, users input
; (screen positions and/or character) is read and flagged points
; shown to user, episilon flags are set and/or blemishes interpolated
; over.
;
;*MODIFICATION HISTORY:
;
; 30-JAN-83 written by R.J. Panek
; See BSPOT.PRO documentation for further modification history.
; 10_MAR-88 HAA add RDAF Prolog
; jan-10-90 jtb @gsfc modified for unix / sun idl version 1.2
; jul-22-91 pjl @gsfc cleaned up; added npar equals 0 print and
; PARCHECK; tested on SUN and VAX; updated prolog
; 6 Apr 94 PJL added NEWSIPS parameter; removed gotos
;
;-
;******************************************************************************
pro flagblem,wave,flux,eps,mode,inx,nflag,newsips
;
npar = n_params(0)
if (npar eq 0) then begin
print,'FLAGBLEM,WAVE,FLUX,EPS,mode,INX,NFLAG,NEWSIPS'
retall
endif ; npar eq 0
parcheck,npar,[6,7],'FLAGBLEM'
;
iw = fltarr(2)
iw1 = 0
iw2 = 0
sflux = flux
seps = eps
line = string(bytarr(72) + 45b)
;
goon = 1
while (goon eq 1) do begin ; loop back here if goon = 1
;;; again1: ; loop back here if goon = 1
flux = sflux
eps = seps
goon = 2
while (goon eq 2) do begin ; ; loop back here if goon = 2
;;; again2: ; loop back here if goon = 2
plot,wave(inx),flux(inx), $
xtitle='Wave',ytitle='Flux',psym=10,xrange=[0,0],yrange=[0,0]
bs_plotflag,wave(inx),flux(inx),eps(inx),newsips
;
; print out instructions for flagging bright spots.
;
print,line
print,' to flag, position cursor and hit <cr> at ' + $
'each edge'
print,' to interpolate, position cursor and hit i at each edge'
print,' to remove user flagging, position cursor and hit x at each edge'
print,' to remove all flagging, position cursor and hit r at each edge'
print,line
print,' [type 0 to exit] [type c to continue] '
print,line
if (newsips) then print,' plot symbols: * = interpolated or user ' + $
'flagging, x = NEWSIPS flagging' else print,' plot symbols: ' + $
'* = interpolated, + = user flagging, x = IUESIPS flagging'
print,' '
;
; read users input (screen positions and/or character)
;
bs_flag,wave,flux,eps,inx,nflag,mode,er1,newsips
;
; show flagged points to user
;
if ( (er1 ne 67) and (er1 ne 99) ) then begin ; if continue not specified
plot,wave(inx),flux(inx), $
xtitle='Wave',ytitle='Flux',psym=10,xrange=[0,0],yrange=[0,0]
bs_plotflag,wave(inx),flux(inx),eps(inx),newsips
print,'Enter 0 to continue, 1 to re-display with changes removed,'
read,' or 2 to redisplay with changes intact. > ',goon
;;; if (goon eq 1) then goto,again1
;;; if (goon eq 2) then goto,again2
endif ; er1
endwhile ; goon eq 2
endwhile ; goon eq 1
;
return
end ; flagblem