## org.das2.qds.util.FFTUtil

Utilities for FFT operations, such as getting the frequencies for each bin and fftPower.

## FFTUtil( )

## fft

fft( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds, QDataSet weights ) → QDataSet

Perform the fft to get real and imaginary components for intervals.

### Parameters

fft - FFT code to use, such as GeneralFFT.newDoubleFFT(len)
vds - QDataSet rank 1 dataset with depend 0 units TimeLocationUnits.
weights - QDataSet rank 1 dataset containing weights, as in hanning. null indicates no weights.

### Returns:

the rank 2 FFT
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## fft

fft( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds ) → org.das2.qds.math.fft.ComplexArray.Double

helper method for doing FFT of a QDataSet. This forward FFT returns normalized data. GeneralFFT.newDoubleFFT(ds.length());

### Parameters

fft - the FFT engine
vds - rank 1 ds[n] or rank 2 ds[n,2]

### Returns:

an org.das2.qds.math.fft.ComplexArray.Double

### See Also:

Ops#fft(QDataSet)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## fftPower

fftPower( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds ) → QDataSet

### Parameters

fft - a GeneralFFT
vds - a QDataSet

### Returns:

org.das2.qds.QDataSet
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## fftPower

fftPower( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds, QDataSet weights ) → QDataSet

Produces the power spectrum of the dataset. This is the length of the Fourier components squared, normalized by the bandwidth. The result dataset has dimensionless yunits. It's assumed that all the data is valid. Note when the input is in mV/m, the result will be in (V/m)^2/Hz.

### Parameters

fft - FFT engine
vds - rank 1 dataset with depend 0 units TimeLocationUnits.
weights - rank 1 datasets that is the window to apply to the data.

### Returns:

the rank 2 FFT
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## fftPower

fftPower( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds, QDataSet weights, QDataSet powxTags ) → QDataSet

Produces the power spectrum of the dataset. This is the length of the Fourier components squared, normalized by the bandwidth. The result dataset has dimensionless yunits. It's assumed that all the data is valid. Note when the input is in mV/m, the result will be in (V/m)^2/Hz.

### Parameters

fft - FFT engine
vds - rank 1 dataset with depend 0 units TimeLocationUnits.
weights - rank 1 datasets that is the window to apply to the data.
powxTags - if non-null, then use these xtags instead of calculating them for each record.

### Returns:

the rank 2 FFT
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getFrequencyDomainTags

getFrequencyDomainTags( double fs, int size ) → double[]

### Parameters

fs - the sampling frequency
size - the size of the time domain data.

### Returns:

the frequencies of the bins
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getFrequencyDomainTags

getFrequencyDomainTags( QDataSet timeDomainTags ) → QDataSet

return the frequency tags for the given time offset tags, so `f[i]= i / n*T` where `T= time[1] - time[0]` and `n= len(time)`. for the first n/2 points and `f[i]= (n21-n+i) / ( n*T )` for the second half. When units have a known inverse, this is returned.

### Parameters

timeDomainTags - a QDataSet

### Returns:

the frequency domain tags.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getFrequencyDomainTagsForPower

getFrequencyDomainTagsForPower( QDataSet dep0 ) → QDataSet

get the frequency tags, for use when calculating the power in each channel. This removes the DC channel, and folds over the negative frequencies. This also keeps a cache for performance.

### Parameters

dep0 - the timetags.

### Returns:

the frequency tags.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getTimeDomainTags

getTimeDomainTags( QDataSet frequencyDomainTags ) → QDataSet

return the time domain tags for inverse fft.

### Parameters

frequencyDomainTags - a QDataSet

### Returns:

the time Domain Tags
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getWindow10PercentEdgeCosine

getWindow10PercentEdgeCosine( int size ) → QDataSet

Window with ones in the middle, and then the last 10% taper with cos.

### Parameters

size - the window size

### Returns:

window
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getWindowHanning

getWindowHanning( int size ) → QDataSet

return a "Hanning" (Hann) window of the given size.

### Parameters

size - an int

### Returns:

a QDataSet
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getWindowUnity

getWindowUnity( int size ) → QDataSet

Window that is all ones, also called a boxcar.

### Parameters

size - the window size

### Returns:

window
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## ifft

ifft( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds, QDataSet weights ) → QDataSet

Perform the inverse fft to get real and imaginary components for intervals.

### Parameters

fft - FFT code to use, such as GeneralFFT.newDoubleFFT(len)
vds - QDataSet rank 2 dataset with depend 0 units TimeLocationUnits and depend_1=['real','imaginary'].
weights - QDataSet rank 1 dataset containing weights, as in hanning. null indicates no weights.

### Returns:

the rank 2 FFT
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## ifft

ifft( org.das2.qds.math.fft.GeneralFFT fft, QDataSet vds ) → org.das2.qds.math.fft.ComplexArray.Double

helper method for doing inverse FFT of a QDataSet.

### Parameters

fft - the FFT engine
vds - rank 2 dataset[n;real,complex]

### Returns:

rank 2 dataset[n;real,complex]

### See Also:

Ops#ifft(QDataSet)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## uniformCadence

uniformCadence( QDataSet x ) → boolean

return true if the rank 1 timetags are uniform.

### Parameters

x - rank 1 monotonically increasing timetags.

### Returns:

true if the rank 1 timetags are uniform.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## window

window( QDataSet ds, int size ) → QDataSet

returns a rank 2 dataset from the rank 1 dataset, where the FFT would be run on each of the datasets.

### Parameters

ds - rank 1 dataset of length N
size - size of each FFT.

### Returns:

rank 2 dataset[N/size,size]
[search for examples] [view on GitHub] [view on old javadoc] [view source]