Simple Scaling Issue
Mon, 05/13/2019 - 12:28 pm
In theory this is a simple task. I have a wave that I want to histogram. I need to account for the bin width for when I'm histogramming. Therefore I need to scale the wave by multiplying it by the bin width. My results are not looking great and I'm getting a crazy histogram that I'm not expecting. Hoping you folks can help catch what I'm assuming is an obvious answer.
variable Range, BinNumber
PulseInt = (PulseInt*(Range/BinNumber)) //Multiplying wave by bin width
function PulseIntHist(PulseInt, Range, BinNumber, RunTime, trialnum)
variable Range, BinNumber, RunTime
String trialnum //Spectrum type meaning ToF or Energy Spectrum
variable i, N=numpnts(PulseInt), Index
for (i=0; i<N; i+=1)
Index = (PulseInt[i]/(Range/BinNumber)) // divided by bin widths
if ((0 < Index) && (Index < BinNumber))
PulseIntHistt = PulseIntHistt/RunTime
EnergHist = "PulseInt"+trialnum+"_h"
Rename PulseIntHistt $EnergHist