Summing and storing values from a 2D wave
j s s
Hi all,
I generated a 50x50 wave
I need to essentially collapse the x axis by taking many sums with a specified range. For context, the x axis is energy (MeV) and the y axis is PSD (unitless). In this case I need to take the sum of the columns every 0.25 MeV. These summed energies will have a corresponding y value, and I will then store these values in a separate wave. The plotted wave will have counts against PSD.
Hope this makes sense. This is what I have so far.
function(EnergyColumn)
wave EnergyColumn
Variable numColumns = dimsize(EnergyColumn,1)
Make/O/N = (numColumns) Sumss
Variable R1, R2, R3, R4, R5, R6, R7
SetScale/P x 0, 0.25 "Energy", EnergyColumn
Sum(EnergyColumn, 0.0, 0.25)
Sum(EnergyColumn, 0.25,0.50)
Sum(EnergyColumn, 0.50,0.75)
Sum(EnergyColumn, 0.75, 1.0)
Sum(EnergyColumn, 1.25,1.50)
Sum(EnergyColumn, 1.50,1.75)
Sum(EnergyColumn, 1.75, 2.0)
end
wave EnergyColumn
Variable numColumns = dimsize(EnergyColumn,1)
Make/O/N = (numColumns) Sumss
Variable R1, R2, R3, R4, R5, R6, R7
SetScale/P x 0, 0.25 "Energy", EnergyColumn
Sum(EnergyColumn, 0.0, 0.25)
Sum(EnergyColumn, 0.25,0.50)
Sum(EnergyColumn, 0.50,0.75)
Sum(EnergyColumn, 0.75, 1.0)
Sum(EnergyColumn, 1.25,1.50)
Sum(EnergyColumn, 1.50,1.75)
Sum(EnergyColumn, 1.75, 2.0)
end
Have a look at
MatrixOP 1DWave=sumCols(2DWave)
February 11, 2019 at 11:24 am - Permalink