29#include <lal/LALMalloc.h>
30#include <lal/LIGOLwXML.h>
31#include <lal/LIGOLwXMLRead.h>
32#include <lal/LIGOMetadataTables.h>
33#include <lal/LIGOMetadataUtils.h>
34#include <lal/XLALError.h>
50 memset(new->ifo, 0,
sizeof(new->ifo));
51 memset(new->channel, 0,
sizeof(new->channel));
95 static const char table_name[] =
"sngl_ringdown";
99 struct MetaioParseEnvironment env;
129 if(MetaioOpenFile(&env,
filename)) {
130 XLALPrintError(
"%s(): error opening \"%s\": %s\n", __func__,
filename, env.mierrmsg.data ? env.mierrmsg.data :
"unknown reason");
133 if(MetaioOpenTableOnly(&env, table_name)) {
135 XLALPrintError(
"%s(): cannot find %s table: %s\n", __func__, table_name, env.mierrmsg.data ? env.mierrmsg.data :
"unknown reason");
147 column_pos.start_time_gmst =
XLALLIGOLwFindColumn(&env,
"start_time_gmst", METAIO_TYPE_REAL_8, 1);
154 column_pos.num_clust_trigs =
XLALLIGOLwFindColumn(&env,
"num_clust_trigs", METAIO_TYPE_INT_4S, 1);
171 XLALPrintError(
"%s(): failure reading %s table\n", __func__, table_name);
177 while((miostatus = MetaioGetRow(&env)) > 0) {
191 next = &(*next)->
next;
196 strncpy(row->
ifo, env.ligo_lw.table.elt[column_pos.ifo].data.lstring.data,
sizeof(row->
ifo) - 1);
197 strncpy(row->
channel, env.ligo_lw.table.elt[column_pos.channel].data.lstring.data,
sizeof(row->
channel) - 1);
198 XLALGPSSet(&row->
start_time, env.ligo_lw.table.elt[column_pos.start_time].data.int_4s, env.ligo_lw.table.elt[column_pos.start_time_ns].data.int_4s);
199 row->
start_time_gmst = env.ligo_lw.table.elt[column_pos.start_time_gmst].data.real_8;
200 row->
frequency = env.ligo_lw.table.elt[column_pos.frequency].data.real_4;
201 row->
quality = env.ligo_lw.table.elt[column_pos.quality].data.real_4;
202 row->
phase = env.ligo_lw.table.elt[column_pos.phase].data.real_4;
203 row->
mass = env.ligo_lw.table.elt[column_pos.mass].data.real_4;
204 row->
spin = env.ligo_lw.table.elt[column_pos.spin].data.real_4;
205 row->
epsilon = env.ligo_lw.table.elt[column_pos.epsilon].data.real_4;
206 row->
num_clust_trigs = env.ligo_lw.table.elt[column_pos.num_clust_trigs].data.int_4s;
207 row->
ds2_H1H2 = env.ligo_lw.table.elt[column_pos.ds2_H1H2].data.real_4;
208 row->
ds2_H1L1 = env.ligo_lw.table.elt[column_pos.ds2_H1L1].data.real_4;
209 row->
ds2_H1V1 = env.ligo_lw.table.elt[column_pos.ds2_H1V1].data.real_4;
210 row->
ds2_H2L1 = env.ligo_lw.table.elt[column_pos.ds2_H2L1].data.real_4;
211 row->
ds2_H2V1 = env.ligo_lw.table.elt[column_pos.ds2_H2V1].data.real_4;
212 row->
ds2_L1V1 = env.ligo_lw.table.elt[column_pos.ds2_L1V1].data.real_4;
213 row->
amplitude = env.ligo_lw.table.elt[column_pos.amplitude].data.real_4;
214 row->
snr = env.ligo_lw.table.elt[column_pos.snr].data.real_4;
215 row->
eff_dist = env.ligo_lw.table.elt[column_pos.eff_dist].data.real_4;
216 row->
sigma_sq = env.ligo_lw.table.elt[column_pos.sigma_sq].data.real_4;
217 row->
event_id = env.ligo_lw.table.elt[column_pos.event_id].data.int_8s;
222 XLALPrintError(
"%s(): I/O error parsing %s table: %s\n", __func__, table_name, env.mierrmsg.data ? env.mierrmsg.data :
"unknown reason");
228 if(MetaioClose(&env)) {
230 XLALPrintError(
"%s(): error parsing document after %s table: %s\n", __func__, table_name, env.mierrmsg.data ? env.mierrmsg.data :
"unknown reason");
int XLALLIGOLwFindColumn(struct MetaioParseEnvironment *env, const char *name, unsigned int type, int required)
Convenience wrapper for MetaioFindColumn(), translating to XLAL-style error reporting and printing us...
void * XLALMalloc(size_t n)
#define XLAL_ERROR_NULL(...)
int XLALGetBaseErrno(void)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSet(LIGOTimeGPS *epoch, INT4 gpssec, INT8 gpsnan)
SnglRingdownTable * XLALDestroySnglRingdownTableRow(SnglRingdownTable *row)
Destroy a SnglRingdownTable structure.
SnglRingdownTable * XLALCreateSnglRingdownTableRow(const ProcessTable *process)
Create a SnglRingdownTable structure.
SnglRingdownTable * XLALSnglRingdownTableFromLIGOLw(const char *filename)
Read the sngl_ringdown table from a LIGO Light Weight XML file into a linked list of SnglRingdownTabl...
void XLALDestroySnglRingdownTable(SnglRingdownTable *head)
Destroy a SnglRingdownTable linked list.
This structure contains the required information for generating a ringdown template and storing ringd...
CHAR ifo[LIGOMETA_IFO_MAX]
CHAR channel[LIGOMETA_CHANNEL_MAX]
struct tagSnglRingdownTable * next