Last updated

API / geotoolkit / seismic / analysis / transforms / RealFFT / RealFFT

Class: RealFFT

transforms.RealFFT.RealFFT

Defines a class capable of computing the forward and backward Real Fast Fourier Transform This implementation performs a size n real transform using a size n/2 complex transform. For the complex transform the radix 2-4-8 fft algorithm is used. Remarks: In browsers this transform is usually slower than the complex transform.

Hierarchy

Table of contents

Constructors
Methods

Contents

Constructors

new RealFFT(real, imag, sampleRate, length)

new RealFFT(real?, imag?, sampleRate?, length?)

Parameters

Name Type Description
Optional realFloat32ArrayThe real component of the signal
Optional imagFloat32ArrayThe imaginary component of th signal
Optional sampleRatenumberThe data sampling rate in milliseconds
Optional lengthnumberThe desired length of the transform, must be a power of 2

Inherited from

FFT.constructor

Methods

getClassName

getClassName(): string

Returns

string

Inherited from

FFT.getClassName


getFDSampleRate

getFDSampleRate(): number

Returns the Frequency Domain sample rate. This is the frequency domain sample spacing.

Returns

number

FrequencySampleRate Frequency Domain sampling rate in milliseconds (ms)

Inherited from

FFT.getFDSampleRate


getFFTAmplitude

getFFTAmplitude(): Float32Array

Computes the Amplitude spectrum of the input signal.*

Returns

Float32Array

amplitudes - array containing the amplitude spectrum

Inherited from

FFT.getFFTAmplitude


getFFTAmplitudeSmooth

getFFTAmplitudeSmooth(hzLength): Float32Array

Computes the Amplitude spectrum of the input signal and smoothes the output to hzLength (in frequency).

Parameters

Name Type Description
hzLengthnumberint operator length in hz/samples

Returns

Float32Array

amplitudes - array containing the amplitude spectrum

Inherited from

FFT.getFFTAmplitudeSmooth


getFFTPhaseDegrees

getFFTPhaseDegrees(): Float32Array

Computes the phase spectrum of the input signal in degrees.

Returns

Float32Array

phases - array containing the phase spectrum of the input signal in degrees.

Inherited from

FFT.getFFTPhaseDegrees


getFFTPhaseInDegreesUnWrapped

getFFTPhaseInDegreesUnWrapped(): Float32Array

Computes the phase spectrum in unwrapped degrees in the range(0->360).

Returns

Float32Array

phases - array containing the unwrapped phase spectrum in degrees

Inherited from

FFT.getFFTPhaseInDegreesUnWrapped


getFFTPhaseInRadiansUnWrapped

getFFTPhaseInRadiansUnWrapped(): Float32Array

Computes the phase spectrum in unwrapped radians in the range(-pi to +pi).

Returns

Float32Array

phases - array containing the unwrapped phase spectrum in radians

Inherited from

FFT.getFFTPhaseInRadiansUnWrapped


getFFTPhaseRadians

getFFTPhaseRadians(): Float32Array

Computes the phase spectrum in radians of the input signal.

This is the phase spectrum of the input signal in range of 0 to 2*pi.

Returns

Float32Array

phases - array containing the phase spectrum in radians

Inherited from

FFT.getFFTPhaseRadians


getFFTPower

getFFTPower(): Float32Array

Computes the power spectrum (amplitude squared) of the FFT.

Returns

Float32Array

powers - array containing the power spectrum

Inherited from

FFT.getFFTPower


getFFTPowerInDb

getFFTPowerInDb(): Float32Array

Computes the power spectrum (amplitude squared) of the FFT. This is the the power spectrum in dB-down, based on the maximum power value associated with (0(Zero) db down).

Returns

Float32Array

powersDb - array container the power spectrum in dB

Inherited from

FFT.getFFTPowerInDb


getFFTPowerInDbNormalized

getFFTPowerInDbNormalized(pReference): Float32Array

Computes the normalized power spectrum (amplitude squared) of the FFT.

This is the the power spectrum in dB-down, based on the reference power value supplied in the parameter nFactor.

Parameters

Name Type Description
pReferencenumberfloat reference value

Returns

Float32Array

powersDbNorm - array containing the power spectrum in dB

Inherited from

FFT.getFFTPowerInDbNormalized


getFFTPowerInDbSmoothed

getFFTPowerInDbSmoothed(hzLength): Float32Array

Computes the smoothed & normalized dB power spectrum (amplitude squared) of the FFT. This is the the power spectrum in dB-down, based on the maximum power value associated with (0(Zero) db down).

Parameters

Name Type Description
hzLengthnumberint operator length in hz/samples

Returns

Float32Array

powersDbSmoothed - array containing the power specturm in db and smoothed.

Inherited from

FFT.getFFTPowerInDbSmoothed


getFFTPowerSmoothed

getFFTPowerSmoothed(hzLength): Float32Array

Computes the smoothed power spectrum (amplitude squared) of the FFT.

Parameters

Name Type Description
hzLengthnumberint operator length in hz/samples

Returns

Float32Array

powerSmoothed - array containing the smoothed power spectrum

Inherited from

FFT.getFFTPowerSmoothed


getHalfLength

getHalfLength(): number

Returns half of the length of the calculated FFT (power-of-2)

Returns

number

halfLength The half-length of the FFT

Inherited from

FFT.getHalfLength


getImaginaryComponents

getImaginaryComponents(getReference): Float32Array

Gets the imaginary signal component

Parameters

Name Type Description
getReferencebooleanIf true then the reference to signal will be returned.

Returns

Float32Array

realComponent The real signal component

Inherited from

FFT.getImaginaryComponents


getLength

getLength(): number

Returns the length of the calculated FFT (power-of-2).

Returns

number

length The length of calculated FFT

Inherited from

FFT.getLength


getLog2Length

getLog2Length(): number

Returns the base 2 logarithm of the transform length

Returns

number

logLength Log base 2 of the transform length

Inherited from

FFT.getLog2Length


getNumberNonZeroSamples

getNumberNonZeroSamples(): number

Returns the number of non zero samples that were input inot the last FFT. This is the number of live samples (less than or equal to a power-of-2);

Returns

number

nonZero The Number of non-zero samples for input signal

Inherited from

FFT.getNumberNonZeroSamples


getNyquist

getNyquist(): number

Returns the nyquist frequency for the input signal. This is the calculated nyquist frequency based on the supplied sample rate. This is also known as the folding frequency

Returns

number

nyquist The nyquist frequency

Inherited from

FFT.getNyquist


getNyquistLength

getNyquistLength(): number

Returns the sample number of frequency that equals nyquist frequency.

Returns

number

frequency The Nyquist frequency

Inherited from

FFT.getNyquistLength


getRealComponents

getRealComponents(getReference): Float32Array

Gets the real signal component

Parameters

Name Type Description
getReferencebooleanIf true then the reference to signal will be returned.

Returns

Float32Array

realComponent The real signal component

Inherited from

FFT.getRealComponents


getSampleRate

getSampleRate(): number

Returns the input sample rate of the signal in Milliseconds. This is the sample rate set before calculation.

Returns

number

sampleRate Sample rate of input signal in milliseconds (ms)

Inherited from

FFT.getSampleRate


inverseTransform

inverseTransform(): void

Performs the inverse transform

Returns

void

Inherited from

FFT.inverseTransform


setData

setData(real?, imag?, sampleRate?, length?): RealFFT

Sets the real and imaginary result array

Parameters

Name Type Description
Optional realnumber[] | Float32ArrayThe real component of the signal
Optional imagnumber[] | Float32ArrayThe imaginary component of the signal
Optional sampleRatestring | numberThe data sampling rate in milliseconds
Optional lengthstring | numberThe desired length of the transform, must be a power of 2

Returns

RealFFT

Inherited from

FFT.setData


setDataUnsafe

setDataUnsafe(real, imag): RealFFT

Sets the real and imaginary arrays directly

Parameters

Name Type Description
realFloat32ArrayThe imaginary component of the signal
imagFloat32ArrayThe real component of the signal

Returns

RealFFT

Inherited from

FFT.setDataUnsafe


setSampleRate

setSampleRate(sampleRate): RealFFT

Sets the input sample rate of the signal in Milliseconds.

Parameters

Name Type Description
sampleRatenumberSample rate of input signal in milliseconds (ms)

Returns

RealFFT

this

Inherited from

FFT.setSampleRate


transform

transform(): RealFFT

Performs the transform

Returns

RealFFT

Overrides

FFT.transform


getClassName

Static getClassName(): string

Returns

string

Inherited from

FFT.getClassName