SpectralPeak and SpectralPeakArray

A SpectralPeak is a very basic storage PD class that has the following attributes: scale, frequency, magnitude, phase, bin position, and bin width. It has also some operators such as product, distance and log/linear scale converting routines. By itself it is seldom used and should be preferably used through the SpectralPeakArray class.

The SpectralPeakArray is not, as its name may imply, just a simple array of SpectralPeaks. As a matter of fact, the SpectralPeakArray class does not hold SpectralPeak inside but rather a set of buffers containing magnitude, frequency, phase, bin position, bin width and index. This representation has been chosen for efficiency reasons in order to be able to operate on contiguous memory.

Apart from these buffers, it includes other attributes such as Scale, nPeaks (number of peaks currently available) and nMaxPeaks (maximum number of peaks allowed).

Even though the most efficient way to deal with a peak array is working directly on the buffers , two accessory interfaces are offered: first, you can access/modify any of the attributes of a given peak by using the interface offered by methods like GetMag(index) or SetPhase(index); but also, you can use an interface using SpectralPeak objects through the GetSpectralPeak(index) and SetSpectralPeak(index) methods. Note that these methods do not return a pre-existing peak but rather construct the peak object on the fly. Therefore, they are far from efficient.

Another particularity that needs mention is the IndexArray. It is a multi-purpose array of indices that is used for fundamental detection, peak continuation and track assigning. It is sometimes indeed a very convenient way of dealing with many insertions/deletions of peaks into the array as they can be substituted by a simple change in index. The SpectralPeakArray class offers an accessory interface (consisting of several methods) for working through indices.

2004-10-18