GWOLLUM
4.2.0
Tools for gravitational-wave analyses
|
Load frame files and access data in frames. More...
#include <ffl.h>
Public Member Functions | |
string | Convert2Ffl (void) |
Converts the frame file list to a FFL format. More... | |
void | DefineTmpDir (const string aTmpDirPath=".") |
Defines a temporary working directory. More... | |
bool | ExtractChannels (const unsigned int aGps) |
Extracts channels at a given GPS time. More... | |
vector< string > | GetChannelList (const string aFilter="") |
Returns the current channel list. More... | |
unsigned int | GetChannelSampling (const string aChannelName) |
Returns the sampling rate of a given channel [Hz]. More... | |
unsigned int | GetChannelSampling (const string aChannelName, unsigned int &aChannelIndex) |
Returns the sampling rate of a given channel [Hz]. More... | |
double * | GetData (unsigned int &aSize, const string aChannelName, const double aGpsStart, const double aGpsEnd, const double aMissing=999.0) |
Returns a data vector for a given channel and a GPS range. More... | |
string | GetInputFfl (void) |
Returns the path to the input frame file list. More... | |
Segments * | GetSegments (void) |
Returns a pointer to the segments covered by the ffl. More... | |
bool | IsChannel (const string aChannelName) |
Tests whether a channel exists in the dataset pointed by the ffl. More... | |
bool | LoadFrameFile (const unsigned int aGps=0) |
Loads (or re-loads) the frame file list. More... | |
TGraph * | PlotData (const string aChannelName, const double aGpsStart, const double aGpsEnd) |
Plots a data vector time series. More... | |
bool | PrintChannels (const unsigned int aGps=0) |
Prints the list of channels at a given GPS time. More... | |
bool | PrintData (const string aChannelName, const double aGpsStart, const double aGpsEnd, string aFileName) |
Prints a data vector in a text file. More... | |
void | Reset (void) |
Resets ffl object. More... | |
void | SetPlotName (const string aName) |
Sets a new name for the plotting structure. More... | |
void | SetTrials (const unsigned int aNTrials, const unsigned int aNSleepSeconds) |
Sets the number of trials to load the frame file. More... | |
Constructors and destructors | |
ffl (const string aFrameFileList, const string aPlotStyle="GWOLLUM", const int aVerbosity=0) | |
Constructor of the ffl class. More... | |
virtual | ~ffl (void) |
Destructor of the ffl class. More... | |
Private Attributes | |
vector< string > | channels |
List of channels. More... | |
vector< string > | ffile |
List of files. More... | |
string | fFormat |
Format frame file. More... | |
string | fInFrameFile |
Path to input frame file list. More... | |
FrFile * | frfile |
Fr file. More... | |
unsigned int | fVerbosity |
Verbosity level. More... | |
string | fWoFrameFile |
Path to working frame file (always FFL). More... | |
TGraph * | G |
Graph. More... | |
GwollumPlot * | GP |
Plotting structure. More... | |
unsigned int | nsleepsec |
Number of seconds between trials. More... | |
unsigned int | ntrials |
Number of trials when accessing the data. More... | |
vector< unsigned int > | sampling |
List of sampling frequencies. More... | |
Segments * | seg |
Segments covered by the ffl file. More... | |
string | srandint |
Random integer string. More... | |
bool | status_OK |
Class status. More... | |
Load frame files and access data in frames.
This class is designed to load frame files and provide methods to access the data. The native format for file registration is the so-called FFL format. A FFL file is a text file where each line identifies a frame file. Each line must contained exactly 5 columns:
This class is implemented using the Frame Library functions.
ffl::ffl | ( | const string | aFrameFileList, |
const string | aPlotStyle = "GWOLLUM" , |
||
const int | aVerbosity = 0 |
||
) |
Constructor of the ffl class.
The frame file list is provided. Two format are supported: the native Frame File List (FFL) and the lalcache format (LCF). If a LCF file is provided, this file is first converted to a FFL in the current directory (LoadFrameFile()).
aFrameFileList | path to frame file list |
aPlotStyle | plotting style |
aVerbosity | verbosity level |
|
virtual |
Destructor of the ffl class.
string ffl::Convert2Ffl | ( | void | ) |
Converts the frame file list to a FFL format.
If the format is different from the native FFL format, the frame file list is converted into a working FFL file in the tmp directory (set with DefineTmpDir()).
void ffl::DefineTmpDir | ( | const string | aTmpDirPath = "." | ) |
Defines a temporary working directory.
When working with another file format than the native FFL, a conversion to FFL is required. The converted file is saved in a working directory defined with this function. The directory must exist before calling this function, or else the current directory is used.
[in] | aTmpDirPath | Path to the working directory. |
bool ffl::ExtractChannels | ( | const unsigned int | aGps | ) |
Extracts channels at a given GPS time.
Only ADC, PROC, SIM and SER channels are extracted. Only channels with a sampling rate above or equal to 1Hz are extracted.
[in] | aGps | GPS time where to scan the channel list. |
vector< string > ffl::GetChannelList | ( | const string | aFilter = "" | ) |
Returns the current channel list.
It is possible to return a subset of channels using a filter. This filter is a string containing wildcards, e.g. "V1:DQ_*_FLAG_* V1:ENV_*".
[in] | aFilter | Channel name filter. Use "" for no filter. |
|
inline |
Returns the sampling rate of a given channel [Hz].
[in] | aChannelName | Channel name. |
unsigned int ffl::GetChannelSampling | ( | const string | aChannelName, |
unsigned int & | aChannelIndex | ||
) |
Returns the sampling rate of a given channel [Hz].
[in] | aChannelName | Channel name. |
[out] | aChannelIndex | Channel index. |
double * ffl::GetData | ( | unsigned int & | aSize, |
const string | aChannelName, | ||
const double | aGpsStart, | ||
const double | aGpsEnd, | ||
const double | aMissing = 999.0 |
||
) |
Returns a data vector for a given channel and a GPS range.
A pointer to the data vector is returned. The size of the vector is returned. If the data cannot be read, a pointer to NULL is returned and the data size is set to 0.
If there are missing data in the requested time stretch, no data vector is returned by default (aMissing=999.0
). For any other value for aMissing
, the data vector is returned and the missing sample are given the value aMissing
.
[out] | aSize | Number of samples in the returned vector. |
[in] | aChannelName | Channel name. |
[in] | aGpsStart | Starting GPS time. |
[in] | aGpsEnd | Ending GPS time. |
[in] | aMissing | Special value to flag missing samples. If =999.0, no flagging, the function returns NULL. |
|
inline |
Returns the path to the input frame file list.
|
inline |
Returns a pointer to the segments covered by the ffl.
bool ffl::IsChannel | ( | const string | aChannelName | ) |
Tests whether a channel exists in the dataset pointed by the ffl.
[in] | aChannelName | Channel name to test. |
bool ffl::LoadFrameFile | ( | const unsigned int | aGps = 0 | ) |
Loads (or re-loads) the frame file list.
If the format is different from the native FFL format, the frame file list is first converted into a working FFL file in the tmp directory defined with DefineTmpDir(). This function loads the working ffl file. It is possible to configure several trials to load the FFL file (see SetTrials()). The channel information is extracted at a given GPS time using ExtractChannels().
This function can also be used if the frame file list needs to be reloaded (for example if it has changed on disk).
[in] | aGps | GPS time where to scan the channel list. Use 0 to scan the first frame file in the list. |
TGraph * ffl::PlotData | ( | const string | aChannelName, |
const double | aGpsStart, | ||
const double | aGpsEnd | ||
) |
Plots a data vector time series.
This function, when run interactively, plots the time series of a given channel between two GPS times.
[in] | aChannelName | Channel name. |
[in] | aGpsStart | Starting GPS time. |
[in] | aGpsEnd | Ending GPS time. |
|
inline |
Prints the list of channels at a given GPS time.
Two columns are printed: the channel name and the sampling frequency [Hz].
[in] | aGps | GPS time. |
bool ffl::PrintData | ( | const string | aChannelName, |
const double | aGpsStart, | ||
const double | aGpsEnd, | ||
string | aFileName | ||
) |
Prints a data vector in a text file.
This function prints the time series of a given channel between two GPS times in an text file.
[in] | aChannelName | Channel name. |
[in] | aGpsStart | Starting GPS time. |
[in] | aGpsEnd | Ending GPS time. |
aFileName | Output text file name. |
void ffl::Reset | ( | void | ) |
Resets ffl object.
void ffl::SetPlotName | ( | const string | aName | ) |
Sets a new name for the plotting structure.
[in] | aName | Plot name. |
|
inline |
Sets the number of trials to load the frame file.
When calling the LoadFrameFile() function, several attemps are made to access the frame file list. This is useful for online applications when the FFL file is updated.
[in] | aNTrials | Number of trials. |
[in] | aNSleepSeconds | Number of seconds between trials. |
|
private |
List of channels.
|
private |
List of files.
|
private |
Format frame file.
|
private |
Path to input frame file list.
|
private |
Fr file.
|
private |
Verbosity level.
|
private |
Path to working frame file (always FFL).
|
private |
Graph.
|
private |
Plotting structure.
|
private |
Number of seconds between trials.
|
private |
Number of trials when accessing the data.
|
private |
List of sampling frequencies.
|
private |
Random integer string.
|
private |
Class status.