IBM InfoSphere Streams Version 4.1.0

Operator FFT

Primitive operator image not displayed. Problem loading file: ../../image/tk$com.ibm.streams.timeseries/op$com.ibm.streams.timeseries.analysis$FFT.svg

The FFT operator applies a Fast Fourier transform (FFT) algorithm on a vector time series. You can use the operator to implement time series signal decomposition. For example, you can decompose a time series signal into its constituent frequencies.

A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse.

The FFT operator is a multivariate operator that expects the time series as a list or a scalar. If a time series is scalar the windowing option must be used. The incoming time series is read as a sequence of list<float64> values or as a sequence of float64 values. The list must have at least eight time series values, otherwise an exception occurs.

The operator can produce three types of output:

  • The FFT as a list<complex64>
  • The magnitude spectrum as a list<float64>
  • The power spectrum as a list<float64>

Behavior in a consistent region

  • The FFT operator can be an operator within the reachability graph of a consistent region.
  • The operator cannot be the start of a consistent region. An error occurs when you compile your streams processing application.

Exceptions

The FFT operator throws an exception and terminates in the following cases:

  • The resolution parameter has the value 0.
  • The input time series list has less than eight elements.
  • The resolution parameter value is less than the input time series list size.
  • The operator is windowed (that is, the input is a single value of type float64) and the resolution parameter value is less than the window size.
Examples
These examples demonstrate how to use the FFT operator.

Summary

Ports
This operator has 1 input port and 1 output port.
Windowing
This operator optionally accepts a windowing configuration.
Parameters
This operator supports 5 parameters.

Required: algorithm, inputTimeSeries

Optional: resolution, flushOnFinal, useHamming

Metrics
This operator reports 1 metrics.

Properties

Implementation
C++
Threading
Always - Operator always provides a single threaded execution context.

Input Ports

Ports (0)

This port consumes the input time series to be transformed. The inputTimeSeries parameter specifies the name of the attribute on this port that contains the time series data. The accepted data types are float64 and list<float64>.

Properties

Output Ports

Assignments
This operator allows any SPL expression of the correct type to be assigned to output attributes.
Output Functions
FFTCOF
list<complex64> FFTAsComplex()

Returns the calculated FFT values.

list<float64> magnitude()

Returns the values of the magnitude spectrum.

list<float64> power()

Returns the values of the power spectrum.

<any T> T AsIs(T v)

The default function for output attributes. By default, this function assigns the output attribute to the value of the input attribute with the same name.

Ports (0)

This port submits a tuple that contains the transformed time series. This port submits a tuple each time a time series is transformed by the FFT operator. Custom output functions are used to specify the value of the output tuple attributes. The output tuple attributes whose assignments are not specified are assigned from input attributes.

Properties

Parameters

This operator supports 5 parameters.
resolution

Specifies the resolution value for the fast Fourier transform algorithm. If window configurations are provided, the resolution parameter value cannot be less than the window size. If the input time series is a list, the resolution parameter value must be more than the size of the input time series list. If this parameter is not specified, the operator dynamically determines the resolution value based on the list size of the data being processed.

Properties

flushOnFinal

Specifies whether the pending tuples in the window are flushed when a final punctuation is received. If set to true, then the window is flushed and the window is processed. If set to false, then the window is dropped and no processing occurs. The default value is false. If windowing is not enabled, this parameter is ignored.

Properties

useHamming

Specifies whether to use the Hamming window function before applying the fast Fourier transform algorithm. The default value is false.

Properties

algorithm
Specifies the type of spectral transform to perform. The supported algorithms are:
  • complexFFT: Uses the complex Fast Fourier Transform algorithm. The complex FFT requires the list of values to be a power 2. If the input list size if not a power of 2, then the input list will be padded with zeros to fit the size of the closest power of 2 upward.
  • realFFT: Uses the real Ffast Fourier Transform algorithm. This value has conditions similar to the complexFFT value.
  • realDFT: Uses the real Discrete Fourier Transform (DFT) algorithm. Note: Due to the nature of this algorithm, it may take several minutes to process large signals. The realFFT algorithm should be used when processing large signals.
  • inverseComplexFFT: Computes the inverse complex Fast Fourier Transform algorithm. This value has conditions similar to the complexFFT value.
  • inverseRealFFT: Performs an inverse real Fast Fourier Transform algorithm. This value has conditions similar to the realFFT value.
  • realCepstrum: Applies cepstrum on the input time series.
  • DCT: Applies discrete cosine transform on the input time series.
  • IDCT: Applies inverse discrete cosine transform on the input time series.
Properties

inputTimeSeries

Specifies the name of the attribute that contains the time series data in the input tuple. The supported data types are float64 and list<float64>.

Properties

Code Templates

FFT
stream<${schema}> ${outputStream} = FFT(${inputStream}) 
{
	param
		inputTimeSeries:		${timeSeriesExpression};
		algorithm:	${algorithmLiteral};

	output
		${outputStream}: ${outputExpression};
}
      

Metrics

numWindowsDropped - Counter

The number of times windows are dropped because they have less than eight time series values.

Libraries

No description for library.
Library Name: tsatapi
Library Path: ../../../impl/lib
Include Path: ../../../impl/include