@@ -154,12 +154,11 @@ GraphSpectrumCalc._dataLoadFrequencyVsX = function(vsFieldNames, minValue = Infi
154154 const matrixFftOutput = new Array ( NUM_VS_BINS ) . fill ( null ) . map ( ( ) => new Float64Array ( fftBufferSize * 2 ) ) ;
155155 const numberSamples = new Uint32Array ( NUM_VS_BINS ) ; // Number of samples in each vs value, used to average them later.
156156 const fft = new FFT . complex ( fftBufferSize , false ) ;
157+ const fftInput = new Float64Array ( fftBufferSize ) ;
158+ const fftOutput = new Float64Array ( fftBufferSize * 2 ) ;
157159
158160 for ( let fftChunkIndex = 0 ; fftChunkIndex + fftChunkLength < flightSamples . samples . length ; fftChunkIndex += fftChunkWindow ) {
159161
160- const fftInput = new Float64Array ( fftBufferSize ) ;
161- let fftOutput = new Float64Array ( fftBufferSize * 2 ) ;
162-
163162 const samples = flightSamples . samples . slice ( fftChunkIndex , fftChunkIndex + fftChunkLength ) ;
164163 fftInput . set ( samples ) ;
165164
@@ -170,10 +169,9 @@ GraphSpectrumCalc._dataLoadFrequencyVsX = function(vsFieldNames, minValue = Infi
170169
171170 fft . simple ( fftOutput , fftInput , 'real' ) ;
172171
173- fftOutput = fftOutput . slice ( 0 , fftBufferSize ) ; // The fft output contains two side spectrum, we use the first part only to get one side
174- const magnitudes = new Float64Array ( magnitudeLength ) ;
175-
176172// Compute magnitude
173+ // The fftOutput contains two side spectrum, we use the first part only to get one side
174+ const magnitudes = new Float64Array ( magnitudeLength ) ;
177175 for ( let i = 0 ; i < magnitudeLength ; i ++ ) {
178176 const re = fftOutput [ 2 * i ] ,
179177 im = fftOutput [ 2 * i + 1 ] ;
0 commit comments