class FSpectrum

Frequency spectrum class.

Public Methods

FSpectrum(void)
Default constructor.
FSpectrum(const FSpectrum& FS)
Copy constructor.
FSpectrum(const FSeries& FS)
Data constructor.
FSpectrum(double F0, double dF, const Time& t0, const Interval& dT, size_t nWord, float* data)
Data constructor.
~FSpectrum(void)
FSpectrum Destructor.
FSpectrum extract(double f0, double dF) const
Get a substring of the FSpectrum.
Time getStartTime(void) const
Get the start time.
Time getEndTime(void) const
Get the End time.
double getLowFreq(void) const
Get the minimum frequency.
double getHighFreq(void) const
Get the maximum Frequency.
double getFStep(void) const
Get the frequency step.
const char* getName(void) const
Get the spectrum name.
size_t getNStep(void) const
Get the number of frequency steps.
size_t getData(size_t len, float* data) const
Get the spectrum data.
double getSum(float f0, float dF) const
Get spectral sum.
size_t getCount(void) const
Get the number of spectra averaged.
const float* refData(void) const
Get a pointer to the spectrum data.
const DVector* refDVect(void) const
Get the data vector pointer
std::ostream& Dump(std::ostream& out) const
Dump the contents of the FSpectrum to an output stream.
void appName(const char* name)
Append a string to the spectrum name.
void clear(double F0=0, double dF=0, Time t0=0, Interval dT=0.0)
Clear thespectrum.
void setT0(const Time& t0)
Set the start time.
void setName(const char* name)
Set the spectrum name.
void setCount(size_t Count)
Set the spectrum count.
void setData(size_t len, const float* data)
Overwrite the spectrum with float data.
void setData(const FSeries& data)
Replace spectrum with an FSeries squared.
FSpectrum& operator =(const FSpectrum& rhs)
Copy a spectrum.
FSpectrum& operator +=(const FSpectrum& rhs)
Add two spectra.
FSpectrum& operator -=(const FSpectrum& rhs)
Subtract a spectrum.
FSpectrum& operator *=(double scale)
Scale a spectrum.
double operator)(double freq) const
Get the amplitude at a specified frequency
bool isEmpty(void) const
Test for empty.

Documentation

The frequency spectrum class is used to represent a power spectrum. Although the spectrum data iscontained in a DVector, only float type data are allowed.
FSpectrum(void)
Construct an empty FSpectrum.

FSpectrum(const FSpectrum& FS)
Construct an FSpectrum and initialize it from another spectrum.
Parameters:
Constant - spectrum from which the new spectrum is initialized.

FSpectrum(const FSeries& FS)
Construct a FSpectrum and initilize it from the modulus-squared of an FSeries.
Parameters:
Frequency - series from which the spectrum is initialized

FSpectrum(double F0, double dF, const Time& t0, const Interval& dT, size_t nWord, float* data)
Construct a FSpectrum and initialize it from data.
Parameters:
F0 - Minimum frequency.
dF - Frequency step.
t0 - Start time.
dT - Time interval.
nWord - Number of data words.
data - Spectral densities.

~FSpectrum(void)
Destroy a spectrum object.

FSpectrum extract(double f0, double dF) const
Returns an FSpectrum containing a subset of the parent spectrum. The subset is specified as a starting frequency and frequency interval. No rebinning is performed, so the actual frequency range wil be rounded to the nearest bin edges.
Returns:
the extracted spectrum.
Parameters:
f0 - lowest frequency to be extracted (in Hz).
dF - Frequency interval (in Hz).

Time getStartTime(void) const
Returns the start time as specified in the source data.
Returns:
The start time of data from which the spectrum was extracted.

Time getEndTime(void) const
Returns the End time as specified in the sourrce data.
Returns:
The end time of data from which the spectrum was extracted.

double getLowFreq(void) const
Returns the minimum frequency covered by the data.
Returns:
The minimum frequency covered by the spectrum.

double getHighFreq(void) const
Returns the maximum (Nyquist) frequency of the data.
Returns:
The maximum frequency covered by the spectrum.

double getFStep(void) const
Returns the frequency interval between two adjacen spectrum points.
Returns:
THe frequency step size in Hz.

const char* getName(void) const
Returns a pointer to the spectrum name.
Returns:
pointer to the Spectrum name.

size_t getNStep(void) const
Returns the number of frequency steps. Note that the number of data points is in fact one greater than the number of steps because both the f=0 and f=Nyquist entries are included.

size_t getData(size_t len, float* data) const
Optionally convert and copy the first 'len' entries of a spectrum to a float array 'data'. getData() returns the number of entries copied.

double getSum(float f0, float dF) const
Calculate the sum of the bins in the specified frequency interval.
Returns:
the sum of all spectrum points in the frequency interval.
Parameters:
f0 - lowest frequency bin to be summed.
dF - frequency interval width.

size_t getCount(void) const
Returns the number of spectra that have been summed.
Returns:
The number of averaged spectra.

const float* refData(void) const
Returns a pointer to the data. refData returns NULL if no DVector has been defined.

const DVector* refDVect(void) const
Get the data vector pointer

std::ostream& Dump(std::ostream& out) const
A formatted dump of the FSpectrum header and data are written to the output stream.

void appName(const char* name)
the specified string "name" is appended to the existing spectrum name.

void clear(double F0=0, double dF=0, Time t0=0, Interval dT=0.0)
Delete the data array and optionall reset the frequency and time parameters
Parameters:
F0 - New lower frequency
dF - New frequency step
t0 - New start time
dT - New time interval

void setT0(const Time& t0)
The spectrum start time is set to 't0'.

void setName(const char* name)
The spectrum name is set to the 'name' string.

void setCount(size_t Count)
The spectrum average count is set to Count.

void setData(size_t len, const float* data)
The float data in 'data' are optionally converted to the data vector type and then used to overwrite the spectrum data.

void setData(const FSeries& data)
The square of the frequency spectrum in 'data' is stored in the FSpectrum.

FSpectrum& operator =(const FSpectrum& rhs)
The rhs spectrum is copied the lhs spectrum.

FSpectrum& operator +=(const FSpectrum& rhs)
The rhs spectrum is added to the lhs spectrum on a element by element basis.

FSpectrum& operator -=(const FSpectrum& rhs)
The rhs spectrum is subtracted from the lhs spectrum on a element by element basis.

FSpectrum& operator *=(double scale)
The lhs spectrum is scaled by the rhs float.

double operator)(double freq) const
Get the amplitude at a specified frequency. The complex amplitude at the closest bin is returned.

bool isEmpty(void) const
Test whether the spectrum is empty.
Returns:
true if empty.


This class has no child classes.
Author:
J. Zweizig
Version:
1.0; Modified October 25, 1999

alphabetic index hierarchy of classes


generated by doc++