down

Section 8 Exercise: Fourier and Wavelet Transforms

NOTE: If you don't have a copy of the Chapter 8 lecture notes, print it, and put in your binder. There are widget programming examples in the notes that will prove useful to you in this exercise and later on.

The exercise has four main purposes:

  1. To show how Fourier Transforms work, and how they may be used to solve, for example, wave propagation problems.

  2. To demonstrate the concepts of power spectra and auto-correlation functions.

  3. To show how Wavelet Transforms work, and how they can be used to obtain information about wave modes in non periodic data sets and for compressing information with a "minimum" of loss and maximum compression.

  4. To demonstrate how to use IDL X-widgets to build a graphical user interface to an IDL experiment.

Here are your 7 bonus points   Credits: 7/7

Subsections
  approx time  
CVS
1 min
FT Aliasing and Orthogonality
15 min
FT Wave experimentarium
30 min
FT Power Spectra
15 min
Wavelets experimentarium
45 min
Wavelets Autocorreletion
45 min
Wavelet and FT data comparison
20 min
Home Work
2 hours


down top CVS

[about 1 minute]

To extract the exercise files for this weeks exercise, do

    cd ~/ComputerPhysics
    cvs update -d

In case of problems, see the CVS update help page.


down top FT Aliasing and Orthogonality

[15 minutes]


down top FT Wave experimentarium

[about 30 minutes]


down top FT Power spectra and auto correlation

[about 15 minutes]


down top Wavelet experimentarium

[45 minutes]


down top Wavelet Autocorrelation

[20 minutes]

In a previous sections we used the autocorrelation function to find the period of the solar rotation for different latitudes. One may do a similar calculation for wavelets, but calculating the AC function is not as straight forward as for FFT. Here we have to go back to the definition of the AC function:

where f is the function and T is the time interval over which the function is to be analysed. Integrating this with different values of tau, large values are only obtained when tau represents time differences equivalent to repetitions in the signal of f. From this we define the wavelet autocorrelation function:

where W in general is the complex wavelet transform of a function. Here we are only interested in the real part of the wavelet autocorrelation function. In the wavelet transform a represents the different "time" scales over which the wavelet kernel is applied (see fig 13.10.7 in NR). Numerically data are represented by discrete values along the "time"-axis, and here the integrals transform into a sum.

To test it out lets start looking at a single sine function:

IDL> x=findgen(1024)/1024.                        ; define x [0,1[
IDL> fx=sin(x*!pi*2.)                             ; single sinewave
IDL> plot,x,fx                                    ; plot sinewave
IDL> w = wtn(fx,4)                                ; make wavelet, Deubechies, 4th order
IDL> cw = w                                       ; array for containing AC function
IDL> for i=1,9 do begin for j=0,2^i-1 do $        ; calculate AC function
IDL>      cw(2^(i-1)+j) = total(w(2^(i-1):2^i-1)*shift(w(2^(i-1):2^i-1),j))
IDL> cwcw=fltarr(512,10)                          ; array for expanding the information
IDL>                                              ; spread for easy plotting
IDL> for i=1,9 do cwcw(*,i) = rebin(cw(2^(i-1):2^i-1),512) 
IDL> tvscl,rebin(cwcw,512,100)                    ; rebin in y direction for more pixels
Now redo the calculation with different wavelenghts and different orders of wavelenghts (limited choices available!). Notice how information about the different wavelenghts are located in different horizontal bands in the tv plot image.

Can you use other values for the size of the second index of the cwcw then 10? (for this specific data set!) Credits: 1/-1
OK

Try a few more combinations to get more familiar with the information in the AC plot:

To test it on a real data set let's return to the sunspot data used earlier in the exercise. Let's only look at a single latitude as a beginning:
IDL> w = wtn(signal(*,0),4)                                               ; Wavelet transform
IDL> cw = w                                                               ; array for containing AC function
IDL> for i=1,? do begin for j=0,2^i-1 do $                                ; calculating the  AC function
IDL>     cw(2^(i-1)+j) = total(w(2^(i-1):2^i-1)*shift(w(2^(i-1):2^i-1),j))
IDL> cwcw = ???                                                           ; array to contain the variable for plotting
IDL> for i=1,? do begin cwcw(*,i) = rebin(cw(2^(i-1):2^i-1),512)          ; stretching the information
IDL> tvscl,rebin(cwcw,512,100)                                            ; showing the AC in a position-wavelength plot

What do these AC plots tell us about the sunspots? Credits: 1/-1
OK


down top Wavelet and FT data comparison

[20 minutes]

Finally it is time to make a direct comparison between the FT and Wavelet approaches. For this we use the chirp dataset and compare how much it is possible to filter away from each of the approaches while still maintaining a good representation of the restored data.


down top Home Work

[about 2 hours]

Spend one of the reading hours of this week reading the chapter about Fourier Transforms and wavelet Transforms in Numerical Recipes. If you have a possibility to play with IDL at home, or by spending some odd hours at the Institute, then use the opportunity to play with the X-widget interface; modifying the play.pro example, or using examples from the IDL manuals, or inventing examples of your own.


$Id: index.php,v 1.17 2010/05/17 07:08:26 aake Exp $