In file FSpectrum/FSpectrum.hh:

class FSpectrum

Frequency spectrum class.

Inheritance:


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_type nWord, data_type* data)
Data constructor.
~FSpectrum (void)
FSpectrum Destructor.
FSpectrum& copy (const FSpectrum& fs)
Copy an FSpectrum.
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_type getNStep (void) const
Get the number of frequency steps.
size_type getData (size_type len, data_type* data) const
Get the spectrum data.
double getSum (float f0, float dF) const
Get spectral sum.
size_type getCount (void) const
Get the number of spectra averaged.
const data_type* 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=Time(0), Interval dT=0.0)
Clear the spectrum.
void setT0 (const Time& t0)
Set the start time.
void setName (const char* name)
Set the spectrum name.
void setCount (size_type Count)
Set the spectrum count.
void setData (size_type len, const data_type* 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.
size_type getBin (double f) const
Calculate the closest bin to a given frequency
double getBinF (size_type bin) const
Calculate the frequency of a given bin
DVector* refDVect ()
Get the data vector pointer

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_type nWord, data_type* 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& copy(const FSpectrum& fs)
Copy the specified spectrum argument here. A full data copy is performed.
Parameters:
FSpectrum - to be copied.

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_type 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_type getData(size_type len, data_type* 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_type getCount(void) const
Returns the number of spectra that have been summed.
Returns:
The number of averaged spectra.

const data_type* 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=Time(0), Interval dT=0.0)
Delete the data and optionally reset the frequency and time parameters. The data array remains allocated. The count field is reset to zero.
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_type Count)
The spectrum average count is set to Count.

void setData(size_type len, const data_type* 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.

size_type getBin(double f) const
Calculate the closest bin to a given frequency

double getBinF(size_type bin) const
Calculate the frequency of a given bin

DVector* refDVect()
Get the data vector pointer


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

alphabetic index hierarchy of classes


Please send questions and comments to zweizig_j@ligo.caltech.edu


generated by doc++