Working with GWOSC Data Using C

C developers have at least two options for libraries that will read GWOSC data files - the Frame Library and HDF5. If you have no strong reason to prefer C, you may find the python-based instructions in the Introductory Tutorial a quicker way to get started.

The Frame Library

GWOSC data files in the gravitational wave frame file format (.gwf) may be read using the Frame Library.


GWOSC data files in the HDF5 file format (.hdf5) may be read using the HDF5 Library.

The HDF5 in C example script is a minimal example, showing how to extract the most essential data from a GWOSC data file. More complete documentation on HDF5 is available on the HDF Group web site.

In the GWOSC computing enviornment, the example script may be compiled with this command:

gcc -o hdf5_losc hdf5_losc.c  -lhdf5  -D H5_USE_16_API

On a mac, macports may be used to install HDF5, in which case the example script may be compiled with a command similar to this:

gcc -o hdf5_losc hdf5_losc.c  -lhdf5  -D H5_USE_16_API -I /opt/local/include -L/opt/local/lib

All computing envoirnments are a little different, so compiling on your computer may not work in exactly the same way.

Running the example script should produce output similar to this:

$ ./hdf5_losc
 [ 196591 196591 196591 196591 196591 196591 196591 196591 196591 196591 ... ]
The total live time for this 4096 s file is: 3481 seconds
 [ 8.302311e-17 9.192293e-17 1.007950e-16 1.095800e-16 1.182704e-16
1.269312e-16 1.354517e-16 1.439318e-16 1.522801e-16 1.605206e-16 ... ]

GWOSC Data File Structure

For an overview of the GWOSC data file structure, see the Introduction to GWOSC Data Files tutorial. In addition, both the HDF5 Library and the Frame Library provide tools for reading or "dumping" the structure of a file. For example, HDFView provides a GUI interface to HDF5 files. If working with GWF files, the FrDump is a quick way to see what information is available in a frame file.