FFT class

This class provides forward and inverse in-place Radix 2 Fourier transforms for discrete data stored in a 1D array. Input data may be ordered in several ways. In addition, the class provides a combi-transform that transforms a series of arrays, optionally applying an apozidation (window) function and baseline adjustment. The transform algorithm itself is based on MIT-licensed js code of Nayuki Minase, see http://nayuki.eigenstate.org/page/free-small-fft-in-multiple-languages.

Constructors

FFT()

Properties

hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

computeInverseFft(Float64List real, Float64List imag) → void
Computes the inverse discrete Fourier transform (IDFT) of the given complex vector, storing the result back into the vector. The vector can have any length. This is a wrapper function. This transform does not perform scaling, so the inverse is not a true inverse. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited

Static Properties

bcsize → String
final
bcstart → String
final
complex → String
final
dobc → String
final
doem → String
final
doft → String
final
dogm → String
final
ema → String
final
FT_SWAP_MODE_FULL → int
Define the origin (reference point) of the transform
final
FT_SWAP_MODE_HALF → int
Define the origin (reference point) of the transform
final
FT_SWAP_MODE_NO → int
Define the origin (reference point) of the transform
final
ftzerofill → String
final
gmr → String
final
gms → String
final
groupDelay → String
final
swapMode → String
final

Static Methods

combiTransform(Float64List fidValues, Map<String, Object> args, int nrows, int userFTSize, RowDoneCallback rcb) → List<List<Float64List>>
Processes fidValues by treating it as a 2D array with nrows (=1 for 1D). Each row is assumed to be complex: (re, im, re, im, ..) Returns null for 1D, while fidValues contain the processing result. Otherwise returns a list with 2 entries: The reals and the imaginaries (which can be an empty array if processing does not generate imaginaries). Processing means: bcoffset - em - gm - ft for each row of fidValues, in this sequence, depending on argsdobc, ..doem, ..dogm, ..doft. Processing is performed for each of the rows. The function rcb, if not null, will be called with the row number after processing a row. If userFTSize is not null, the transform size of each row is adjusted respectively: (zero-filling if bigger, cut-off if smaller) NOTE: bc/em/gm are do not consider userFTSize. If a row is not a power of two, it is zero-filled to the next power of 2.
phascor(Float64List real, Float64List imag, double phc0, double phc1) → void
In-place phase correction (rotation in the complex plane) of the complex array with real part real and imaginary part imag according to realcori = reali*cos(ai) - imagi*sin(ai) imagcori = imagi*cos(ai) + realisin(ai) ai = phc0 + iphc1 The phase angles phc0, phc1 are to be specified in degrees.
reverseBits(int x, int bits) → int
Bit reversal
transform(Float64List real, Float64List imag) → void
Computes the discrete FFT of a complex array in place. real = the real values of the array imag = the imaginary values of the array. Throws if real and imag have different lengths, and if the length is not a power of 2. The result is again complex, and is contained in the original array. The resulting array values are scaled relatively (non absolute values).
transformRadix2(Float64List real, Float64List imag) → void
Computes the discrete FFT of a complex array in place. real = the real values of the array imag = the imaginary values of the array. Throws if real and imag have different lengths, and if the length is not a power of 2. The result is again complex, and is contained in the original array. The resulting array values are scaled relatively (non absolute values). Uses the Cooley-Tukey decimation-in-time radix-2 algorithm.
transformShuffled(Float64List complArray, String groupDelay, int swapMode) → List<Float64List>
Computes the discrete FFT of a complex array in place. complArray = the complex values of the array. The array is order in the form real value 0, imag value 0, real value 1, imag value 1,... Throws if the length is not a power of 2. Returns the result: The result is again complex. The real part is the array stored under index 0 of the returned List, the imaginary part corresponds to index 1. The resulting array values are scaled relatively (non absolute values). groupDelay = a double in String format. In some measurement time data, the actual data do not start at 0, but groupDelay later, in terms of complex points. For such types of data the FFT would produce a "phase shifted" result (see function phascor below). This phase shift is accounted for if groupDelay is chosen not be zero but according to the measurement. swapMode = one of FT_SWAP_MODE_NO, FT_SWAP_MODE_FULL, FT_SWAP_MODE_HALF. These modes are needed depending on how the data to be transformed were sampled on a measurement device, e.g. a spectrometer. FT_SWAP_MODE_NO: no special effect FT_SWAP_MODE_FULL: 1) every other complex points is negated before th transform. 2) The order of the real data points is reversed after transform. The same is done for the imaginary data points. FT_SWAP_MODE_HALF: The order of the first half of the real data points, and of the seconds half of the real data points is reversed after transform. The same is applied to the imaginary data points.