pro sunsets,data,info_array,sx=sx

;+
; NAME:
;   sunsets
; PURPOSE:
;   To examine sunset images and select good ones.
; CALLING SEQUENCE:
;   sunsets,data,info_array,sx=[2,3]
; INPUTS:
;   data   = SXT data cube, all images of same exposure.
;   info_array = the usual produced by get_info2(index) or yodat
;   sx = index array of pairs of sunlight and sunset images where the
;       sunlight images come first, e.g.,
;       sx=[1,2,3,4,10,9,10,11,12,13,17,18]
; OUTPUTS:
;   First the sunset image is displayed with a pause, no tv scaling is done
;   Then the normal image is displayed with a pause, no tv scaling is done
;   Then the difference of the (sum of lines 10:15)/6 is presented
;  INTERPRETATION
;       No x-ray features and scatter around 0 = good sunset image
;       Largely positive values = sunset image too late (faint)
;       Negative values = poor choice of sunlight image, try again.
;
;  NOTE -- the following is to remind me how to select sunset images.
;  From morrison@sxt2.space.lockheed.com Thu Aug 12 10:04:09 1993
;  rd_roadmap, infil, roadmap      ;or have already done this through YODAT
;  tim2orbit, roadmap, tim2night=tim2night
;  ss = where(tim2night lt 1)      ;tim2night is in minutes
;
;  MODIFICATION HISTORY
;     Programmed 12-Aug-93 by LWA
;-

siz = size(sx)

for i = 0,(siz(3)-1)/2 do begin

  j=sx(2*i+1)
  k=sx(2*i)

    tv,data(*,*,j)
        break_point = 38        ; Break point
	  str0 = strmid(info_array(j),0,break_point)
          str1 = strmid(info_array(j),break_point,strlen(info_array(j)))
          xyouts,10,10,str1,charsize = 1.26,/device,color=255
          xyouts, 0,23,str0,charsize = 1.26,/device,color=255
       pause

    tv,data(*,*,k)
        break_point = 38        ; Break point
	  str0 = strmid(info_array(k),0,break_point)
          str1 = strmid(info_array(k),break_point,strlen(info_array(k)))
          xyouts,10,10,str1,charsize = 1.26,/device,color=255
          xyouts, 0,23,str0,charsize = 1.26,/device,color=255
       pause

	sunset = total(fix(data(*,10:15,j)),2)/6
	sunlight = total(fix(data(*,10:15,k)),2)/6

	plot,(sunlight - sunset)/2., psym = 1

        break_point = 38        ; Break point
	  str0 = strmid(info_array(j),0,break_point)
          str1 = strmid(info_array(j),break_point,strlen(info_array(j)))
          xyouts,10,10,str1,charsize = 1.26,/device,color=255
          xyouts, 0,23,str0,charsize = 1.26,/device,color=255

endfor

end
