Commit af9cc4d5 authored by Cody Messick's avatar Cody Messick

Removed hardcoded_srcbuf_crap function from itacac. This involves changing how...

Removed hardcoded_srcbuf_crap function from itacac. This involves changing how the snr time series are stored in the buffer passed to python, meaning the from_buffer function in snglinspiraltable.c had to be modified. The order of the snr time series were also changed, resulting in minor changes to gstlal_snglinspiral.c and snglinspiralrowtype.c.
parent 623dab93
This diff is collapsed.
......@@ -133,7 +133,6 @@ typedef struct {
GstClockTime initial_timestamp;
guint samples_available_for_padding;
GList *next_in_coinc_order;
} GSTLALItacacPad;
......@@ -158,6 +157,7 @@ typedef struct {
GMutex snr_lock;
gboolean waiting;
guint test;
GSTLALItacacPad *H1_itacacpad, *K1_itacacpad, *L1_itacacpad, *V1_itacacpad;
//guint max_coinc_window_samps;
......
......@@ -364,9 +364,9 @@ int populate_snglinspiral_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *in
* Populate the SNR snippet if available
* FIXME: only supported for single precision at the moment
*/
gsl_vector_complex_float_view L1_snr_vector_view, H1_snr_vector_view, V1_snr_vector_view, K1_snr_vector_view;
gsl_vector_complex_float_view L1_snr_series_view, H1_snr_series_view, V1_snr_series_view, K1_snr_series_view;
if ((L1_snr_matrix_view || H1_snr_matrix_view || V1_snr_matrix_view || K1_snr_matrix_view) && !input->no_peaks_past_threshold)
gsl_vector_complex_float_view H1_snr_vector_view, K1_snr_vector_view, L1_snr_vector_view, V1_snr_vector_view;
gsl_vector_complex_float_view H1_snr_series_view, K1_snr_series_view, L1_snr_series_view, V1_snr_series_view;
if ((H1_snr_matrix_view || K1_snr_matrix_view || L1_snr_matrix_view || V1_snr_matrix_view) && !input->no_peaks_past_threshold)
{
/* Allocate a set of empty time series. The event takes ownership, so no need to free it*/
/* Get the columns of SNR we are interested in */
......@@ -375,6 +375,11 @@ int populate_snglinspiral_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *in
H1_snr_timeseries_length = H1_snr_vector_view.vector.size;
} else
H1_snr_timeseries_length = 0;
if(K1_snr_matrix_view != NULL) {
K1_snr_vector_view = gsl_matrix_complex_float_column(&(K1_snr_matrix_view->matrix), channel);
K1_snr_timeseries_length = K1_snr_vector_view.vector.size;
} else
K1_snr_timeseries_length = 0;
if(L1_snr_matrix_view != NULL) {
L1_snr_vector_view = gsl_matrix_complex_float_column(&(L1_snr_matrix_view->matrix), channel);
L1_snr_timeseries_length = L1_snr_vector_view.vector.size;
......@@ -385,13 +390,8 @@ int populate_snglinspiral_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *in
V1_snr_timeseries_length = V1_snr_vector_view.vector.size;
} else
V1_snr_timeseries_length = 0;
if(K1_snr_matrix_view != NULL) {
K1_snr_vector_view = gsl_matrix_complex_float_column(&(K1_snr_matrix_view->matrix), channel);
K1_snr_timeseries_length = K1_snr_vector_view.vector.size;
} else
K1_snr_timeseries_length = 0;
event = gstlal_snglinspiral_new(H1_snr_timeseries_length, L1_snr_timeseries_length, V1_snr_timeseries_length, K1_snr_timeseries_length);
event = gstlal_snglinspiral_new(H1_snr_timeseries_length, K1_snr_timeseries_length, L1_snr_timeseries_length, V1_snr_timeseries_length);
if(H1_snr_matrix_view != NULL) {
/* Make a GSL view of the time series array data */
......@@ -399,24 +399,24 @@ int populate_snglinspiral_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *in
/* Use BLAS to do the copy */
gsl_blas_ccopy (&(H1_snr_vector_view.vector), &(H1_snr_series_view.vector));
}
if(K1_snr_matrix_view != NULL) {
/* Make a GSL view of the time series array data */
K1_snr_series_view = gsl_vector_complex_float_view_array((float *) &(event->snr[event->H1_length]), event->K1_length);
/* Use BLAS to do the copy */
gsl_blas_ccopy (&(K1_snr_vector_view.vector), &(K1_snr_series_view.vector));
}
if(L1_snr_matrix_view != NULL) {
/* Make a GSL view of the time series array data */
L1_snr_series_view = gsl_vector_complex_float_view_array((float *) &(event->snr[event->H1_length]), event->L1_length);
L1_snr_series_view = gsl_vector_complex_float_view_array((float *) &(event->snr[event->H1_length + event->K1_length]), event->L1_length);
/* Use BLAS to do the copy */
gsl_blas_ccopy (&(L1_snr_vector_view.vector), &(L1_snr_series_view.vector));
}
if(V1_snr_matrix_view != NULL) {
/* Make a GSL view of the time series array data */
V1_snr_series_view = gsl_vector_complex_float_view_array((float *) &(event->snr[event->H1_length + event->L1_length]), event->V1_length);
V1_snr_series_view = gsl_vector_complex_float_view_array((float *) &(event->snr[event->H1_length + event->K1_length + event->L1_length]), event->V1_length);
/* Use BLAS to do the copy */
gsl_blas_ccopy (&(V1_snr_vector_view.vector), &(V1_snr_series_view.vector));
}
if(K1_snr_matrix_view != NULL) {
/* Make a GSL view of the time series array data */
K1_snr_series_view = gsl_vector_complex_float_view_array((float *) &(event->snr[event->H1_length + event->L1_length + event->V1_length]), event->K1_length);
/* Use BLAS to do the copy */
gsl_blas_ccopy (&(K1_snr_vector_view.vector), &(K1_snr_series_view.vector));
}
} else {
if(!provided_empty_trigger) {
//fprintf(stderr, "allocating snglinspiral with 0 length for %s event\n", bankarray[channel].ifo);
......@@ -475,9 +475,9 @@ int populate_snglinspiral_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *in
gst_memory_new_wrapped(
GST_MEMORY_FLAG_READONLY | GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS,
event,
sizeof(*event) + (event->H1_length + event->L1_length + event->V1_length + event->K1_length) * sizeof(event->snr[0]),
sizeof(*event) + (event->H1_length + event->K1_length + event->L1_length + event->V1_length) * sizeof(event->snr[0]),
0,
sizeof(*event) + (event->H1_length + event->L1_length + event->V1_length + event->K1_length) * sizeof(event->snr[0]),
sizeof(*event) + (event->H1_length + event->K1_length + event->L1_length + event->V1_length) * sizeof(event->snr[0]),
event,
(GDestroyNotify) gstlal_snglinspiral_free
)
......@@ -486,7 +486,7 @@ int populate_snglinspiral_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *in
return 0;
}
GstBuffer *gstlal_snglinspiral_new_buffer_from_peak(struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view, GstClockTimeDiff timediff)
GstBuffer *gstlal_snglinspiral_new_buffer_from_peak(struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view, GstClockTimeDiff timediff)
{
GstBuffer *srcbuf = gst_buffer_new();
......@@ -513,7 +513,7 @@ GstBuffer *gstlal_snglinspiral_new_buffer_from_peak(struct gstlal_peak_state *in
return srcbuf;
}
int gstlal_snglinspiral_append_peak_to_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view)
int gstlal_snglinspiral_append_peak_to_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view)
{
//
// Add peak information to a buffer, GST_BUFFER_OFFSET cannot be
......
......@@ -52,8 +52,8 @@ void gstlal_snglinspiral_array_free(SnglInspiralTable *bankarray);
/*
* FIXME: only support single precision SNR snippets at the moment
*/
GstBuffer *gstlal_snglinspiral_new_buffer_from_peak(struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view, GstClockTimeDiff);
int gstlal_snglinspiral_append_peak_to_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view);
GstBuffer *gstlal_snglinspiral_new_buffer_from_peak(struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view, GstClockTimeDiff);
int gstlal_snglinspiral_append_peak_to_buffer(GstBuffer *srcbuf, struct gstlal_peak_state *input, SnglInspiralTable *bankarray, GstPad *pad, guint64 offset, guint64 length, GstClockTime time, guint rate, void *chi2, gsl_matrix_complex_float_view *H1_snr_matrix_view, gsl_matrix_complex_float_view *K1_snr_matrix_view, gsl_matrix_complex_float_view *L1_snr_matrix_view, gsl_matrix_complex_float_view *V1_snr_matrix_view);
G_END_DECLS
......
......@@ -45,14 +45,14 @@
*/
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t H1_length, size_t L1_length, size_t V1_length, size_t K1_length)
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t H1_length, size_t K1_length, size_t L1_length, size_t V1_length)
{
struct GSTLALSnglInspiral *row = calloc(1, sizeof(*row) + (H1_length + L1_length + V1_length + K1_length) * sizeof(row->snr[0]));
struct GSTLALSnglInspiral *row = calloc(1, sizeof(*row) + (H1_length + K1_length + L1_length + V1_length) * sizeof(row->snr[0]));
if (row) {
row->L1_length = L1_length;
row->H1_length = H1_length;
row->V1_length = V1_length;
row->K1_length = K1_length;
row->L1_length = L1_length;
row->V1_length = V1_length;
}
......
......@@ -56,15 +56,15 @@ struct GSTLALSnglInspiral {
SnglInspiralTable parent;
LIGOTimeGPS epoch;
double deltaT;
size_t L1_length;
size_t H1_length;
size_t V1_length;
size_t K1_length;
size_t L1_length;
size_t V1_length;
float complex snr[];
};
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t L1_length, size_t H1_length, size_t V1_length, size_t K1_length);
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t H1_length, size_t K1_length, size_t L1_length, size_t V1_length);
void gstlal_snglinspiral_free(struct GSTLALSnglInspiral *row);
......
......@@ -59,9 +59,9 @@ typedef struct {
PyObject_HEAD
SnglInspiralTable row;
COMPLEX8TimeSeries *H1_snr;
COMPLEX8TimeSeries *K1_snr;
COMPLEX8TimeSeries *L1_snr;
COMPLEX8TimeSeries *V1_snr;
COMPLEX8TimeSeries *K1_snr;
} gstlal_GSTLALSnglInspiral;
......@@ -270,7 +270,44 @@ static PyObject *H1_snr_component_get(PyObject *obj, void *data)
return NULL;
}
static PyObject *K1_snr_component_get(PyObject *obj, void *data)
{
COMPLEX8TimeSeries *K1_snr = ((gstlal_GSTLALSnglInspiral *) obj)->K1_snr;
const char *name = data;
if(!K1_snr) {
PyErr_SetString(PyExc_ValueError, "no snr time series available");
return NULL;
}
if(!strcmp(name, "_K1_snr_name")) {
return PyString_FromString(K1_snr->name);
} else if(!strcmp(name, "_K1_snr_epoch_gpsSeconds")) {
return PyInt_FromLong(K1_snr->epoch.gpsSeconds);
} else if(!strcmp(name, "_K1_snr_epoch_gpsNanoSeconds")) {
return PyInt_FromLong(K1_snr->epoch.gpsNanoSeconds);
} else if(!strcmp(name, "_K1_snr_f0")) {
return PyFloat_FromDouble(K1_snr->f0);
} else if(!strcmp(name, "_K1_snr_deltaT")) {
return PyFloat_FromDouble(K1_snr->deltaT);
} else if(!strcmp(name, "_K1_snr_sampleUnits")) {
char *s = XLALUnitToString(&K1_snr->sampleUnits);
PyObject *result = PyString_FromString(s);
XLALFree(s);
return result;
} else if(!strcmp(name, "_K1_snr_data_length")) {
return PyInt_FromLong(K1_snr->data->length);
} else if(!strcmp(name, "_K1_snr_data")) {
npy_intp dims[] = {K1_snr->data->length};
PyObject *array = PyArray_SimpleNewFromData(1, dims, NPY_CFLOAT, K1_snr->data->data);
if(!array)
return NULL;
Py_INCREF(obj);
PyArray_SetBaseObject((PyArrayObject *) array, obj);
return array;
}
PyErr_BadArgument();
return NULL;
}
static PyObject *L1_snr_component_get(PyObject *obj, void *data)
{
COMPLEX8TimeSeries *L1_snr = ((gstlal_GSTLALSnglInspiral *) obj)->L1_snr;
......@@ -350,45 +387,6 @@ static PyObject *V1_snr_component_get(PyObject *obj, void *data)
}
static PyObject *K1_snr_component_get(PyObject *obj, void *data)
{
COMPLEX8TimeSeries *K1_snr = ((gstlal_GSTLALSnglInspiral *) obj)->K1_snr;
const char *name = data;
if(!K1_snr) {
PyErr_SetString(PyExc_ValueError, "no snr time series available");
return NULL;
}
if(!strcmp(name, "_K1_snr_name")) {
return PyString_FromString(K1_snr->name);
} else if(!strcmp(name, "_K1_snr_epoch_gpsSeconds")) {
return PyInt_FromLong(K1_snr->epoch.gpsSeconds);
} else if(!strcmp(name, "_K1_snr_epoch_gpsNanoSeconds")) {
return PyInt_FromLong(K1_snr->epoch.gpsNanoSeconds);
} else if(!strcmp(name, "_K1_snr_f0")) {
return PyFloat_FromDouble(K1_snr->f0);
} else if(!strcmp(name, "_K1_snr_deltaT")) {
return PyFloat_FromDouble(K1_snr->deltaT);
} else if(!strcmp(name, "_K1_snr_sampleUnits")) {
char *s = XLALUnitToString(&K1_snr->sampleUnits);
PyObject *result = PyString_FromString(s);
XLALFree(s);
return result;
} else if(!strcmp(name, "_K1_snr_data_length")) {
return PyInt_FromLong(K1_snr->data->length);
} else if(!strcmp(name, "_K1_snr_data")) {
npy_intp dims[] = {K1_snr->data->length};
PyObject *array = PyArray_SimpleNewFromData(1, dims, NPY_CFLOAT, K1_snr->data->data);
if(!array)
return NULL;
Py_INCREF(obj);
PyArray_SetBaseObject((PyArrayObject *) array, obj);
return array;
}
PyErr_BadArgument();
return NULL;
}
static struct PyGetSetDef getset[] = {
{"ifo", pylal_inline_string_get, pylal_inline_string_set, "ifo", &(struct pylal_inline_string_description) {offsetof(gstlal_GSTLALSnglInspiral, row.ifo), LIGOMETA_IFO_MAX}},
{"search", pylal_inline_string_get, pylal_inline_string_set, "search", &(struct pylal_inline_string_description) {offsetof(gstlal_GSTLALSnglInspiral, row.search), LIGOMETA_SEARCH_MAX}},
......@@ -396,37 +394,37 @@ static struct PyGetSetDef getset[] = {
{"end", end_get, end_set, "end", NULL},
{"template_id", template_id_get, template_id_set, "template_id", NULL},
{"_H1_snr_name", H1_snr_component_get, NULL, ".H1_snr.name", "_H1_snr_name"},
{"_K1_snr_name", K1_snr_component_get, NULL, ".K1_snr.name", "_K1_snr_name"},
{"_L1_snr_name", L1_snr_component_get, NULL, ".L1_snr.name", "_L1_snr_name"},
{"_V1_snr_name", V1_snr_component_get, NULL, ".V1_snr.name", "_V1_snr_name"},
{"_K1_snr_name", K1_snr_component_get, NULL, ".K1_snr.name", "_K1_snr_name"},
{"_H1_snr_epoch_gpsSeconds", H1_snr_component_get, NULL, ".H1_snr.epoch.gpsSeconds", "_H1_snr_epoch_gpsSeconds"},
{"_K1_snr_epoch_gpsSeconds", K1_snr_component_get, NULL, ".K1_snr.epoch.gpsSeconds", "_K1_snr_epoch_gpsSeconds"},
{"_L1_snr_epoch_gpsSeconds", L1_snr_component_get, NULL, ".L1_snr.epoch.gpsSeconds", "_L1_snr_epoch_gpsSeconds"},
{"_V1_snr_epoch_gpsSeconds", V1_snr_component_get, NULL, ".V1_snr.epoch.gpsSeconds", "_V1_snr_epoch_gpsSeconds"},
{"_K1_snr_epoch_gpsSeconds", K1_snr_component_get, NULL, ".K1_snr.epoch.gpsSeconds", "_K1_snr_epoch_gpsSeconds"},
{"_H1_snr_epoch_gpsNanoSeconds", H1_snr_component_get, NULL, ".H1_snr.epoch.gpsNanoSeconds", "_H1_snr_epoch_gpsNanoSeconds"},
{"_K1_snr_epoch_gpsNanoSeconds", K1_snr_component_get, NULL, ".K1_snr.epoch.gpsNanoSeconds", "_K1_snr_epoch_gpsNanoSeconds"},
{"_L1_snr_epoch_gpsNanoSeconds", L1_snr_component_get, NULL, ".L1_snr.epoch.gpsNanoSeconds", "_L1_snr_epoch_gpsNanoSeconds"},
{"_V1_snr_epoch_gpsNanoSeconds", V1_snr_component_get, NULL, ".V1_snr.epoch.gpsNanoSeconds", "_V1_snr_epoch_gpsNanoSeconds"},
{"_K1_snr_epoch_gpsNanoSeconds", K1_snr_component_get, NULL, ".K1_snr.epoch.gpsNanoSeconds", "_K1_snr_epoch_gpsNanoSeconds"},
{"_H1_snr_f0", H1_snr_component_get, NULL, ".H1_snr.f0", "_H1_snr_f0"},
{"_K1_snr_f0", K1_snr_component_get, NULL, ".K1_snr.f0", "_K1_snr_f0"},
{"_L1_snr_f0", L1_snr_component_get, NULL, ".L1_snr.f0", "_L1_snr_f0"},
{"_V1_snr_f0", V1_snr_component_get, NULL, ".V1_snr.f0", "_V1_snr_f0"},
{"_K1_snr_f0", K1_snr_component_get, NULL, ".K1_snr.f0", "_K1_snr_f0"},
{"_H1_snr_deltaT", H1_snr_component_get, NULL, ".H1_snr.deltaT", "_H1_snr_deltaT"},
{"_K1_snr_deltaT", K1_snr_component_get, NULL, ".K1_snr.deltaT", "_K1_snr_deltaT"},
{"_L1_snr_deltaT", L1_snr_component_get, NULL, ".L1_snr.deltaT", "_L1_snr_deltaT"},
{"_V1_snr_deltaT", V1_snr_component_get, NULL, ".V1_snr.deltaT", "_V1_snr_deltaT"},
{"_K1_snr_deltaT", K1_snr_component_get, NULL, ".K1_snr.deltaT", "_K1_snr_deltaT"},
{"_H1_snr_sampleUnits", H1_snr_component_get, NULL, ".H1_snr.sampleUnits", "_H1_snr_sampleUnits"},
{"_K1_snr_sampleUnits", K1_snr_component_get, NULL, ".K1_snr.sampleUnits", "_K1_snr_sampleUnits"},
{"_L1_snr_sampleUnits", L1_snr_component_get, NULL, ".L1_snr.sampleUnits", "_L1_snr_sampleUnits"},
{"_V1_snr_sampleUnits", V1_snr_component_get, NULL, ".V1_snr.sampleUnits", "_V1_snr_sampleUnits"},
{"_K1_snr_sampleUnits", K1_snr_component_get, NULL, ".K1_snr.sampleUnits", "_K1_snr_sampleUnits"},
{"_H1_snr_data_length", H1_snr_component_get, NULL, ".H1_snr.data.length", "_H1_snr_data_length"},
{"_K1_snr_data_length", K1_snr_component_get, NULL, ".K1_snr.data.length", "_K1_snr_data_length"},
{"_L1_snr_data_length", L1_snr_component_get, NULL, ".L1_snr.data.length", "_L1_snr_data_length"},
{"_V1_snr_data_length", V1_snr_component_get, NULL, ".V1_snr.data.length", "_V1_snr_data_length"},
{"_K1_snr_data_length", K1_snr_component_get, NULL, ".K1_snr.data.length", "_K1_snr_data_length"},
{"_H1_snr_data", H1_snr_component_get, NULL, ".H1_snr.data", "_H1_snr_data"},
{"_K1_snr_data", K1_snr_component_get, NULL, ".K1_snr.data", "_K1_snr_data"},
{"_L1_snr_data", L1_snr_component_get, NULL, ".L1_snr.data", "_L1_snr_data"},
{"_V1_snr_data", V1_snr_component_get, NULL, ".V1_snr.data", "_V1_snr_data"},
{"_K1_snr_data", K1_snr_component_get, NULL, ".K1_snr.data", "_K1_snr_data"},
{NULL,}
};
......@@ -452,12 +450,12 @@ static void __del__(PyObject *self)
{
if(((gstlal_GSTLALSnglInspiral *) self)->H1_snr != NULL)
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->H1_snr);
if(((gstlal_GSTLALSnglInspiral *) self)->K1_snr != NULL)
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->K1_snr);
if(((gstlal_GSTLALSnglInspiral *) self)->L1_snr != NULL)
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->L1_snr);
if(((gstlal_GSTLALSnglInspiral *) self)->V1_snr != NULL)
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->V1_snr);
if(((gstlal_GSTLALSnglInspiral *) self)->K1_snr != NULL)
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->K1_snr);
Py_TYPE(self)->tp_free(self);
}
......@@ -520,17 +518,17 @@ static PyObject *from_buffer(PyObject *cls, PyObject *args)
/* duplicate the SNR time series */
if(gstlal_snglinspiral->L1_length)
if(gstlal_snglinspiral->K1_length)
{
const size_t L1_nbytes = sizeof(gstlal_snglinspiral->snr[0]) * gstlal_snglinspiral->L1_length;
if (data + L1_nbytes > end)
const size_t K1_nbytes = sizeof(gstlal_snglinspiral->snr[0]) * gstlal_snglinspiral->K1_length;
if (data + K1_nbytes > end)
{
Py_DECREF(item);
Py_DECREF(result);
PyErr_SetString(PyExc_ValueError, "buffer overrun while copying L1 SNR time series");
PyErr_SetString(PyExc_ValueError, "buffer overrun while copying K1 SNR time series");
return NULL;
}
COMPLEX8TimeSeries *series = XLALCreateCOMPLEX8TimeSeries("snr", &gstlal_snglinspiral->epoch, 0., gstlal_snglinspiral->deltaT, &lalDimensionlessUnit, gstlal_snglinspiral->L1_length);
COMPLEX8TimeSeries *series = XLALCreateCOMPLEX8TimeSeries("snr", &gstlal_snglinspiral->epoch, 0., gstlal_snglinspiral->deltaT, &lalDimensionlessUnit, gstlal_snglinspiral->K1_length);
if (!series)
{
Py_DECREF(item);
......@@ -539,17 +537,17 @@ static PyObject *from_buffer(PyObject *cls, PyObject *args)
return NULL;
}
memcpy(series->data->data, &(gstlal_snglinspiral->snr[gstlal_snglinspiral->H1_length]), L1_nbytes);
data += L1_nbytes;
((gstlal_GSTLALSnglInspiral*)item)->L1_snr = series;
memcpy(series->data->data, &(gstlal_snglinspiral->snr[gstlal_snglinspiral->H1_length]), K1_nbytes);
data += K1_nbytes;
((gstlal_GSTLALSnglInspiral*)item)->K1_snr = series;
} else
((gstlal_GSTLALSnglInspiral*)item)->L1_snr = NULL;
((gstlal_GSTLALSnglInspiral*)item)->K1_snr = NULL;
if(gstlal_snglinspiral->V1_length)
if(gstlal_snglinspiral->L1_length)
{
const size_t V1_nbytes = sizeof(gstlal_snglinspiral->snr[0]) * gstlal_snglinspiral->V1_length;
if (data + V1_nbytes > end)
const size_t L1_nbytes = sizeof(gstlal_snglinspiral->snr[0]) * gstlal_snglinspiral->L1_length;
if (data + L1_nbytes > end)
{
Py_DECREF(item);
Py_DECREF(result);
......@@ -557,7 +555,7 @@ static PyObject *from_buffer(PyObject *cls, PyObject *args)
return NULL;
}
COMPLEX8TimeSeries *series = XLALCreateCOMPLEX8TimeSeries("snr", &gstlal_snglinspiral->epoch, 0., gstlal_snglinspiral->deltaT, &lalDimensionlessUnit, gstlal_snglinspiral->V1_length);
COMPLEX8TimeSeries *series = XLALCreateCOMPLEX8TimeSeries("snr", &gstlal_snglinspiral->epoch, 0., gstlal_snglinspiral->deltaT, &lalDimensionlessUnit, gstlal_snglinspiral->L1_length);
if (!series)
{
Py_DECREF(item);
......@@ -566,23 +564,23 @@ static PyObject *from_buffer(PyObject *cls, PyObject *args)
return NULL;
}
memcpy(series->data->data, &(gstlal_snglinspiral->snr[gstlal_snglinspiral->H1_length + gstlal_snglinspiral->L1_length]), V1_nbytes);
data += V1_nbytes;
((gstlal_GSTLALSnglInspiral*)item)->V1_snr = series;
memcpy(series->data->data, &(gstlal_snglinspiral->snr[gstlal_snglinspiral->H1_length + gstlal_snglinspiral->K1_length]), L1_nbytes);
data += L1_nbytes;
((gstlal_GSTLALSnglInspiral*)item)->L1_snr = series;
} else
((gstlal_GSTLALSnglInspiral*)item)->V1_snr = NULL;
((gstlal_GSTLALSnglInspiral*)item)->L1_snr = NULL;
if(gstlal_snglinspiral->K1_length)
if(gstlal_snglinspiral->V1_length)
{
const size_t K1_nbytes = sizeof(gstlal_snglinspiral->snr[0]) * gstlal_snglinspiral->K1_length;
if (data + K1_nbytes > end)
const size_t V1_nbytes = sizeof(gstlal_snglinspiral->snr[0]) * gstlal_snglinspiral->V1_length;
if (data + V1_nbytes > end)
{
Py_DECREF(item);
Py_DECREF(result);
PyErr_SetString(PyExc_ValueError, "buffer overrun while copying SNR time series");
return NULL;
}
COMPLEX8TimeSeries *series = XLALCreateCOMPLEX8TimeSeries("snr", &gstlal_snglinspiral->epoch, 0., gstlal_snglinspiral->deltaT, &lalDimensionlessUnit, gstlal_snglinspiral->K1_length);
COMPLEX8TimeSeries *series = XLALCreateCOMPLEX8TimeSeries("snr", &gstlal_snglinspiral->epoch, 0., gstlal_snglinspiral->deltaT, &lalDimensionlessUnit, gstlal_snglinspiral->V1_length);
if (!series)
{
Py_DECREF(item);
......@@ -591,11 +589,11 @@ static PyObject *from_buffer(PyObject *cls, PyObject *args)
return NULL;
}
memcpy(series->data->data, &(gstlal_snglinspiral->snr[gstlal_snglinspiral->H1_length + gstlal_snglinspiral->L1_length + gstlal_snglinspiral->V1_length]), K1_nbytes);
data += K1_nbytes;
((gstlal_GSTLALSnglInspiral*)item)->K1_snr = series;
memcpy(series->data->data, &(gstlal_snglinspiral->snr[gstlal_snglinspiral->H1_length + gstlal_snglinspiral->K1_length + gstlal_snglinspiral->L1_length]), V1_nbytes);
data += V1_nbytes;
((gstlal_GSTLALSnglInspiral*)item)->V1_snr = series;
} else
((gstlal_GSTLALSnglInspiral*)item)->K1_snr = NULL;
((gstlal_GSTLALSnglInspiral*)item)->V1_snr = NULL;
PyList_Append(result, item);
......@@ -615,71 +613,70 @@ static PyObject *from_buffer(PyObject *cls, PyObject *args)
}
static PyObject *_L1_snr_time_series_deleter(PyObject *self, PyObject *args)
static PyObject *_H1_snr_time_series_deleter(PyObject *self, PyObject *args)
{
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->L1_snr);
((gstlal_GSTLALSnglInspiral *) self)->L1_snr = NULL;
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->H1_snr);
((gstlal_GSTLALSnglInspiral *) self)->H1_snr = NULL;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *_H1_snr_time_series_deleter(PyObject *self, PyObject *args)
static PyObject *_K1_snr_time_series_deleter(PyObject *self, PyObject *args)
{
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->H1_snr);
((gstlal_GSTLALSnglInspiral *) self)->H1_snr = NULL;
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->K1_snr);
((gstlal_GSTLALSnglInspiral *) self)->K1_snr = NULL;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *_V1_snr_time_series_deleter(PyObject *self, PyObject *args)
static PyObject *_L1_snr_time_series_deleter(PyObject *self, PyObject *args)
{
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->V1_snr);
((gstlal_GSTLALSnglInspiral *) self)->V1_snr = NULL;
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->L1_snr);
((gstlal_GSTLALSnglInspiral *) self)->L1_snr = NULL;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *_K1_snr_time_series_deleter(PyObject *self, PyObject *args)
static PyObject *_V1_snr_time_series_deleter(PyObject *self, PyObject *args)
{
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->K1_snr);
((gstlal_GSTLALSnglInspiral *) self)->K1_snr = NULL;
XLALDestroyCOMPLEX8TimeSeries(((gstlal_GSTLALSnglInspiral *) self)->V1_snr);
((gstlal_GSTLALSnglInspiral *) self)->V1_snr = NULL;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *random_obj(PyObject *cls, PyObject *args)
{
gstlal_GSTLALSnglInspiral *new = (gstlal_GSTLALSnglInspiral *) __new__((PyTypeObject *) cls, NULL, NULL);
unsigned i;
new->L1_snr = XLALCreateCOMPLEX8TimeSeries("", &(LIGOTimeGPS) {0, 0}, 0., 1. / 16384, &lalDimensionlessUnit, 16384);
new->H1_snr = XLALCreateCOMPLEX8TimeSeries("", &(LIGOTimeGPS) {0, 0}, 0., 1. / 16384, &lalDimensionlessUnit, 16384);
new->V1_snr = XLALCreateCOMPLEX8TimeSeries("", &(LIGOTimeGPS) {0, 0}, 0., 1. / 16384, &lalDimensionlessUnit, 16384);
new->K1_snr = XLALCreateCOMPLEX8TimeSeries("", &(LIGOTimeGPS) {0, 0}, 0., 1. / 16384, &lalDimensionlessUnit, 16384);
for(i = 0; i < new->L1_snr->data->length; i++)
new->L1_snr->data->data[i] = 0.;
new->L1_snr = XLALCreateCOMPLEX8TimeSeries("", &(LIGOTimeGPS) {0, 0}, 0., 1. / 16384, &lalDimensionlessUnit, 16384);
new->V1_snr = XLALCreateCOMPLEX8TimeSeries("", &(LIGOTimeGPS) {0, 0}, 0., 1. / 16384, &lalDimensionlessUnit, 16384);
for(i = 0; i < new->H1_snr->data->length; i++)
new->H1_snr->data->data[i] = 0.;
for(i = 0; i < new->V1_snr->data->length; i++)
new->V1_snr->data->data[i] = 0.;
for(i = 0; i < new->K1_snr->data->length; i++)
new->K1_snr->data->data[i] = 0.;
for(i = 0; i < new->L1_snr->data->length; i++)
new->L1_snr->data->data[i] = 0.;
for(i = 0; i < new->V1_snr->data->length; i++)
new->V1_snr->data->data[i] = 0.;
return (PyObject *) new;
}
static struct PyMethodDef methods[] = {
{"from_buffer", from_buffer, METH_VARARGS | METH_CLASS, "Construct a tuple of GSTLALSnglInspiral objects from a buffer object. The buffer is interpreted as a C array of GSTLALSnglInspiral structures. All data is copied, the buffer can be deallocated afterwards."},
{"_L1_snr_time_series_deleter", _L1_snr_time_series_deleter, METH_NOARGS, "Release the L1 SNR time series attached to the GSTLALSnglInspiral object."},
{"_H1_snr_time_series_deleter", _H1_snr_time_series_deleter, METH_NOARGS, "Release the H1 SNR time series attached to the GSTLALSnglInspiral object."},
{"_V1_snr_time_series_deleter", _V1_snr_time_series_deleter, METH_NOARGS, "Release the V1 SNR time series attached to the GSTLALSnglInspiral object."},
{"_K1_snr_time_series_deleter", _K1_snr_time_series_deleter, METH_NOARGS, "Release the K1 SNR time series attached to the GSTLALSnglInspiral object."},
{"_L1_snr_time_series_deleter", _L1_snr_time_series_deleter, METH_NOARGS, "Release the L1 SNR time series attached to the GSTLALSnglInspiral object."},
{"_V1_snr_time_series_deleter", _V1_snr_time_series_deleter, METH_NOARGS, "Release the V1 SNR time series attached to the GSTLALSnglInspiral object."},
{"random", random_obj, METH_NOARGS | METH_CLASS, "Make a GSTLALSnglInspiral with an SNR time series attached to it for L1, H1, V1, and K1 to assist with writing test code."},
{NULL,}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment