Discrete Fourier Transform


This treatment performs a Discrete Fourier Transform (DFT) on all the given variables of a 3-D finite time-marching result.

The Fourier transform of a continuous-time signal \(x(t)\) may be defined as:

\(X(f) = \int_{-\infty}^{+\infty} x(t) e^{-j2 \pi ft}dt\)

The Discrete Fourier Transform implemented replaces the infinite integral with a finite sum:

\(X(k) = \frac{1}{N}\sum_{n=0}^{N-1} x(n) e^{-j2 \pi \frac{nk}{N}}dt\)

where \(x(n)\) is the \(N\) sampling terms of an analogic signal \(x(t) = x(n\Delta t)\) and the \(N\) terms \(X(k)\) are an approximation of the Fourier transform of this signal at the mode frequency defined as \(f_k = k\Delta f/N = k/T\).

  • the sampling frequency: \(\Delta f = \frac{1}{\Delta t}\)

  • the sampling interval: \(T = N \Delta t\)

  • the mode \(k = f_k \times T\)


import antares
myt = antares.Treatment('dft')


  • base: Base

    The base on which the Fourier modes will be computed. It can contain several zones and several instants. DFT is performed on all variables except coordinates.

  • type: str, default= ‘mod/phi’

    The DFT type of the output data: ‘mod/phi’ for modulus/phase decomposition or ‘im/re’ for imaginery/real part decomposition. The phase is expressed in degrees.

  • coordinates: list(str), default= antares.Base.coordinate_names

    The variable names that define the set of coordinates. The coordinates will not be computed by the DFT treatment.

  • mode: lists(int), default= None

    Give one mode or a list of mode ([1, 2, 4] for example). If empty, this returns all the mode including the mean part.


All the zones must have the same instant.


If dtype_in = ‘mod/phi’, the phase is expressed in degrees.


import antares
myt = antares.Treatment('dft')
myt['base'] = base
myt['type'] = 'mod/phi'
myt['mode'] = [4, 18, 36]
dft_modes = myt.execute()


A mode is defined as \(k=f_k \times T\), with \(T\) the sampling interval.

Main functions

class antares.treatment.TreatmentDft.TreatmentDft

Execute the treatment.


a base that contains many zones. Each zone contains one instant. Each instant contains two arrays (the FFT parts depending on the type of decomposition).

Return type



This example illustrates the Discrete Fourier Transform
treatment of Antares.
import os
if not os.path.isdir('OUTPUT'):

from antares import Reader, Treatment, Writer

# ------------------
# Reading the files
# ------------------
reader = Reader('bin_tp')
reader['filename'] = os.path.join('..', 'data', 'ROTOR37', 'GENERIC', 'flow_<zone>_<instant>.dat')
base = reader.read()

# ----
# ----
treatment = Treatment('dft')
treatment['base'] = base
treatment['type'] = 'mod/phi'
treatment['mode'] = list(range(0, 2))
result = treatment.execute()

# -------------------
# Writing the result
# -------------------
writer = Writer('bin_tp')
writer['filename'] = os.path.join('OUTPUT', 'ex_dft_<instant>.plt')
writer['base'] = result