pro fix_decon_pits,index_in,data_in,index_out,data_out,silent=silent ;+ ; NAME: ; fix_decon_pits ; ; PURPOSE: ; Remove "pits" of negative pixel values surrounding short duration ; brightenings in SXT movie composites (SSS images). ; If a short duration brightening (e.g., impulsive flare) happens to ; occcur during the short exposure, but is finished by the time of the ; long exposure, then the long+short composite image will suffer when ; the descattering step is applied. Deconvolution from the PSF will ; result in too much signal being taken from the faint plasma ; observed in the long exposure (because it's assumed to be due to ; scattering when really it's not), so that the final composite image ; will have a "pit" of negative pixel values surrounding the brightening. ; This simpleminded program fixes these pits by identifying all pixels ; with negative values, and replacing them with values from the Level-1 ; long exposure. The program is a blunt instrument in that it makes no ; distinction between the pits due to pathological short-duration ; brightenings and negative pixels caused by statistical fluctuations in ; areas of low signal (i.e., coronal holes and the corners of the FOV). ; For this reason, the program should ONLY BE USED FOR MOVIE IMAGES, ; AND IS NOT SUITABLE FOR TREATING THE SCIENCE-QUALITY QUANTITATIVE ; IMAGES. ; ; CALLING SEQUENCE: ; fix_decon_pits,index_in,data_in,index_out,data_out,silent=silent ; ; INPUT PARAMETERS: ; index_in = input index structure, needed for FMT_TIMER ; data_in = input image cube (SSCs for Yohkoh Legacy Archive) ; ; OUTPUT PARAMETERS: ; index_out = output index structure (currently = index_in) ; data_out = output image cube ; ; OPTIONAL PARAMETERS: ; silent = suppresses printing of time elapsed while running ; ; RESTRICTIONS: ; Uses the Level-1 FITS images located in '/disk/yl2/sxtf_fits/' ; ; HISTORY: ; Written 16-May-2006, DMcK ; 16-Jun-2006 LWA Fixed up header. ; Changed lev1dir to /disk/yl2/sxtf_fits. ; 26-Jun-2006 LWA size(3) doesn't work for one image, fixed. ; 22-Aug-2007 LWA Expanded use of keyword silent. ; 29-Jan-2009 LWA Change to handle case of no sxtf file. ; 25-Apr-2009 LWA Only look for pits in bright areas where ; 15-point boxcar smoothed image has intensity ; greater than 400 DN/pix/sec. ; 10-May-2011 LWA lev1dir='/disk/yla/www/archive/yohkoh/sxtf_fits/' ;- sttime=systime(1) index_out=index_in data_out=data_in silent=keyword_set(silent) ;sz=size(data_in) n_images=n_elements(index_in) for i_image=0,n_images-1 do begin hole_image=data_in(*,*,i_image) smth_image=big_smooth(hole_image,15) brite=where(alog(smth_image>1) gt 6,nbr) if nbr eq 0 then goto,jump fixed_image=hole_image pitflag=where(hole_image(brite) lt 0.,n_neg) if (n_neg gt 0) then begin ; Need Level-1 image for replacement values for these pixels fmt_timer,index_in(i_image),img_time,/quiet ; Use FITS images, unless there's something better ;lev1dir='/disk/yl5/sxtf_fits/' ;lev1dir='/disk/yl2/sxtf_fits/' lev1dir='/disk/yla/www/archive/yohkoh/sxtf_fits/' lev1date=anytim(img_time,/date_only,/ecs) lev1dir=lev1dir+lev1date+'/' lev1date=strmid(lev1date,0,4)+$ strmid(lev1date,5,2)+strmid(lev1date,8,2) lev1time=anytim(img_time,/time_only,/ecs,/truncate) lev1time=strmid(lev1time,0,2)+$ strmid(lev1time,3,2)+strmid(lev1time,6,2) filnam='sxtf_'+lev1date+'_'+lev1time+'*.fts' infil=find_file(lev1dir+filnam) if infil eq '' then goto,jump ; What in the world is the following if command for? ; Must be left over from debugging. ; if i_image ge 117 and i_image lt 122 then begin ; print,i_image ; print,filnam ; print,infil ; if i_image eq 118 then goto,jump ; ;stop ; endif ; Not sure if repeated calls to FIND_FILE is the quickest way ; to do this--could probably predict the filename via ; gt_res+gt_filtb, etc.--but this is the surest way to find it. mreadfits,infil,lev1_index,lev1_data,/silent ; If the size of the input SSC image and the size of the Level-1 ; FITS image don't match (e.g., for 256x256 images in a 512x512 array), ; the long-variable addresses of the pixels will be off, ; because of the difference in width. ; So now that we've ascertained there ARE negative pixels, go and ; find them again, assuming the same image size in Lev2 as Lev1. ; Thusly: lev1sz=size(lev1_data) hole_image=data_in(0:lev1sz(1)-1,0:lev1sz(2)-1,i_image) smth_image=big_smooth(hole_image,15) brite=where(alog(smth_image>1) gt 6) fixed_image=hole_image pitflag=where(hole_image(brite) lt 0.,n_neg) fixed_image(brite(pitflag))=lev1_data(brite(pitflag)) data_out(0:lev1sz(1)-1,0:lev1sz(2)-1,i_image)=fixed_image endif jump: endfor ;if not silent then print,'FIX_DECON_PITS took ',$ ; strtrim((systime(1)-sttime),1),' seconds to complete your request.' end