![]() |
GWOLLUM 4.2.0
Tools for gravitational-wave analyses
|
#include "CUtils.h"
Functions | |
| bool | CopyFile (error_code &aErrorCode, const string aFrom, const string aTo, const bool aOverwrite) |
| Copy a file to a destination. | |
| double | GetMedian (const unsigned int aSize, double *aVect) |
| Returns the median value of an array of doubles. | |
| double * | GetTukeyWindow (const unsigned int aSize, const double aAlpha) |
| Returns a Tukey window. | |
| vector< string > | Glob (const char *pattern) |
| C utility to extract a list of files. | |
| int | GwlPrintVersion (void) |
| Prints the version. | |
| bool | ListDirectories (vector< string > &subdir, const string maindir) |
| Returns a list of sub-directories. | |
| void | MakeStereoSoundFile (const string aFileName, const unsigned int aN, const unsigned int aSamplingRate, double *aAmplitudeLeft, double *aAmplitudeRight, const double aScale, const int aOffset) |
| C utility to generate a WAV file. | |
| double | medianbiasfactor (const unsigned int nn) |
| Returns the bias factor when computing a median with a finite number of samples. | |
| string | ReplaceAll (string str, const string &from, const string &to) |
| Replaces all occurences of a sub-string by another sub-string. | |
| vector< string > | SplitString (const string stringtodivide, const char separator) |
| Splits a string into sub-strings. | |
| string | StringToUpper (string stringtoconvert) |
| Transforms a string to uppercase. | |
| template<typename Word > | |
| std::ostream & | write_word (std::ostream &outs, Word value, unsigned size=sizeof(Word)) |
See CUtils.h.
| bool CopyFile | ( | error_code & | aErrorCode, |
| const string | aFrom, | ||
| const string | aTo, | ||
| const bool | aOverwrite = false |
||
| ) |
Copy a file to a destination.
| [out] | aErrorCode | Platform-dependent error code: see std::error_code. |
| [in] | aFrom | Path to the original file. It must exist. |
| [in] | aTo | Path to destination. This can be either a directory or a file path. |
| [in] | aOverwrite | Set this flag to true to overwrite the destimation if the file already exists. |
| double GetMedian | ( | const unsigned int | aSize, |
| double * | aVect | ||
| ) |
Returns the median value of an array of doubles.
The input vector is sorted. Then the median value is returned.
| [in] | aSize | Array size. |
| [in,out] | aVect | Pointer to the input array. The array values are sorted after calling this function. |
| double * GetTukeyWindow | ( | const unsigned int | aSize, |
| const double | aAlpha | ||
| ) |
Returns a Tukey window.
| [in] | aSize | Window size. |
| [in] | aAlpha | Total fraction of the window used to transition from 0 to 1 and 1 to 0. =0: rectangle, =1: HAnn window. |
| vector< string > Glob | ( | const char * | pattern | ) |
C utility to extract a list of files.
| [in] | pattern | File pattern. |
| int GwlPrintVersion | ( | void | ) |
Prints the version.
This function also checks the GWOLLUM environment:
$GWOLLUM_DATA must point to an existing directory.$GWOLLUM_PIX must point to an existing directory.| bool ListDirectories | ( | vector< string > & | subdir, |
| const string | maindir | ||
| ) |
Returns a list of sub-directories.
The vector 'subdir' is filled with directories contained in 'maindir'
| [out] | subdir | List of sub-directories. |
| [in] | maindir | Path to the main directory. |
| void MakeStereoSoundFile | ( | const string | aFileName, |
| const unsigned int | aN, | ||
| const unsigned int | aSamplingRate, | ||
| double * | aAmplitudeLeft, | ||
| double * | aAmplitudeRight, | ||
| const double | aScale = 1.0, |
||
| const int | aOffset = 0 |
||
| ) |
C utility to generate a WAV file.
| [in] | aFileName | Output .wav file name. |
| [in] | aN | Number of samples. |
| [in] | aSamplingRate | Sampling rate [Hz]. |
| [in] | aAmplitudeLeft | Amplitudes for left audio. |
| [in] | aAmplitudeRight | Amplitudes for right audio. |
| [in] | aScale | Scale factor ("volume") applied to amplitudes. |
| [in] | aOffset | Offset applied to the number of samples. |
| double medianbiasfactor | ( | const unsigned int | nn | ) |
Returns the bias factor when computing a median with a finite number of samples.
The bias factor is (see Eq. B12 in gr-qc/0509116):
\[ \alpha = \sum_{l=1}^{n}{\frac{(-1)^{l+1}}{l}}. \]
| [in] | nn | Number of samples \(n\). |
| string ReplaceAll | ( | string | str, |
| const string & | from, | ||
| const string & | to | ||
| ) |
Replaces all occurences of a sub-string by another sub-string.
All occurences of substring 'from' are replaced by 'to'.
| [in] | str | String to modify. |
| [in] | from | Substring to replace from. |
| [in] | to | Substring to replace to. |
| vector< string > SplitString | ( | const string | stringtodivide, |
| const char | separator = ' ' |
||
| ) |
Splits a string into sub-strings.
A string is divided into an array of words. The separator defines where to break the string. The separator should be a single character.
| [in] | stringtodivide | String to divide. |
| [in] | separator | Separator. |
| string StringToUpper | ( | string | stringtoconvert | ) |
Transforms a string to uppercase.
| [in] | stringtoconvert | String to transform. |
| std::ostream & write_word | ( | std::ostream & | outs, |
| Word | value, | ||
| unsigned | size = sizeof( Word ) |
||
| ) |