Transform a discrete time series. More...
#include <Sample.h>
Public Member Functions | |
int | GetHighPassFrequency (void) |
Returns the current highpass frequency. | |
int | GetNativeFrequency (void) |
Returns the current native sampling frequency. | |
int | GetWorkingFrequency (void) |
Returns the current working sampling frequency. | |
bool | SetFrequencies (const int aNativeFrequency, const int aWorkingFrequency, const double aHighPassFrequency=0.0) |
Defines frequencies for the transformation. | |
bool | SetHighPassFrequency (const double aHighPassFrequency) |
Defines a highpass frequency. | |
bool | SetNativeFrequency (const int aNativeFrequency) |
Sets a new native sampling frequency. | |
bool | SetWorkingFrequency (const int aWorkingFrequency) |
Sets a new working sampling frequency. | |
bool | Transform (const int invectorsize, double *invector, const int outvectorsize, double *outvector) |
Transforms data. | |
Constructors and destructors | |
Sample (const int aVerbosity=0) | |
Constructor of the Sample class. | |
virtual | ~Sample (void) |
Destructor of the Sample class. | |
Protected Attributes | |
double | fHighPassFrequency |
cutoff frequency | |
int | fNativeFrequency |
native sampling frequency | |
int | fVerbosity |
verbosity level | |
int | fWorkingFrequency |
working sampling frequency |
Transform a discrete time series.
It includes:
Sample::Sample | ( | const int | aVerbosity = 0 |
) |
Constructor of the Sample class.
aVerbosity | verbosity level |
Sample::~Sample | ( | void | ) | [virtual] |
Destructor of the Sample class.
int Sample::GetHighPassFrequency | ( | void | ) | [inline] |
Returns the current highpass frequency.
int Sample::GetNativeFrequency | ( | void | ) | [inline] |
Returns the current native sampling frequency.
int Sample::GetWorkingFrequency | ( | void | ) | [inline] |
Returns the current working sampling frequency.
bool Sample::SetFrequencies | ( | const int | aNativeFrequency, | |
const int | aWorkingFrequency, | |||
const double | aHighPassFrequency = 0.0 | |||
) |
Defines frequencies for the transformation.
It is possible to work with a sampling frequency smaller than the native frequency, often for performance reasons. It must be an integer value and a power of 2. When transformed (see Transform()), the input data are first downsampled to the working frequency with an anti-aliasing filter.
In a second step, it is possible to highpass the data. When transformed (see Transform()), the input data are highpass-filtered.
aNativeFrequency | native sampling frequency [Hz] | |
aWorkingFrequency | working sampling frequency [Hz] | |
aHighPassFrequency | highpass frequency [Hz] |
bool Sample::SetHighPassFrequency | ( | const double | aHighPassFrequency | ) |
Defines a highpass frequency.
It is possible to highpass the data. This function sets a new highpass frequency. When transformed (see Transform()), the input data are filtered.
This function can only be called if SetFrequencies() has been previously called and if the new highpass frequency is compatible with previous frequency settings.
aHighPassFrequency | highpass frequency [Hz] |
bool Sample::SetNativeFrequency | ( | const int | aNativeFrequency | ) |
Sets a new native sampling frequency.
This function can only be called if SetFrequencies() has been previously called and if the new working sampling frequency is compatible with previous frequency settings.
aNativeFrequency | new native sampling frequency [Hz] |
bool Sample::SetWorkingFrequency | ( | const int | aWorkingFrequency | ) |
Sets a new working sampling frequency.
It is possible to work with a sampling frequency smaller than the native frequency, often for performance reasons. This function sets a new working frequency. It must be an integer value and a power of 2. When transformed (see Transform()), the input data are first downsampled to the working frequency with an anti-aliasing filter.
This function can only be called if SetFrequencies() has been previously called and if the new working sampling frequency is compatible with previous frequency settings.
aWorkingFrequency | new working sampling frequency [Hz] |
bool Sample::Transform | ( | const int | invectorsize, | |
double * | invector, | |||
const int | outvectorsize, | |||
double * | outvector | |||
) |
Transforms data.
The input data vector (time-domain) is transformed as previously defined: see SetFrequencies(). The input vector must have an integer duration. The memory for the output vector must be allocated with the right size before calling this function. No size check will be performed and the data size provided by the user will be trusted.
IMPORTANT: the input vector can be altered in case of presampling. Do not use after calling this function.
invectorsize | input vector size (in samples) | |
invector | input data vector (time-domain) | |
outvectorsize | output vector size (in samples) | |
outvector | output data vector (time-domain) |
double Sample::fHighPassFrequency [protected] |
cutoff frequency
int Sample::fNativeFrequency [protected] |
native sampling frequency
int Sample::fVerbosity [protected] |
verbosity level
int Sample::fWorkingFrequency [protected] |
working sampling frequency