![]() |
GWOLLUM 4.2.0
Tools for gravitational-wave analyses
|
Transform discrete time series. More...
#include <Sample.h>
Public Member Functions | |
double | GetHighPassFrequency (void) |
Returns the current highpass frequency. | |
unsigned int | GetNativeFrequency (void) |
Returns the current native sampling frequency [Hz]. | |
bool | GetStatus (void) |
Returns the class status. | |
unsigned int | GetWindowSize (void) |
Returns the window size (=0 if no windowing). | |
unsigned int | GetWorkingFrequency (void) |
Returns the current working sampling frequency [Hz]. | |
void | SetDCRemoval (const bool aDCremove=true) |
Activates/Deactivates the DC removal. | |
bool | SetFrequencies (const unsigned int aNativeFrequency, const unsigned 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. | |
void | SetWindow (const unsigned int aWindowSize, double *aWindow) |
Defines the window. | |
bool | SetWorkingFrequency (const unsigned int aWorkingFrequency) |
Sets a new working sampling frequency. | |
bool | Transform (const unsigned int aInSize, double *aInData, const unsigned int aOutSize, double *aOutData) |
Transforms data. | |
Constructors and destructors | |
Sample (const unsigned int aVerbosity=0) | |
Constructor of the Sample class. | |
virtual | ~Sample (void) |
Destructor of the Sample class. | |
Protected Attributes | |
double | fHighPassFrequency |
Cutoff frequency. | |
unsigned int | fNativeFrequency |
Native sampling frequency. | |
bool | fRemoveDC |
DC removal flag. | |
double * | fWindow |
Window. | |
unsigned int | fWindowSize |
Window size. | |
unsigned int | fWorkingFrequency |
Working sampling frequency. | |
Monitor * | mon |
Class monitor. | |
Private Member Functions | |
void | HighPass (const unsigned int aSize, double *aData) |
Highpasses the data. | |
void | MakeHighPassFilters (void) |
Constructs the highpass filters. | |
void | MakeSamplingFilters (void) |
Constructs the re-sampling filters. | |
void | PreSample (unsigned int &aSize, double *aData) |
Pre-samples the data. | |
void | RemoveDC (const unsigned int aSize, double *aData) |
Removes the DC component. | |
void | Resample (unsigned int aSize, double *aInData, double *aOutData) |
Re-samples the data. | |
Private Attributes | |
unsigned int | fIntermediateFrequency |
Intermediate sampling frequency. | |
unsigned int | fResampleFactor |
Resampling factor (>=1). | |
IIRFilter * | iirFilter [NORDER] |
Downsampling filters. | |
IIRFilter * | iirFilterHP [NORDERHP] |
Highpass filters. | |
bool | presample |
Pre-sample flag. | |
Transform discrete time series.
A timeseries, sampled at a native frequency is transformed in the time domain. Supported transformations (in this order):
Once the transformations are configured, call Transform() to transform your timeseries.
Sample::Sample | ( | const unsigned int | aVerbosity = 0 | ) |
Constructor of the Sample class.
[in] | aVerbosity | Verbosity level. |
|
virtual |
Destructor of the Sample class.
|
inline |
Returns the current highpass frequency.
|
inline |
Returns the current native sampling frequency [Hz].
|
inline |
Returns the class status.
|
inline |
Returns the window size (=0 if no windowing).
|
inline |
Returns the current working sampling frequency [Hz].
|
private |
Highpasses the data.
The data vector, sampled at the native frequency, is highpassed.
[in] | aSize | Data vector size. |
[in,out] | aData | Pointer to the data vector. |
|
private |
Constructs the highpass filters.
Using Highpass frequency and Native frequency.
|
private |
Constructs the re-sampling filters.
Using Native frequency and Working frequency.
|
private |
Pre-samples the data.
The input data vector is resampled to the power-of-two just below.
[in,out] | aSize | Data vector size. |
[in,out] | aData | Pointer to the data vector. |
|
private |
Removes the DC component.
[in] | aSize | Data vector size. |
[in,out] | aData | Pointer to the data vector. |
|
private |
Re-samples the data.
The input data vector, sampled at the native frequency, is resampled to the working frequency.
[in] | aSize | Input data vector size. |
[in] | aInData | Pointer to the input data vector. |
[out] | aOutData | Pointer to the output data vector. |
|
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.
[in] | aDCremove | Activate/deactivate the DC removal. |
bool Sample::SetFrequencies | ( | const unsigned int | aNativeFrequency, |
const unsigned 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.
It is also possible to highpass the data before downsampling.
[in] | aNativeFrequency | Native sampling frequency [Hz]. |
[in] | aWorkingFrequency | Working sampling frequency [Hz]. |
[in] | aHighPassFrequency | Highpass frequency [Hz]. |
|
inline |
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.
[in] | aHighPassFrequency | Highpass frequency [Hz]. |
|
inline |
Sets a new native sampling frequency.
[in] | aNativeFrequency | New native sampling frequency [Hz]. |
|
inline |
Defines the window.
[in] | aWindowSize | Window size: it must match the size of input data when calling Transform(). |
[in] | aWindow | Array of window values. |
|
inline |
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.
[in] | aWorkingFrequency | New working sampling frequency [Hz]. |
bool Sample::Transform | ( | const unsigned int | aInSize, |
double * | aInData, | ||
const unsigned int | aOutSize, | ||
double * | aOutData | ||
) |
Transforms data.
The input data vector (time-domain) is transformed in this order:
The input and output vectors must have an integer duration.
[in] | aInSize | Input vector size. |
[in] | aInData | Input vector. |
[in] | aOutSize | Output vector size. |
[in] | aOutData | Output vector. |
|
protected |
Cutoff frequency.
|
private |
Intermediate sampling frequency.
|
protected |
Native sampling frequency.
|
protected |
DC removal flag.
|
private |
Resampling factor (>=1).
|
protected |
Window.
|
protected |
Window size.
|
protected |
Working sampling frequency.
|
protected |
Class monitor.
|
private |
Pre-sample flag.