In file ffttools.h:

namespace diag class ffttest : public stdtest

Object for implementing a FFT test

Inheritance:


Public Methods

ffttest ()
Default constructor.
virtual ~ffttest ()
Destructor.
virtual diagtest* self () const
Diagnostics test object creation function.
virtual bool end (std::ostringstream& errmsg)
Cleanup method.

Protected Classes

class tmpresult
temporary storage for intermediates results
static const fftparam fftparamZero
static storage for a zero parameter object
explicit tmpresult (string Name, int Size = 0, bool Cmplx = false, const fftparam& param = fftparamZero)
Default constructor.
~tmpresult ()
Destructor.
tmpresult (const tmpresult& tmp)
Copy constructor.
tmpresult& operator= (const tmpresult& tmp)
Copy operator.
bool allocate (int Size = 0)
Allocate memory.
bool valid () const
Valid method.
mutable readwritelock lock
read/write lock to protect object
string name
channel name
bool cmplx
true if complex time series
int size
size of arrays, i.e. number of fft points
float* fft
fft result
float* x
temporary array
fftparam prm
fft parameter object

Protected Fields

static const double fftSpanFactor
frequency span stretch factor: 1.1
double fStart
start frequency
double fStop
stop frequency
double BW
bandwidth
double overlap
overlap
int window
window type
bool removeDC
remove DC part?
int AChannels
number of A channels
double measTime
measurement time
double settlingTime
settling time
int skipMeas
number of skipped measurement steps
double windowBW
resolution bandwidth (window dependent)
double fSpan
frequency span
int fftPoints
Number of points used in the FFT
int points
Number of points in result
double fMaxMeas
highest frequency of interest
double fMinSample
lowest sampling frequency
double fSample
sampling frequency after 1st decimation
double fZoom
zoom frequency
tainsec_t fZoomStart
zoom frequency start time
int decimate2
second decimation stage
int numA
total number of A channels (including stimuli)
double mStart
measurement start time
double exct0
t = 0 for excitation signals
double mTimeAdd
time to add to mTime to set it to the next time grid
fftparam fftPlan
fft plan
tmpresults tmps
temporary storage

Protected Methods

virtual bool readParam (std::ostringstream& errmsg)
Read parameter method.
virtual bool calcTimes (std::ostringstream& errmsg, tainsec_t& t0)
Calculate measurement time method.
virtual bool newMeasPoint (int i, int measPoint = 0)
Calculate measurement point method.
virtual bool calcMeasurements (std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
Add measurements method.
virtual bool stopMeasurements (int firstIndex = -1)
Stop measurements method.
virtual bool analyze (const callbackarg& id, int measnum, bool& notify)
Analysis method.
bool fft (int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
FFT method
bool cross (int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
Cross-correlation and coherence method

Inherited from stdtest:

Public Methods

virtual bool begin(std::ostringstream& errmsg)
virtual bool setup(std::ostringstream& errmsg, tainsec_t starttime, syncpointer& sync)

Protected Classes

class stimulus
typedef std::vector <AWG_Component> awglist
list of awg signals
typedef std::vector <float> pointlist
list of awg points
string name
channel name of excitation
bool isReadback
is read back?
string readback
channel name of readback
AWG_WaveType waveform
excitation waveform type
double freq
frequency
double ampl
amplitude
double offs
offset
double phas
phase
double ratio
square wave ratio
double frange
frequency range
double arange
amplitude range
pointlist points
list of points for arbitrary waveform
gdsChnInfo_t excInfo
channel info for exciation channel
gdsChnInfo_t readbackInfo
channel info for readback
awglist signals
excitation signal list
bool duplicate
true if readback channel is a duplicate
rtddChannel::partitionlist partitions
partition list
bool useActiveTime
use active time for preprocessing
stimulus()
Default constructor.
bool calcSignal(tainsec_t t0, tainsec_t duration)
Generates signal list.
bool calcSineSignal(tainsec_t t0, tainsec_t duration, tainsec_t ramp)
Generates sine signal.
enum stimulustype
stimNone
ignore stimulus channels
stimReadback
include stimulus channels which have a valid readback
stimAll
include all stimulus channels
class measurementchannel
string name
channel name of excitation
gdsChnInfo_t info
channel info for exciation channel
bool duplicate
true if channel is a duplicate
rtddChannel::partitionlist partitions
partition list
bool useActiveTime
use active time for preprocessing
measurementchannel()
Default constructor.
class interval
typedef std::pair <tainsec_t, tainsec_t> timeinterval
time interval
timeinterval ival
time interval
bool good
if false, this interval was not rejected by the analysis
interval(tainsec_t t, tainsec_t dt)
Constructor.
tainsec_t t0() const
Interval start.
tainsec_t dt() const
Interval duration.
struct callbackarg
typedef std::pair <tainsec_t, tainsec_t> timeinterval
time interval
timeinterval ival
time interval
int measPoint
measurement point
int measPeriod
measurement period

Protected Fields

friend class chnrec
typedef std::vector <stimulus> stimuluslist
typedef std::set <AWG_WaveType> waveformset
const static waveformset sinewaveOnly
const static waveformset periodicOnly
const static waveformset noiseOnly
const static waveformset allWaveforms
typedef std::vector <measurementchannel> measlist
typedef std::vector <interval> intervallist
typedef testsync <stdtest, callbackarg> stdtestsync
friend class testsync stdtest callbackarg
const diagTest* test
string testType
bool doAnalysis
tainsec_t T0
int averageType
int averages
int avrgsize
int avrgnum
double timeGrid
stimuluslist stimuli
measlist meas
intervallist intervals
std::deque <syncpointer> syncqueue
int dataerrors

Protected Methods

typedef bool (stdtest::*channelAnalysis)(int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
virtual bool readMeasParam(std::ostringstream& errmsg, int maxIndex = 100)
virtual bool readStimuliParam(std::ostringstream& errmsg, bool needReadback = false, waveformset allowedWaveforms = allWaveforms, int maxIndex = 100)
virtual bool subscribeChannels(std::ostringstream& errmsg)
void samplingFrequencies(double fMax, double& fSampleMin, double& fSampleMax)
virtual double calcTimeGrid(double fMax, tainsec_t* t0 = 0)
virtual bool addMeasPartitions(const interval& ival, int pIndex, double fSample, tainsec_t pt = 0, double fZoom = 0, double fZoomSample = 0, tainsec_t tZoom = 0)
virtual bool addSyncPoint(const interval& ival, int measPeriod, int measPoint = 0)
virtual bool delMeasurements(std::ostringstream& errmsg)
virtual bool addMeasurements(std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
virtual bool startMeasurements(std::ostringstream& errmsg)
bool prepareNextPoint(const callbackarg& id)
virtual bool getNextSyncPoint(const callbackarg& id, syncpointer& sync)
virtual bool syncAction(const callbackarg& id, syncpointer& sync, bool& notify)
virtual bool syncAbort(const callbackarg& id)
virtual bool syncPause(const callbackarg& id, syncpointer& sync)
virtual bool syncResume(const callbackarg& id, syncpointer& sync)
virtual bool callChannelAnalysis(const callbackarg& id, int measnum, channelAnalysis method, int firstres = 0, stimulustype inclStim = stimReadback, bool async = true, bool skipDuplicates = true)

Inherited from diagtest:

Public Methods

static double measurementTime(double duration, double cycles, double f, bool roundup = true)
static double adjustForSampling(double t, double dt)
static tainsec_t fineAdjustForSampling(tainsec_t t, double dt)
virtual string name() const
virtual bool init(diagStorage& Storage, const cmdnotify& Notify, rtddManager& RTDDMgr, excitationManager& EnvExc, excitationManager& TestExc, int KeepTraces, bool rtMode = true)
virtual void setStep(int Step, int resindex)
virtual int getResultNumber()
virtual bool readEnvironment()

Protected Fields

mutable recursivemutex mux
string myname
cmdnotify notify
diagStorage* storage
rtddManager* rtddMgr
excitationManager* testExc
bool RTmode
int step
int rindex
int rnumber
int keepTraces

Inherited from testenvironment:

Public Classes

class environment
int num
array index of Env[]
bool active
active flag
string channel
channel name
string waveform
string describing waveform
std::vector <float> points
points of arbitrary waveform
double wait
settling time
environment()
Default constructor
environment(const environment& env)
Copy constructor

Public Fields

typedef std::vector <environment> environmentlist

Public Methods

virtual void setEnvironmentExcitationManager( excitationManager* excmgr)
virtual bool subscribeEnvironment(std::ostringstream& errmsg)
virtual double waitEnvironment() const
virtual bool startEnvrionment(tainsec_t starttime = 0, tainsec_t timeout = -1)
virtual bool stopEnvrionment(tainsec_t timeout = -1)
virtual bool clearEnvrionment(tainsec_t timeout = -1)

Protected Fields

mutable recursivemutex envmux
excitationManager* envexc
environmentlist envlist

Documentation

FFT Test This object implements the Fourier tests.

ffttest()
Constructs a test object for measuring the fourier components.
Returns:
void

virtual ~ffttest()
Denstructs the fourier test object.
Returns:
void

virtual diagtest* self() const
Returns a new diagnostics test object describing a sine response measurement.
Returns:
new diagnotsics test object

virtual bool end(std::ostringstream& errmsg)
End of test. This function cleans up temporary storage.
Returns:
true if successful
Parameters:
errmsg - error message stream

static const double fftSpanFactor
frequency span stretch factor: 1.1

class tmpresult
temporary storage for intermediates results

static const fftparam fftparamZero
static storage for a zero parameter object

explicit tmpresult(string Name, int Size = 0, bool Cmplx = false, const fftparam& param = fftparamZero)
Constructs a temporaray object to store intermediate results.
Returns:
void
Parameters:
Name - channel name
Size - size of storage arrays
Cmplx - set true if time series was down-converted

~tmpresult()
Destructs the temporaray object.
Returns:
void

tmpresult(const tmpresult& tmp)
Constructs a temporaray object from an other one.
Returns:
void
Parameters:
tmp - temporary object

tmpresult& operator= (const tmpresult& tmp)
Copies a temporaray object from an other one. Moves the pointers rather than copy. It will set the pointers in the original object to zero.
Returns:
reference to object
Parameters:
tmp - temporary object

bool allocate(int Size = 0)
Allocates new storage. Deletes the old arrays first.
Returns:
true if successful
Parameters:
Size - size of storage arrays

bool valid() const
True if valid temporary object.
Returns:
true if valid

mutable readwritelock lock
read/write lock to protect object

string name
channel name

bool cmplx
true if complex time series

int size
size of arrays, i.e. number of fft points

float* fft
fft result

float* x
temporary array

fftparam prm
fft parameter object

double fStart
start frequency

double fStop
stop frequency

double BW
bandwidth

double overlap
overlap

int window
window type

bool removeDC
remove DC part?

int AChannels
number of A channels

double measTime
measurement time

double settlingTime
settling time

int skipMeas
number of skipped measurement steps

double windowBW
resolution bandwidth (window dependent)

double fSpan
frequency span

int fftPoints
Number of points used in the FFT

int points
Number of points in result

double fMaxMeas
highest frequency of interest

double fMinSample
lowest sampling frequency

double fSample
sampling frequency after 1st decimation

double fZoom
zoom frequency

tainsec_t fZoomStart
zoom frequency start time

int decimate2
second decimation stage

int numA
total number of A channels (including stimuli)

double mStart
measurement start time

double exct0
t = 0 for excitation signals

double mTimeAdd
time to add to mTime to set it to the next time grid

fftparam fftPlan
fft plan

tmpresults tmps
temporary storage

virtual bool readParam(std::ostringstream& errmsg)
Read parameters. This function reads the parameters from the storage object.
Returns:
true if successful
Parameters:
errmsg - error message stream

virtual bool calcTimes(std::ostringstream& errmsg, tainsec_t& t0)
Calcluate measurement time. This function clalculates start time and duration of each measuremenmt period.
Returns:
true if successful
Parameters:
errmsg - error message stream
t0 - start time

virtual bool newMeasPoint(int i, int measPoint = 0)
Calcluate a new measurement point. This function calculates a new measurement interval, synchronization point and measurement partitions.
Returns:
true if successful
Parameters:
t0 - start time (t = 0)
t1 - earliest time measurement can start
i - measurement point index
measPoint - measurement index

virtual bool calcMeasurements(std::ostringstream& errmsg, tainsec_t t0 = 0, int measPoint = 0)
Calculates measurement parameters. This function determines excitation signals, partitions for the rtdd and synchronization points.
Returns:
true if successful
Parameters:
errmsg - error message stream
t0 - start time
measPoint - measurement point number

virtual bool stopMeasurements(int firstIndex = -1)
Stops the measurements. This function deletes the temporary storage space, then calls its base class function.
Returns:
true if successful
Parameters:
firstIndex - first data index to delete

virtual bool analyze(const callbackarg& id, int measnum, bool& notify)
Analysis routine which performs the analysis. This function must be overwritten by descendents.
Returns:
true if successful
Parameters:
id - callback argument describing the sync event
measnum - measurement number
notify - if true upon return sends a notfication message

bool fft(int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
Calculates an FFT of the given channel.
Returns:
true if successful
Parameters:
resultnum - number of result record
measnum - measurement number
chnname - channel name (including array indices)
stim - true if stimulus readback channel
id - callback argument describing the sync event

bool cross(int resultnum, int measnum, string chnname, bool stim, const callbackarg& id)
Calculates cross-correlation and coherence for a given channel.
Returns:
true if successful
Parameters:
resultnum - number of result record
measnum - measurement number
chnname - channel name (including array indices)
stim - true if stimulus readback channel
id - callback argument describing the sync event


This class has no child classes.
Author:
Written June 1999 by Daniel Sigg
Version:
0.1
See Also:
Diagnostics test manual for used algorithms

alphabetic index hierarchy of classes


Please send questions and comments to sigg_d@ligo-wa.caltech.edu


generated by doc++