GWOLLUM  4.2.0
Tools for gravitational-wave analyses
ffl Class Reference

Load frame files and access data in frames. More...

#include <ffl.h>

Collaboration diagram for ffl:

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...
 
SegmentsGetSegments (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...
 
GwollumPlotGP
 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...
 
Segmentsseg
 Segments covered by the ffl file. More...
 
string srandint
 Random integer string. More...
 
bool status_OK
 Class status. More...
 

Detailed Description

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:

  • path to a frame file
  • starting GPS time of the frame file
  • duration of the frame file [s]
  • unused column [0]
  • unused column [0]
Note
The FFL format is the native format for this class. However the lalcache format (LCF) is also supported. In that case the LCF file is first converted to a FFL file before processing.

This class is implemented using the Frame Library functions.

Author
Florent Robinet

Constructor & Destructor Documentation

◆ ffl()

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()).

Parameters
aFrameFileListpath to frame file list
aPlotStyleplotting style
aVerbosityverbosity level

◆ ~ffl()

ffl::~ffl ( void  )
virtual

Destructor of the ffl class.

Member Function Documentation

◆ Convert2Ffl()

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()).

Returns
The name of the converted file is returned. "none" is returned if this function fails.

◆ 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.

Parameters
[in]aTmpDirPathPath to the working directory.

◆ ExtractChannels()

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.

Note
The data is retrieved several times, as configured with SetTrials().
LoadFrameFile() must be called at least one time before calling this function.
Parameters
[in]aGpsGPS time where to scan the channel list.
Returns
true if the channel list was correctly loaded, false otherwise.

◆ GetChannelList()

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_*".

Parameters
[in]aFilterChannel name filter. Use "" for no filter.

◆ GetChannelSampling() [1/2]

unsigned int ffl::GetChannelSampling ( const string  aChannelName)
inline

Returns the sampling rate of a given channel [Hz].

Returns
0 if the channel is not found.
Note
To target a given GPS time, use ExtractChannels() first.
Parameters
[in]aChannelNameChannel name.

◆ GetChannelSampling() [2/2]

unsigned int ffl::GetChannelSampling ( const string  aChannelName,
unsigned int &  aChannelIndex 
)

Returns the sampling rate of a given channel [Hz].

Returns
0 if the channel is not found.
Note
To target a given GPS time, use ExtractChannels() first.
Parameters
[in]aChannelNameChannel name.
[out]aChannelIndexChannel index.

◆ GetData()

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.

Note
The data access is tried several times, as configured with SetTrials().

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.

Note
The user is in charge of deleting the returned vector.
Parameters
[out]aSizeNumber of samples in the returned vector.
[in]aChannelNameChannel name.
[in]aGpsStartStarting GPS time.
[in]aGpsEndEnding GPS time.
[in]aMissingSpecial value to flag missing samples. If =999.0, no flagging, the function returns NULL.

◆ GetInputFfl()

string ffl::GetInputFfl ( void  )
inline

Returns the path to the input frame file list.

◆ GetSegments()

Segments* ffl::GetSegments ( void  )
inline

Returns a pointer to the segments covered by the ffl.

Warning
DO NOT DELETE OR MODIFY! This object is internally used by the class.

◆ IsChannel()

bool ffl::IsChannel ( const string  aChannelName)

Tests whether a channel exists in the dataset pointed by the ffl.

Returns
true if the channel exists, false otherwise.
Warning
Make sure that the channel list was extracted at the correct GPS time. See ExtractChannels() or LoadFrameFile().
Parameters
[in]aChannelNameChannel name to test.

◆ LoadFrameFile()

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).

Parameters
[in]aGpsGPS time where to scan the channel list. Use 0 to scan the first frame file in the list.
Returns
true if the frame file list was correctly loaded, false otherwise.

◆ PlotData()

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.

Returns
A pointer to the resulting graph is returned. Do not modify or delete this object as it is internally used by the class. NULL is returned if this function fails.
Parameters
[in]aChannelNameChannel name.
[in]aGpsStartStarting GPS time.
[in]aGpsEndEnding GPS time.

◆ PrintChannels()

bool ffl::PrintChannels ( const unsigned int  aGps = 0)
inline

Prints the list of channels at a given GPS time.

Two columns are printed: the channel name and the sampling frequency [Hz].

Parameters
[in]aGpsGPS time.

◆ PrintData()

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.

Parameters
[in]aChannelNameChannel name.
[in]aGpsStartStarting GPS time.
[in]aGpsEndEnding GPS time.
aFileNameOutput text file name.

◆ Reset()

void ffl::Reset ( void  )

Resets ffl object.

◆ SetPlotName()

void ffl::SetPlotName ( const string  aName)

Sets a new name for the plotting structure.

Parameters
[in]aNamePlot name.

◆ SetTrials()

void ffl::SetTrials ( const unsigned int  aNTrials,
const unsigned int  aNSleepSeconds 
)
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.

Parameters
[in]aNTrialsNumber of trials.
[in]aNSleepSecondsNumber of seconds between trials.

Member Data Documentation

◆ channels

vector<string> ffl::channels
private

List of channels.

◆ ffile

vector<string> ffl::ffile
private

List of files.

◆ fFormat

string ffl::fFormat
private

Format frame file.

◆ fInFrameFile

string ffl::fInFrameFile
private

Path to input frame file list.

◆ frfile

FrFile* ffl::frfile
private

Fr file.

◆ fVerbosity

unsigned int ffl::fVerbosity
private

Verbosity level.

◆ fWoFrameFile

string ffl::fWoFrameFile
private

Path to working frame file (always FFL).

◆ G

TGraph* ffl::G
private

Graph.

◆ GP

GwollumPlot* ffl::GP
private

Plotting structure.

◆ nsleepsec

unsigned int ffl::nsleepsec
private

Number of seconds between trials.

◆ ntrials

unsigned int ffl::ntrials
private

Number of trials when accessing the data.

◆ sampling

vector<unsigned int> ffl::sampling
private

List of sampling frequencies.

◆ seg

Segments* ffl::seg
private

Segments covered by the ffl file.

◆ srandint

string ffl::srandint
private

Random integer string.

◆ status_OK

bool ffl::status_OK
private

Class status.


The documentation for this class was generated from the following files: