PRO hsi_tile_plots, hsi_in, plot_title, $ Z_CENTER=z_center, Z_WIDTH=z_width, $ ; input to select region YCHANS=ychans, YCOUNTS=ycounts, $ ; output for analysis QE_INFO_STR=qe_info_str ; input to add to plot ; ; To test for HSI QE changes look for PHA distribution changes ; and Y-axis-projected "depressions" ; in the region which post-XRCF shows QE depression: ; Y in range 2030 to 2060, Z in range 2033, 2063 ; make some plots. ; ; hsi is the structure that comes from reading in the data file, e.g., ; hsi = mrdfits(!DDHXDSDATA+'/phase1/data/'+date_code_str+ $ ; '/hsi'+runid_str+it_str+'.fits', 1) ; hsi_tile_plots, hsi [, 'optional title'] ; ; OR if xrcf_hsi_read with QE correction and facility transformation ; is used the tile plots can be included as: ; qed_value = hsi_qe_depress(runid) ; hsi = xrcf_hsi_read(!DDHXDSDATA+'/phase1/data/'+date_code_str+ $ ; '/hsi'+runid_str+it_str+'.fits', RAW_HSI=raw_hsi, $ ; QE_DEPRESS=qed_value, QE_INFO_STR=qe_info_str) ; hsi_tile_plots, raw_hsi [, 'optional title'], QE_INFO_STR=qe_info_str ; ; 4/12/99 dd ; 5/3/99 dd New default Z_CENTER of 2045.5 (inplace of 2047.5) ; Define the central tile: ytmin = 1920. ytmax = 2180. ztmin = 1920. ztmax = 2180. ; Plot restricted a bit in the Z direction... zpmin = 1950. zpmax = 2150. ; Z center and width defaults ; new Z-center default (was 2047.5) if n_elements(Z_CENTER) EQ 0 then Z_CENTER = 2045.5 if n_elements(Z_WIDTH) EQ 0 then Z_WIDTH = 30.0 ; Define the "depressed region", roughly +/- 33 about 1046.7 yrmin = 2014. yrmax = 2080. zrmin = z_center - z_width/2.0 zrmax = z_center + z_width/2.0 ; Consider only events in the tile area sel = where(hsi_in.Y GT ytmin AND hsi_in.Y LT ytmax AND $ hsi_in.Z GT ztmin AND hsi_in.Z LT ztmax, n_tile) if n_tile LE 0 then begin print, '' print, ' * No events in HSI central tile.' print, '' RETURN end hsi = hsi_in(sel) ; randomize the positions hsiY = FLOAT(hsi.Y) + randomu(SEED,n_elements(hsi))-0.5 hsiZ = FLOAT(hsi.Z) + randomu(SEED,n_elements(hsi))-0.5 ; Select events in the "depressed region" sel = where(hsiY GT yrmin AND hsiY LT yrmax AND $ hsiZ GT zrmin AND hsiZ LT zrmax,n_region) notsel = where(hsiY LT yrmin OR hsiY GT yrmax OR $ hsiZ LT zrmin OR hsiZ GT zrmax,n_outside) print, '' print, ' Total events in tile = '+STRING(n_tile) print, ' events in region = '+STRING(n_region) print, ' events outside region = '+STRING(n_outside) print, '' ; Make PHA histograms in region and outside of region ; to see if PHA/gain varies based on the region. pha_bin_size = 1.0 if n_region GE 1 then begin lin_hist, hsi(sel).pha, pha_bin_size, phachans, phacounts end else begin phachans = [-1] phacounts = [1] end if n_outside GE 1 then begin lin_hist, hsi(notsel).pha, pha_bin_size, phaAchans, phaAcounts end else begin phaAchans = [-1] phaAcounts = [1] end ; Make projections onto the HSI-Y axis of events selected ; to be in a specified Z range sel = where(hsiY GT ytmin AND hsiY LT ytmax AND $ hsiZ GT zrmin AND hsiZ LT zrmax, n_proj) y_bin_size = 2.0 if n_proj GE 1 then begin lin_hist, hsiY(sel), y_bin_size, ychans, ycounts end else begin ychans = [-1] ycounts = [1] end ; Do some plotting! !p.multi = [0,1,3] charsize = 1.8 if n_elements(plot_title) EQ 0 then plot_title='HSI Data' region_color = 20 ; Add the QE_INFO_STR to the X-axis label, if present xtitle_add_on = '' if n_elements(QE_INFO_STR) GT 0 then begin xtitle_add_on = ' ['+qe_info_str+']' end ; Limit the number of events for the scatter plot... max_events_to_plot = 50000 if n_elements(hsiY) GT max_events_to_plot then begin sel = lindgen(max_events_to_plot) end else begin sel = lindgen(n_elements(hsiY)) end plot, hsiY(sel), hsiZ(sel), PSYM=3, $ XRANGE=[ytmin,ytmax], XSTYLE=1, $ YRANGE=[zpmin,zpmax], YSTYLE=1, $ TITLE=plot_title, $ XTITLE='HSI Y (pixels)'+xtitle_add_on, $ YTITLE='HSI Z (pixels)', $ CHARSIZE = charsize ; Indicate the region(solid) and projection limits(dashed) oplot, [yrmin,yrmax], [zrmin,zrmin], COLOR=region_color oplot, [yrmin,yrmax], [zrmax,zrmax], COLOR=region_color oplot, [ytmin,ytmax], [zrmin,zrmin], LINESTYLE=2, COLOR=region_color oplot, [ytmin,ytmax], [zrmax,zrmax], LINESTYLE=2, COLOR=region_color oplot, [yrmin,yrmin], [zrmin,zrmax], COLOR=region_color oplot, [yrmax,yrmax], [zrmin,zrmax], COLOR=region_color plot, ychans, ycounts, PSYM=10, $ XRANGE=[ytmin,ytmax], XSTYLE=1, $ TITLE='Y-axis Projection, Z_center = ' + $ STRING(z_center,FORMAT='(F7.1)') + $ ', Z_width = ' + STRING(z_width, FORMAT='(F5.1)'), $ XTITLE = 'HSI Y (pixels)', YTITLE='Counts per 2-pixel bin', $ CHARSIZE = charsize ; Highlight the in-region values in_reg = where(ychans GT yrmin AND ychans LT yrmax, n_highlight) if n_highlight GE 1 then oplot, ychans(in_reg), ycounts(in_reg), $ PSYM=10, COLOR=region_color ; and show the boundaries oplot, [yrmin, yrmin], [0.,2.*MAX(ycounts)], LINESTYLE=1, COLOR=region_color oplot, [yrmax, yrmax], [0.,2.*MAX(ycounts)], LINESTYLE=1, COLOR=region_color plot, phachans, phacounts/TOTAL(FLOAT(phacounts)), PSYM=10, $ CHARSIZE = charsize, /NODATA, $ XRANGE=[0.,150.], XSTYLE=1, $ YRANGE=[0.,0.025], YSTYLE=1, $ TITLE='Normalized PHA Distribution Inside(solid) and Outside(+) Region', $ XTITLE='PHA', YTITLE='Normalized fraction/bin' oplot, phachans, phacounts/TOTAL(FLOAT(phacounts)), PSYM=10, $ COLOR=region_color ; histogram from outside of region: oplot, phaAchans, phaAcounts/TOTAL(FLOAT(phaAcounts)), PSYM=1 RETURN END