Tuesday, July 6, 2010

LabVIEW: Windowing Program

Hello everyone,
Sorry for the delay. Last week and yesterday I spent most of my time fiddling around with LabVIEW. Currently I have a program that takes two inputs waveforms (reference and sample THz signals), plots them in time, allows for the selection of 1 region of interest for each, then apodizes those sections, and through the use of an FFT, finally plots their phases and magnitudes versus frequency.The front panel starts off with separate reference and sample time plots. Cursors 0 and 1 allow the user to select the ROIs. The effect of different apodization functions (aka smoothing and window functions) on the ref and sample sections can be observed in the graphs below. To the left of these graphs there is a ‘Windows’ drop down menu with an accompanying number slide bar. And below all of this are the phase and magnitude versus frequency plots of the apodized waveforms. There is a stop button on the front panel because, as will be shown in the block diagram, the functions being performed are in a while loop. This allows for the run to be continuous, thus allowing for uninterrupted observation of the changes the user makes in the front panel.
Much of the block diagram is reminiscent of my first program, which was explained in full detail in a previous blog post. The new VIs include:
  • Extract Portion of Signal - This extracts the ROI defined by the cursors, replots it on the original graph where it is highlighted, and feeds the waveform data into the windows 2 subVI.
  • Windows 2 – This subVI I customized (with Bianca’s guidance) to allow the user to select different apodization windows and input parameter values when needed. This was done by creating a case structure containing cases for every window function. The user can select which window function he or she would like to use through the drop down menu on the front panel. The menu item selected has a numerical value attached to it that informs the case structure which case to perform. The waveform is then reconstructed with the new apodized amplitude values. *I will explain what such functions do, the motivation for why they are applied, and discuss which ones are/aren’t advantageous for the particular THz data I’m working with. Expect this in the next blog entry.*
  • Align and Resample - This VI looks at both the apodized reference and sampled waveforms and makes the following changes: resamples both using the lower dt of the two, and makes the waveforms equal length by appending a zero amplitude tail at the end of the shorter waveform. *This is important when it comes to sampling in the frequency domain and parameter extraction, which will also be explained soon.*
  • FFT – The temporal waveforms undergo a Fast Fourier Transform with the use of this VI. The THz radiation signals can be plotted as phase vs frequency and magnitude vs frequency graphs.
  • While Loop- All of these VIs are contained in a while loop. The user can now note immediate changes to the graphs as he or she changes ROIs, window functions, or window parameters.

3 comments:

  1. Hi Johanna,

    Just curious as to what apodization functions are available for use with the time-domain waveforms, and whether they are all symmetrical. I found many years ago that there might be some benefit to having a step apodization on the left side of the window, a flat top, and then something else like a Gaussian or exponential on the right side of the function.

    Thanks,

    - John

    ReplyDelete
  2. Hey John,

    I can see how applying different apodization functions on different parts of the time domain waveform could prove useful.

    Windows I can choose from include:
    Blackman
    Blackman-Harris
    Blackman-Nuttall
    Bohman
    Cosine Tapered
    Dolph-Chebyshev
    Exact Blackman
    exponential
    flat top
    force
    Gaussian
    Hamming
    Hanning
    Kaiser-Bessel
    low sidelobe
    modified Bartlett-Hanning
    Parzen
    triangle
    Welch

    I will send you a more detailed email with observations, screenshots, and program files of the apodization VIs.

    I will run what you have mentioned by Bianca and see what she thinks. It would not be difficult to make my program apply different functions on different parts of the TD waveform.

    Thanks again for the input!

    Sincerely,
    Johanna

    ReplyDelete
  3. I think the cosine-tapered is similar to what John described. It has rising and falling exponentials at the beginning and end, with a flat top in the middle and smooth, rounded corners.

    ReplyDelete