Re: Newbie question about visad.math.fft

Hi Peter,

> Actually, I'm a newbie to both visad *and* Fast Fourier Transforms, so
> sorry if I'm a little ignorant of the two.  my first question is, can
> the FFT object be used outside of the spreadsheet application?  I
> thought it could, but am less sure after reading the docs.

One problem you faced is that the JavaDoc for visad.math.FFT
was terrible. They are much better in a new release that I
just made to the VisAD ftp server. These improvements should
appear in the on-line JavaDoc within a day or two (or you can
see them right away by downloading the source).

The forwardFT() and backwardFT() methods are intended
to only be used by the SpreadSheet and conform to the
way the SpreadSheet link() function invokes methods.
Other applications should use other methods of FFT.

> if so, I am trying to get a FFT of a sequence of 0's and 1's where each
> digit corresponds to the h(t) value where t = time.  Once calculated,
> I'm simply trying to find the freuquency with the greatest intensity,
> so there's no need for me to show it graphically.
> however, it looks like the fft methods I want to use, i.e. FFT1D,
> require a matrix submission.  am i correct in this?  and if so, how
> does one convert a 1-dimensional sequence into the matrix.  I haven't
> seen any documentation describing how\whether this is necessary

The 2-D array 'x' argument to FFT1D is dimensioned


where the first index (2) is for real and imaginary parts.
If your data are purely real values, then just supply an
array of 0's for the imaginary parts. Pyt unless your real
data are symmetric about the origin, the return Fourier
transform will include non-zero imaginary values.

Note that if you invoke the FT1D() method in place of the
FFT1D method, then the number_of_samples dimension of your
data do not have to be a power of 2. If it is a power of
2 then it will use the FFT, otherwise it will use an plain
old slow FT.

> I've also looked at the forwardFT, backwardFT, and fourierTransform
> functions, but am still trying to decipher VisAD's data model and
> figure out what a Field and a FlatField are.  I'll gladly continue to
> try to figure these out, but can someone point me in the right
> direction, i.e. should I be trying to use the fourierTransform method
> or the FFT1D method?

You can learn the VisAD data model from Ugo's and Tom's
tutorials. And the new improved JavaDoc for FFT should help
you decide which method to use. FT1D() is probably a good
choice if you just want take FT's of arrays and don't need
to use VisAD displays.

> currently, this is my code:
>               // generate sequence to transform  sConv....
>               double[][] time;
> . . .
>               time = new double[1][size];
> . . .
>                   trans = fft.FFT1D (time, true);
> . . .
> when this code is executed, a VisADException is thrown with the err
> message, bad x lengths...

This Exception means that time needs to be dimensioned [2][size].
When you send us Exceptions, it is good to send the stack dump
and tell use which line of your code is in the stack dump.

Good luck,

  • 2004 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: