PRO FST_OVERVIEW_PLOTS, pwrspect, timesec, freqmhz, t0, CHLABELS=chlabels, TITLE=title, PS=ps, COLORS=colors ; ; Generates multichannel 1-dimensional overview plots of FST spectrogram data. ; t0 is the time (ANYTIM format) of 1st datum ; timesec is vector of times (seconds) relative to to ; ; ampspect is the 2 dimensional (ntime x nfreq) array to be displayed. Elements are > 0. ; freqmhz is frequency vectors with nfreq elements ; title is an array of titles, one for each channel. ; ; 22-Jun-2005 Initial version with light curve (ghurford@ssl.berkeley.edu) ; 23-Jun-2005 gh Add spectrum and histogram plots. ; Add PS keyword ; 24-Jun-2005 gh Improve plot labels and reorder plots. ; 5-Sep-05 gh Vectorize TITLE keyword and add CHLABELS keyword to improve plot labelling. ; 7-Sep-05 gh Eliminate zero-inputs to histogram ; 26-Feb-06 gh Debug case of ntime=1 ; 27-Feb-06 gh Suppress lightcurve plot if ntime=1 ; 22-May-06 gh Adapt to use base_time and relative time (seconds) in input so that UTPLOT can be used to display absolute times. ; DEFAULT, colors, [255, 254, 128] ntime = N_ELEMENTS(timesec) nfreq = N_ELEMENTS(freqmhz) nch = N_ELEMENTS(pwrspect) / ntime / nfreq pwrspect = REFORM(pwrspect, ntime, nfreq, nch) ; Need to reassert dimensions if any are 1. ; ; Intensity histogram LOADCT, 39, /SILENT ; Rainbow logsp = REFORM(ALOG(pwrspect), ntime*nfreq, nch) ; Will include -Inf values where pwrspect = 0 maxlogsp = MAX(logsp, MIN=minlogsp, /NAN) IF ps EQ 0 THEN WINDOW, /FREE nbins = 100 maxsp = EXP(maxlogsp) minsp = EXP(minlogsp) factor = (maxsp/minsp)^(1./nbins) hval = minsp * factor^(FINDGEN(nbins)+0.5) hist = FLTARR(nbins, nch) FOR nc=0, nch-1 DO hist[*,nc] = HISTOGRAM(logsp[*,nc], MIN=minlogsp, MAX=maxlogsp, NBINS=nbins) maxhist = MAX(hist) FOR nc=0, nch-1 DO BEGIN gz = WHERE(hist[*,nc] GT 0) IF nc EQ 0 THEN BEGIN hmin = hval[gz[0]] PLOT, hval[gz], hist[gz,0], YRANGE=[1, maxhist], /YLOG, /XLOG, PSYM=7, TITLE=title[0], $ XTITLE='Power/MHz', YTITLE='Number of points per logarithmic interval' XYOUTS, hmin, maxhist*0.5, chlabels[0] ENDIF IF nc GT 0 THEN BEGIN OPLOT, hval[gz], hist[gz,nc], PSYM=7, COLOR=colors[nc] XYOUTS, hmin, maxhist*0.5^(nc+1), chlabels[nc], COLOR=colors[nc] ENDIF ENDFOR ; ; Frequency-averaged light-curves if there is more than one time point. IF N_ELEMENTS(timesec) GT 1 THEN BEGIN lightcurve = TOTAL(pwrspect, 2)/nfreq ; ntime x nch array lcmax = MAX(lightcurve, MIN=lcmin) IF ps EQ 0 THEN WINDOW, /FREE UTPLOT, timesec, lightcurve[*,0], t0, YRANGE=[lcmin, lcmax], $ YTITLE='Power', TITLE=title[1], PSYM=1, SYMSIZE=0.5 IF nch GT 1 THEN FOR nc=1, nch-1 DO OPLOT, timesec, lightcurve[*,nc], COLOR=colors[nc] ENDIF ; ; Time-integrated spectra spectra = TOTAL(pwrspect,1)/ntime ; nfreq x nch array spmax = MAX(spectra, MIN=spmin) IF ps EQ 0 THEN WINDOW, /FREE PLOT, freqmhz, spectra[*,0], YRANGE=[spmin, spmax], /YLOG, $ XTITLE='Frequency (MHz)', YTITLE='Power/MHz', TITLE=title[2] IF nch GT 1 THEN BEGIN FOR nc=1, nch-1 DO OPLOT, freqmhz, spectra[*,nc], COLOR=colors[nc] ENDIF LOADCT, 0, /SILENT ; Greyscale RETURN END