Load frame files and access data in frames. More...
#include <ffl.h>
Public Member Functions | |
string | Convert2Ffl (void) |
Converts the frame file list to an FFL format. | |
bool | DefineTmpDir (const string aTmpDirPath=".") |
Defines a temporary working directory. | |
bool | ExtractChannels (const int gps=0) |
Extracts available channels at a given GPS time. | |
int | GetChannelSampling (const string channel_name) |
Returns the sampling rate of a given channel. | |
double * | GetData (int &aSize, const string channel_name, const double gps_start, const double gps_end) |
Returns a data vector. | |
string | GetInputFfl (void) |
Returns the path to the input frame file list. | |
Segments * | GetSegments (void) |
Returns a pointer to the segments covered by the ffl. | |
bool | LoadFrameFile (void) |
Loads (or re-loads) the frame file list defined in ffl(). | |
TGraph * | PlotData (const string channel_name, const double gps_start, const double gps_end) |
Plots a data vector. | |
TGraph * | PlotData2 (const string channel_name1, const string channel_name12, const double gps_start, const double gps_end) |
TGraph * | PlotDerivative (const string channel_name, const double gps_start, const double gps_end) |
Plots the time-derivative of a data vector. | |
bool | PrintAsciiData (const string channel_name, const double gps_start, const double gps_end, string outputfilename) |
Prints a data vector in an text file. | |
void | PrintChannels (const int gps=0) |
Prints available channels at a given GPS time. | |
void | Reset (void) |
Resets ffl. | |
void | SetName (const string aName) |
Sets a new name for this. | |
Constructors and destructors | |
ffl (const string aFrameFileList, const string aPlotStyle="GWOLLUM", const int aVerbosity=0) | |
Constructor of the ffl class. | |
virtual | ~ffl (void) |
Destructor of the ffl class. |
Load frame files and access data in frames.
This class was designed to load frame files and provide tools to access the data. The native format for file registration is the FFL format. A FFL file is a text file where each line identifies a frame file. Each line must contained exactly 5 columns:
The frame files must be time-sorted and without time overlap.
The FFL format is the native format of this class. However the lalcache format (LCF) is also supported. In that case the LCF file is first converted to an FFL file before processing.
This class is built 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 should be provided. Two format are supported: the Frame File List (FFL) and the lalcache format (LCF). The FFL format is the native format for this class, if a LCF file is provided, this file is first converted to an FFL.
aFrameFileList | path to frame file list | |
aPlotStyle | plotting style | |
aVerbosity | verbosity level |
ffl::~ffl | ( | void | ) | [virtual] |
Destructor of the ffl class.
string ffl::Convert2Ffl | ( | void | ) |
Converts the frame file list to an FFL format.
If the format specified with ffl() 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()).
The name of the converted file is returned. "none" is returned if this function fails.
bool 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.
By default, the current directory is used.
aTmpDirPath | path to the working directory. |
bool ffl::ExtractChannels | ( | const int | gps = 0 |
) |
Extracts available channels at a given GPS time.
Only ADC, PROC and SIM channels are extracted. Only channels with a sampling rate above 1Hz are extracted.
gps | GPS time |
int ffl::GetChannelSampling | ( | const string | channel_name | ) |
Returns the sampling rate of a given channel.
Returns 0 if the channel is not found. Returns -1 if there is a error. To target a given GPS time, use ExtractChannels() first.
channel_name | channel name |
double * ffl::GetData | ( | int & | aSize, | |
const string | channel_name, | |||
const double | gps_start, | |||
const double | gps_end | |||
) |
Returns a data vector.
A pointer to the data vector is returned. Data of channel named 'channel_name' is loaded between 2 GPS times. The size of the returned vector is given by 'aSize'. NULL is returned if this function fails and aSize is assigned with a negative value:
The user is in charge of deleting the returned vector.
aSize | number of samples in the returned vector | |
channel_name | channel name | |
gps_start | starting GPS time | |
gps_end | ending GPS time |
string ffl::GetInputFfl | ( | void | ) | [inline] |
Returns the path to the input frame file list.
Segments* ffl::GetSegments | ( | void | ) | [inline] |
Returns a pointer to the segments covered by the ffl.
DO NOT DELETE OR MODIFY! This object is internally used by the class.
bool ffl::LoadFrameFile | ( | void | ) |
Loads (or re-loads) the frame file list defined in ffl().
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 can also be used if the frame file list needs to be reloaded (for example if it changed on disk).
Note that the channel information is extracted using the first frame file in the list. To update the channel information, use ExtractChannels().
TGraph * ffl::PlotData | ( | const string | channel_name, | |
const double | gps_start, | |||
const double | gps_end | |||
) |
Plots a data vector.
This function, when run interactively, plots the time series of a given channel between two GPS times. 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.
channel_name | channel name | |
gps_start | starting GPS time | |
gps_end | ending GPS time |
TGraph * ffl::PlotData2 | ( | const string | channel_name1, | |
const string | channel_name12, | |||
const double | gps_start, | |||
const double | gps_end | |||
) |
TGraph * ffl::PlotDerivative | ( | const string | channel_name, | |
const double | gps_start, | |||
const double | gps_end | |||
) |
Plots the time-derivative of a data vector.
This function, when run interactively, plots the time series of the time-derivative of a given channel between two GPS times. 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.
channel_name | channel name | |
gps_start | starting GPS time | |
gps_end | ending GPS time |
bool ffl::PrintAsciiData | ( | const string | channel_name, | |
const double | gps_start, | |||
const double | gps_end, | |||
string | outputfilename | |||
) |
Prints a data vector in an text file.
This function prints the time series of a given channel between two GPS times in an ASCII file.
channel_name | channel name | |
gps_start | starting GPS time | |
gps_end | ending GPS time | |
outputfilename | output ASCII file name |
void ffl::PrintChannels | ( | const int | gps = 0 |
) | [inline] |
Prints available channels at a given GPS time.
Two columns are printed: the channel name and the sampling frequency Only ADC and PROC channels are printed. Only channels with a sampling rate above 1Hz are printed.
gps | GPS time |
void ffl::Reset | ( | void | ) |
Resets ffl.
void ffl::SetName | ( | const string | aName | ) |
Sets a new name for this.
It is possible to assign a specific name to the object. This is useful for unicity (GwollumPlot object).
aName | new object name |