Creating a LIGO_LW file from scratch
Peter Shawhan
February 27, 2002
LDAS has its own internal software which allows it to create a file in
LIGO_LW format containing a table of
database entries (and/or a number of other data objects). However,
there is no software available that is designed to help users create
LIGO_LW files using their own data. It would be natural to include
functions to do this in the "metaio" library code (part of the
LIGOtools dataflow package); anyone who is interested in
working on this is encouraged to contact Philip Charlton
(charlton_p@ligo.caltech.edu) and Peter Shawhan
(shawhan_p@ligo.caltech.edu).
Even without specially-designed software, it is not too hard to create
a LIGO_LW file. The easiest way to learn the format is to examine
some examples generated by LDAS, such as this file.
A few notes:
- The header (everything up to the
<LIGO_LW Name="ligo:ldas:file">) is pure
boilerplate; just copy it to your own file.
- The Comment object is optional.
- The Stream object contains the data as a comma-separated list.
It is customary (though not technically required, I think) to separate
the rows with newlines. Note that there is a comma at the end of
every row except the last row.
- The trickiest aspect of the format is the treatment of
"special" characters and binary data in the Stream. The rules are
described in the "Table element" section near the bottom of the LDAS
web page describing the LIGO_LW format. To summarize the main
points:
- An lstring value is enclosed in double-quotes.
An internal comma must be escaped by a backslash, but nothing
else should be escaped, not even a double-quote or backslash.
- There are a few valid ways to represent an ilwd:char_u
value (used to store a binary array of unsigned bytes), but the
simplest thing is to always format it as a series of octal values, as
shown in the example file.