Transform a discrete time series. More...
#include <Sample.h>
Public Member Functions | |
double | GetHighPassFrequency (void) |
Returns the current highpass frequency. | |
int | GetNativeFrequency (void) |
Returns the current native sampling frequency. | |
double | GetTukeyFraction (void) |
Returns the current Tukey fraction. | |
int | GetWorkingFrequency (void) |
Returns the current working sampling frequency. | |
void | SetDCRemoval (const bool aDCremove=true) |
Activates/Deactivates the DC removal. | |
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 | SetWindows (const double aTukeyFraction) |
Defines windowing properties. | |
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 | |
bool | fRemoveDC |
remove DC | |
double | fTukeyFraction |
window fraction | |
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.
double Sample::GetHighPassFrequency | ( | void | ) | [inline] |
Returns the current highpass frequency.
int Sample::GetNativeFrequency | ( | void | ) | [inline] |
Returns the current native sampling frequency.
double Sample::GetTukeyFraction | ( | void | ) | [inline] |
Returns the current Tukey fraction.
int Sample::GetWorkingFrequency | ( | void | ) | [inline] |
Returns the current working sampling frequency.
void Sample::SetDCRemoval | ( | const bool | aDCremove = true |
) | [inline] |
Activates/Deactivates the DC removal.
The DC component is computed and is subtracted from all data samples. The final vector has a DC component equal to 0.
aDCremove | activate/deactivate the DC removal |
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::SetWindows | ( | const double | aTukeyFraction | ) |
Defines windowing properties.
It is possible to window the input data. A Tukey window is defined by a 'Tukey fraction'. To make it clear, let's take the example of a 10% Tukey fraction. This means that the first 5% of the input data vector will be smoothly transition from 0 to 1. Similarly, the last 5% of the input data vector will be smoothly transition from 1 to 0.
aTukeyFraction | tukey fraction between 0 and 1 |
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
bool Sample::fRemoveDC [protected] |
remove DC
double Sample::fTukeyFraction [protected] |
window fraction
int Sample::fVerbosity [protected] |
verbosity level
int Sample::fWorkingFrequency [protected] |
working sampling frequency