Triana Help Index,
Time-Domain Filtering
in Triana
Frequency-Domain Filtering in Triana
Index
Triana
Units for Frequency-Domain Filtering
There are a number of units in Triana that
perform filtering operations in the frequency domain. In this help file
we list the units and then suggest ways to use them to solve important
filtering problems.
The main frequency-domain filtering units and associated units are:
-
FFT -- forward and backward Fourier transforms on
1D and 2D data sets of any size
-
WindowFnc -- apply a window to the incoming
data
-
OneSide -- change a spectrum to one-sided
-
FullSpectrum -- change a spectrum to full-bandwidth,
including negative frequencies
-
LowPass -- remove data at frequencies higher
than the given one.
-
BandPass -- remove data at frequencies outside
the given band.
-
HighPass -- remove data at frequencies below
the given one.
-
MultiBand -- create several narrow-band data
sets covering adjacent bandwidths
-
PositiveF -- return a spectrum with only the
positive-frequency data non-zero
-
NegativeF -- return a spectrum with only the
negative-frequency data non-zero
-
HetdyneF -- return the cosine and sine quadratures
of the input data set heterodyned and filtered to a narrow band
-
Shift -- cyclic shift of data set
-
SpecSeq -- assemble successive input spectral
data sets into a TimeFrequency data set
-
WinFT -- windowed Fourier transform
In addition there are units that are useful for display: Grapher,
MultiGraph,
ImageMapper,
and ImageView.
For a description of Triana's time-domain filtering units, see the separate
help file on Time-Domain
Filtering in Triana.
Understanding Frequency-Domain Data Storage
in
Triana
Triana stores spectral data in data types
like Spectrum,
ComplexSpectrum,
TimeFrequency,
and Spectrum2D.
Spectrum and ComplexSpectrum are essentially identical except that the
data in Spectrum are real and in ComplexSpectrum complex. TimeFrequency
is a two-dimensional data set, one dimension of which is spectral and the
other time, so that it normally represents a sequence of spectra taken
at different times. Spectrum2D is a genuine two-dimensional spectrum, such
as might be obtained by performing an FFT on an image or other matrix.
Both TimeFrequency and Spectrum2D can hold either real or complex data.
Since FFTs generally produce complex output, the type Spectrum is normally
used only for the output of units the produce power spectra or related
objects.
One-dimensional spectral data (including the spectral dimension
of TimeFrequency) can generally be stored in several different ways.
-
Full-bandwidth data storage means that the spectrum contains
data values for both positive and negative frequencies.
-
One-sided data storage means that only positive frequencies
are held in the data object; if negative frequencies are required they
are reconstructed from the positive frequencies, on the assumption that
the spectrum represents the Fourier transform of a real data set.
-
Narrow-band data storage means that the stored data represents
only a portion of the full spectrum; if a full-bandwidth spectrum is required
then it is reconstructed by putting zeros into the data values associated
with frequencies outside the stored bandwidth.
Narrow-band data sets can be either one-sided or two-sided. Similarly one-sided
data sets can be either wide-band or narrow-band. Narrow-band data sets
keep a memory of how large the spectrum was from which they were filtered.
This amounts effectively to remembering the highest frequency contained
in that original spectrum, which is called the Nyquist
frequency of the data set. This term is used in the filtering units,
some of which offer the user the ability to reduce the Nyquist frequency.
This means that the "memory" about the original spectrum will be altered
so that, when the set is restored to a full-spectrum set, the highest frequency
will be smaller. If the spectrum is FFT'd back to the time domain, then
the sampling rate in the time domain will be correspondingly smaller, since
this sampling rate is exactly twice the Nyquist frequency. Thus, lowering
the Nyquist frequency will result in down-sampling of the time-domain
data set associated with the spectrum.
Triana employs these various storage models
in order to save memory usage. In many applications, such as when spectra
are divided into separate bandwidths, using full-bandwidth data would mean
replicating many useless storage locations. However, because Triana
data sets are self-describing, most Triana
units that deal with spectra are written in such a way that they will automatically
do the right thing with data, regardless of its storage format. Users need
to be aware of the different storage models, however, when they display
them, combine them, or make use of their special properties. There is more
detail on this subject in the help file for the
Triana
Spectral Model, which also defines the model completely.
For two-dimensional spectral data, narrow-banding in each dimension
makes sense, but one-sidedness has limited value, since data can be reflected
through two different zero-frequency lines. Therefore Triana
generally uses only full-bandwidth 2D data sets.
Using Frequency-Domain Filtering Tools
Most of the tools offer the user options in their parameter windows. Naturally,
filtering units must be told the frequencies they are to select. In addition,
three choices appear in many of the units: "Output narrow
band", "Choose window ...", "Reduce
Nyquist frequency ...". They are explained here.
-
"Output narrow band?" If the user selects this
checkbox, then the output will be a narrow-band data set containing only
the frequencies that pass through the filter (both positive and negative).
If the box is not selected, then the output will be a full-bandwidth spectrum
with zeros in the storage locations that have been filtered away. This
box should be selected if:
-
the the user wants to conserve storage,
-
the data are to be displayed and the user wants full resolution in the
band passed by the filter,
-
the data are to be windowed later (see discussion in next paragraph), or
-
the data are to be subjected to further arithmetic (and the extra zeros
would require time-consuming wasted arithmetic).
Leave the box un-selected if:
-
the data are to be recombined with other parts of the spectrum by adding
spectral data sets together,
-
the user wants to display the data in a way that shows the isolated band
surrounded by zero-amplitude regions, or
-
speed rather than memory conservation is an issue, since in many operations
(such as an inverse FFT) the narrow-band data set will be automatically
converted back into a full-width spectrum.
-
"Choose window ..." Sharp edges in data sets
produce oscillations in their Fourier transforms. If these are unwanted,
then the edges can be rounded first by applying a window function. Window
functions are smooth functions that have a value close to 1 over most of
their domain, falling symmetrically to very small values at either end.
Triana units use the window functions provided by the unit WindowFnc.
They are multiplied into the data set to round off edges. Triana applies
them (if the user chooses to use a window) in such a way that all sharp
edges are rounded by the window function.
-
If a window is applied to a time-domain data set, such as SampleSet,
then the values at the beginning and end of the data set are reduced. When
the set is subsequently FFT'd, the high-frequency components of the FFT
will be reduced. The zero-frequency element of the FFT may also be lower,
since the average value of the data will probably have been reduced.
-
If a window is applied to a frequency-domain data set, then what
happens depends on the nature of the set.
-
If the data set is full-bandwidth (even if it contains a narrow-band data
set padded out with zeros) it will be smoothed at the highest positive
and negative frequencies.
-
If the data set is one-sided but not narrow-band, it will be smoothed at
its highest frequency.
-
If the data set is narrow-band but includes zero-frequency, then it will
be smoothed at its highest positive and negative frequencies.
-
If the data set is narrow-band and does not include zero-frequency, then
both the positive- and negative-frequency parts of the spectrum will be
smoothed at both edges of their bands.
If the window has been applied to the spectrum and the spectrum is subsequently
inverted, then oscillations in the time-domain function will be reduced.
-
"Reduce Nyquist frequency ..." Select this
checkbox to reduce the Nyquist frequency associated
with the data (which will result in down-sampling
of the time-series if the spectrum is inverted). The Nyquist frequency
will be reduced to whatever frequency has been chosen in the filtering
unit as the highest frequency passed through the filter. Selecting this
option overrides any choice the user has made of wide- or narrow-band output.
If the output data set contains zero-frequency (say, a low-pass filter),
then it will be output as a full-bandwidth spectrum, because its upper
frequency limit equals its (new) Nyquist frequency. If it does not contain
zero-frequency, it will be output as a narrow-band spectrum.
Examples
Here are some examples of how to use the frequency-domain filtering tools.
Each one refers to a group unit in the Demos toolbox of SignalProc.
-
LineCut: removing a line from noisy data. If a signal contains an
unwanted sinusiodal component, the FFT of the signal can be filtered around
the frequency, and then subtracted from the original FFT. The filtered
data set is output as a full-spectrum data set so that it can be subtracted
from the original spectrum. In this example, the cut is windowed using
the Gaussian window.
-