Triana Help Index


Triana's Spectral Storage Model


Index


Triana and Frequency Data

Many of Triana's data types implement the Spectral interface, which requires a number of methods for storing and retrieving spectral data. The Spectral interface makes no assumptions about how the underlying data sets are stored. It provides continuity of operation of units that deal with spectral data even if they employ different storage models. The spectral data types provide special functions that return spectral data and their associated frequencies in monotonically increasing frequency order, so that the spectra can be displayed by a unit that does not have to know the details of the internal storage model. These functions are used by Triana's graphing units Grapher and Multigraph.

However, the details of how spectral data are stored are important to users implementing data types and dealing directly with the data. The Triana storage model is close to other common formats for spectral data storage, and it allows for efficient use of memory. The model is described in detail here and in the Triana JavaDoc help files for the types ComplexSpectrum and Spectrum.


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.

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.


Storage Details

The details of the storage of spectral data depend on the number nFull of points in the full-bandwidth spectrum associated with a spectral data set, and on whether the data are one-sided and/or narrow-band. The different cases are detailed here. In the discussions we use f to denote frequency, fN to denote the Nyquist frequency (the highest absolute value of the frequency that the spectrum could contain), df to denote the frequency resolution (difference of frequency between adjacent points in the spectrum), and flow and fhigh to denote the lowest and highest absolute values of the frequency that are actually contained in the stored data set. The discussion below covers four possible cases: Full-spectrum, one-sided/full-bandwidth, two-sided/narrow-band, and one-sided/narrow-band data.
 

 

Implementation of the Triana Spectral Storage Model

In Triana the storage model is implemented in the data types that implement the Spectral interface. Full details of the implementation are in the Triana JavaDoc help files. But a few remarks are appropriate here, because these data types provide some standard methods that the user can make use of to inspect the data and decide how the data are stored. These are described here for users who want to program new units to handle spectral data.

Spectral data types inherit from GraphType, and so they have some standard methods that can be used to access the data.

In addition, some of the methods required by the Spectral interface can be used to get the data that is required to decide what kind of spectral data are stored in a data type. These include the following. Moreover, the data types ComplexSpectrum, Spectrum, and TimeFrequency implement additional methods that can be useful: Finally, some of these functions have counterparts in Triana units, which allow users to inspect data types at runtime. These include the units called FrequencyResolution, HighFreq, Length, LowFreq, SampleRate, TestNarrow, and TestTwoSided. These accept a data set as input and produce the appropriate value as an output, which can then be used as input to other units to set parameters, or which can be displayed.