Wavelet Filtering Example

In this example, we use existing data rather than creating sample data. The example file is damped sine wave data with severe high-frequency noise.

  1. Use the input variable to define the data to use:
  2. input = FILEPATH('damp_sn.dat', $
       SUBDIRECTORY=['examples', 'data'])

  3. Create another variable to contain the output from the READ_BINARY function. READ_BINARY reads the contents of a file based on keywords or a predefined template. The DATA_DIMS keyword sets a scalar or array specifying the size of the data to be read and returned. (The array value of damp_sn.dat is provided in the index.txt file in examples/data.)
  4. output = READ_BINARY(input, DATA_DIMS=[512,1])

  5. Plot the data:
    realdataplot.gif
  6. IPLOT, output

  7. Use the wavelet transform to reduce the noise in the plot:
  8. smooth=WV_DENOISE(output, $
       'Coiflet', 3, PERCENT=50)

  9. Plot the smoothed data:
  10. IPLOT, smooth, YRANGE=[0,255]

    Note that we specify the Y range to ensure that it is the same as in the previous plot.
    realdatasmoothplot.gif