fftForward

src/fft.ts

A higher level function to calculate DFT. Returns a FFTResult for easier access to the result as complex, amp, phase arrays. Calls calcDFT internally. Inverse FFT is available as FFTResult.fftInverse().

fftForward(seis: (Seismogram | SeismogramDisplayData)): FFTResult
Parameters
seis ((Seismogram | SeismogramDisplayData)) seismogram or SeismogramDisplayData to transform
Returns
FFTResult: fft of seismogram

calcDFT

src/fft.ts

Calculates the discrete fourier transform using the OregonDSP library.

This is a lower level function, fftForward is better for most uses.

calcDFT(timeseries: (Int32Array | Float32Array | Float64Array)): Float32Array
Parameters
timeseries ((Int32Array | Float32Array | Float64Array)) timeseries array
Returns
Float32Array: DFT as packed array Float32Array

inverseDFT

src/fft.ts

Calculates the inverse discrete fourier transform using the oregondsp library.

inverseDFT(packedFreq: Float32Array, numPoints: number): Float32Array
Parameters
packedFreq (Float32Array) DFT as packed array Float32Array
numPoints (number) number of points in original timeseries array.
Returns
Float32Array: inverse of DFT as a timeseries array

findPowerTwo

src/fft.ts

Finds smallest power of two >= input number.

findPowerTwo(fftlength: number): [number, number]
Parameters
fftlength (number) input number
Returns
[number, number]: tuple of N and log2N, like [16,4]

FFTResult

src/fft.ts

Results of FFT calculation. Allows convertion of the packed real/imag array output from calcDFT into amplitude and phase.

new FFTResult(origLength: number, sampleRate: number)
Parameters
origLength (number)
sampleRate (number)
Static Members
createFromPackedFreq(packedFreq, origLength, sampleRate)
createFromComplex(complexArray, origLength, sampleRate)
createFromAmpPhase(amp, phase, origLength, sampleRate)
Instance Members
origLength
packedFreq
numPoints
sampleRate
inputUnits
seismogramDisplayData
fundamentalFrequency
asComplex()
asAmpPhase()
fftInverse()
frequencies()
numFrequencies
minFrequency
maxFrequency
amplitudes()
phases()
clone()