restore, 'above2_sf2_cal_histogram_array.sav' ; This is the calibrated version restore, 'histogramArray.sav' ; This is the uncalibrated version restore, 'frameArrayReduced.sav' ; This keeps the list of raw frames, has the timing information. init_crib_colors ; Array of structures - each one has a SPEDAS time, a 256 long array of counts ; where each index is a channel number, and a 256 long array of energies, where ; each index is a channel number. ; Time dependent calibration has been applied. This is why the list of energies ; as a function of channel number changes with each entry in the ; calibratedhistogramarray structure. ; These are the energy bands that we are interested in. Group the calibrated ; results together into these bands for display. Units are KeV energy_band_spec = [[50,100],[100,150],[150,200],[200,250],[250,300],[300,1000]] eBinnedCalHistogramArray = $ make_array((size(energy_band_spec))[2], (size(histogramArray))[2]) print, 'Beginning to rebin according to calibration and energy band specification' for i=0,(size(energy_band_spec))[2] - 1 do begin for j=0,(size(eBinnedCalHistogramArray))[2] - 1 do begin eBinnedCalHistogramArray[i,j] = total( $ calibratedHistogramArray[j].counts[ $ where((calibratedHistogramArray[j].energyBins le energy_band_spec[1,i]) and $ (calibratedHistogramArray[j].energyBins gt energy_band_spec[0,i]))]) endfor endfor ; Generate the labels such that they correspond to the energy ranges elabels = List() for i=0, (size(energy_band_spec))[2] - 1 do begin elabels.add, strcompress(strtrim( string(energy_band_spec[0,i]) + '-' + string(energy_band_spec[1,i]) + ' KeV')$ , /remove_all) endfor store_data, 'rebinnedXraySpectrum', $ data={x:frameArray.frameTime, y:Transpose(eBinnedCalHistogramArray)}, limits={spec:0}, $ dlim={labels:elabels} options, 'rebinnedXraySpectrum', 'xtitle', 'Time (UTC)' options, 'rebinnedXraySpectrum', 'ytitle', 'Counts' options, 'rebinnedXraySpectrum', 'ztitle', 'Energy' tplot, 'rebinnedXraySpectrum' tlimit, '2016-08-25/10:00:40', '2016-08-25/10:40:40' end