STScI logoSTSDAS Help Pages
fft1d ctio fft1d

NAME · USAGE · PARAMETERS · DESCRIPTION · BUGS

NAME

fft1d -- One dimensional Fast Fourier Transform

USAGE

fft1d input output

PARAMETERS

input
Input image or file list. Any file template or image template can be used. Images should be one dimensional.
output
Output image or file list. Any file template or image template can be used. If the output list is shorter than the input list, the task will abort with an error message after processing the last file or image in the input list.
type = "complex"
Transformation type. The possible types are real for a real transformation, and complex for a complex transformation.
format = "plain"
Output format. The possible formats are plain for the untouched output, modulus for the transformation modulus, and power for the square of the transformation (power spectrum).
inverse = no
Take inverse transformation ?
flip = no
Flip negative and positive parts of the transformation ? Normaly, the FFT algorithm leaves the negative part of the transformation at the right side of the positive part. With this parameter it's possible to flip both parts, leaving them in a natural order.
interval = INDEF
Interval between data points. This parameter specifies the spacing between data points in the input file. If this parameter has a defined value the task will output the transformed spacing along with the transformation values. This parameter is used only with text files.
valkey = "CRVAL1"
Starting value keyword. This is the name of the image header keyword used to get the physical coordinate value of the first pixel in the input image.
intkey = "CDELT1"
Interval keyword. This is the name of the image header keyword used to get the pixel coordinate spacing between pixels in the input image.
angular = no
Show angular frequencies ? If this parameter is set to yes , then the output frequencies are multiplied by two times PI. This parameter has effect only if the interval parameter has a defined value.

DESCRIPTION

For each image or file in the input list, the task takes the direct or inverse Fast Fourier Transform of it, and places the output in the corresponding file or image specified in the output list. Input files can be text files with one (real part) or two columns (real and imaginary parts), or one-dimensional images (real or complex).
This task is a front end to some of the FFT routines provided in the IRAF VOPS (Vector Operations). The input and output data types used by the routines depend on the value of the real and inverse parameters, acording to the following table:


      real  | inverse | input   | output  | routine
     -------+---------+---------+---------+---------
      no    |  no     | complex | complex | afftrx
      no    |  yes    | complex | complex | aiftrx
      yes   |  no     | real    | complex | afftxx
      yes   |  yes    | complex | real    | aiftxx

If complex data is supplied and a real transformation is specified, then the imaginary part is not used. Note that a real inverse transformation will give complex numbers with it's imaginary part set to zero instead of actual real numbers.
The number of lines in the output file is equal to the first power of two greater or equal to the number of lines in the input file. Also, the number of pixels in the output image is equal to the first power of two greater or equal to the number of lines in the input image. Therefore, there is no way to get exactly the original data when taking the inverse transformatiom of a transformation. This problem can be solved easily by just dropping the tail of the inverse transformation.
For text files the spacing between data points is specified with the interval parameter. If interval has a defined value, then the output file will have an extra column (the first one) with the frequency values. Otherwise only the transformation values will be written. Note that the first column will be written even when taking the inverse transformation, but the task won't work if it's present in the input (see the limitations below).
For images the spacing between input pixels is taken from the the input image header, using the keyword specified in the intkey parameter. The physical coordinate of the first pixel is also required, and must be specified in the valkey parameter. When taking a direct transformation the physical coordinate of the first pixel is always set to the new starting value, and it's original value is stored in the auxiliary header keyword FFT1DVAL . When the inverse transformation is applied the physical coordinate of the first pixel is set back to this value.
When the spacing is specified the frequencies in the output file or image make sense only up to the Nyquist frequency, unless the flip parameter is set to yes . This is because the FFT algorithm puts the negative part of the transformation before the positive part of it. If the output file or image has N points then the Nyquist frequency is located at (N / 2 + 1) if flip is set to no , and at N if flip is set to yes .
The default settings of the parameters are such that it is possible to take the inverse transformation of the output of the task, and get the original data, except for some rounding errors and the power of two limitation. This is NOT true under the following conditions:
(1)
For files or images if the type parameter is set to real .
(2)
For files or images if the format parameter is NOT set to plain .
(3)
For files or images if the flip parameter is set to yes .
(4)
For files if the interval parameter is defined, unless the first column of the transformation is removed.

BUGS

For some unknown reason this task does not work in pipes, although it is intended to work in them.


Source Code · Search Form · STSDAS

Maintained by the Science Software Group at STScI
This file last updated on 2 Sep 1991