diff --git a/gstlal-inspiral/gst/lal/gstlal_itacac.c b/gstlal-inspiral/gst/lal/gstlal_itacac.c index f9598420ebff15c682833604ec9c62d891beeb82..2fce39a28e3da7cb551e79e869f843043af076d3 100644 --- a/gstlal-inspiral/gst/lal/gstlal_itacac.c +++ b/gstlal-inspiral/gst/lal/gstlal_itacac.c @@ -510,7 +510,7 @@ static GstFlowReturn push_gap(GSTLALItacac *itacac, guint samps) { static GstFlowReturn final_setup(GSTLALItacac *itacac) { // FIXME Need to add logic to finish initializing GLists. Make sure to ensure there always at least two elements in the GList, even in the case of only having one sinkpad GstElement *element = GST_ELEMENT(itacac); - GList *padlist, *padlist2; + GList *padlist; GstFlowReturn result = GST_FLOW_OK; // Ensure all of the pads have the same channels and rate, and set them on itacac for easy access @@ -530,68 +530,23 @@ static GstFlowReturn final_setup(GSTLALItacac *itacac) { g_assert(itacac->difftime == itacacpad->difftime); g_assert(itacac->peak_type == itacacpad->peak_type); } + if(strcmp(itacacpad->instrument, "H1") == 0) + itacac->H1_itacacpad = itacacpad; + else if(strcmp(itacacpad->instrument, "K1") == 0) + itacac->K1_itacacpad = itacacpad; + else if(strcmp(itacacpad->instrument, "L1") == 0) + itacac->L1_itacacpad = itacacpad; + else if(strcmp(itacacpad->instrument, "V1") == 0) + itacac->V1_itacacpad = itacacpad; + else { + GST_ERROR_OBJECT(itacacpad, "pad has unknown detector, %s", itacacpad->instrument); + result = GST_FLOW_ERROR; + return result; + } } - // Set up the order that we want to check the pads for coincidence - // FIXME For now this is only being used to find snr time series - // FIXME Fow now this assumes <= 3 IFOs and the order will be L1H1V1 - // (so if you get a trigger in H1, first check L1 then V1; if you get a - // trigger in V1, first check L1 then H1), this should either be - // dynamically set or we should look for all coincidences, idk quit - // asking me questions - if(GST_ELEMENT(itacac)->numsinkpads > 1) { - for(padlist = GST_ELEMENT(itacac)->sinkpads; padlist != NULL; padlist = padlist->next) { - GSTLALItacacPad *itacacpad = GSTLAL_ITACAC_PAD(padlist->data); - for(padlist2=GST_ELEMENT(itacac)->sinkpads; padlist2 != NULL; padlist2 = padlist2->next) { - GSTLALItacacPad *itacacpad2 = GSTLAL_ITACAC_PAD(padlist2->data); - if(strcmp(itacacpad->instrument, itacacpad2->instrument) == 0) - continue; - else if(strcmp(itacacpad->instrument, "H1") == 0) { - if(strcmp(itacacpad2->instrument, "L1") == 0) { - if(itacacpad->next_in_coinc_order == NULL) - // list hasnt been set yet - itacacpad->next_in_coinc_order = g_list_append(itacacpad->next_in_coinc_order, itacacpad2); - else - // V1 was already added to list - itacacpad->next_in_coinc_order = g_list_prepend(itacacpad->next_in_coinc_order, itacacpad2); - } else - // we've got V1, which should go at the end of the list - itacacpad->next_in_coinc_order = g_list_append(itacacpad->next_in_coinc_order, itacacpad2); - } else if(strcmp(itacacpad->instrument, "L1") == 0) { - if(strcmp(itacacpad2->instrument, "H1") == 0) { - if(itacacpad->next_in_coinc_order == NULL) - // list hasnt been set yet - itacacpad->next_in_coinc_order = g_list_append(itacacpad->next_in_coinc_order, itacacpad2); - else - // V1 was already added to list - itacacpad->next_in_coinc_order = g_list_prepend(itacacpad->next_in_coinc_order, itacacpad2); - } else - // we've got V1, which should go at the end of the list - itacacpad->next_in_coinc_order = g_list_append(itacacpad->next_in_coinc_order, itacacpad2); - - } else if(strcmp(itacacpad->instrument, "V1") == 0) { - if(strcmp(itacacpad2->instrument, "L1") == 0) { - if(itacacpad->next_in_coinc_order == NULL) - // list hasnt been set yet - itacacpad->next_in_coinc_order = g_list_append(itacacpad->next_in_coinc_order, itacacpad2); - else - // H1 was already added to list - itacacpad->next_in_coinc_order = g_list_prepend(itacacpad->next_in_coinc_order, itacacpad2); - } else - // we've got H1, which should go at the end of the list - itacacpad->next_in_coinc_order = g_list_append(itacacpad->next_in_coinc_order, itacacpad2); - - } else { - GST_ERROR_OBJECT(GST_ELEMENT(itacac), "instrument %s not supported", itacacpad->instrument); - result = GST_FLOW_ERROR; - return result; - } - } - } - } - // The max size to copy from an adapter is the typical output size plus // the padding plus the largest coincidence window. we should never try // to copy from an adapter with a larger buffer than this. @@ -837,23 +792,79 @@ static void generate_triggers(GSTLALItacac *itacac, GSTLALItacacPad *itacacpad, } -static void populate_snr_in_other_detectors(GSTLALItacac *itacac, GSTLALItacacPad *itacacpad) { - GSTLALItacacPad *other_itacacpad; - GList *itacacpadlist; - guint channel, peak_sample, data_container_index, nongapsamps_duration, data_start_in_trigwindow, data_index, snr_index, series_start; +static void get_snr_series(GSTLALItacac *itacac, GSTLALItacacPad *itacacpad, guint channel, guint peak_sample) { + guint data_container_index, nongapsamps_duration, data_start_in_trigwindow, data_index, snr_index, series_start; gint trig_window_offset; - double complex *tmp_snr_mat_doubleptr; float complex *tmp_snr_mat_floatptr; - + for(data_container_index = 0; data_container_index < itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix->size1; data_container_index++) { + nongapsamps_duration = (guint) gsl_matrix_get(itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 0); - // First zero the tmp_snr_mat objects in the other pads - for(itacacpadlist = itacacpad->next_in_coinc_order; itacacpadlist != NULL; itacacpadlist = itacacpadlist->next) { - if(GSTLAL_ITACAC_PAD(itacacpadlist->data)->waiting) + // Check if we've looked at all of the available nongaps + if(nongapsamps_duration == 0) + break; + + // Get the start and stop sample indices for this set of nongaps + // data_index describes where to start in the block of nongaps we have + // data_start_in_trigwindow is how many samples came before the beginning of the data we care about in the current trigger window + // notice that data_index and data_start_in_trigwindow give locations of the *same* sample point, just using different metrics + // Thus if you subtract data_start_in_trigwindow from peak_sample, then add that to data_index, you'll find the location of your peak + data_index = (guint) gsl_matrix_get(itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 1); + trig_window_offset = (gint) gsl_matrix_get(itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 2); + + data_index += itacacpad->maxdata->pad; + + if(trig_window_offset < 0) + data_start_in_trigwindow = itacacpad->maxdata->pad - (guint) abs(trig_window_offset); + else + data_start_in_trigwindow = (guint) trig_window_offset + itacacpad->maxdata->pad; + + // Check if the samples we care about are in this set of nongaps + // FIXME Can get time series out more often if we zero pad whatever existing time series when its not long enough + if(peak_sample < data_start_in_trigwindow) + break; + if(peak_sample >= data_start_in_trigwindow + (guint) gsl_matrix_get(itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 3)) continue; - memset(GSTLAL_ITACAC_PAD(itacacpadlist->data)->tmp_snr_mat, 0, autocorrelation_channels(itacacpad) * autocorrelation_length(itacacpad) * itacacpad->maxdata->unit); + + // notice that data_index and data_start_in_trigwindow give locations of the *same* sample point, just using different metrics + // Thus if you subtract data_start_in_trigwindow from peak_sample, then add that to data_index, you'll find the location of your peak + series_start = data_index + (peak_sample - data_start_in_trigwindow) - itacacpad->maxdata->pad; + + // find snr time series + // FIXME Should the gstlal*series_around_peak functions be generalized so that they can do this? + if (itacac->peak_type == GSTLAL_PEAK_DOUBLE_COMPLEX) { + tmp_snr_mat_doubleptr = (double complex *) itacacpad->tmp_snr_mat; + } else if (itacac->peak_type == GSTLAL_PEAK_COMPLEX) { + tmp_snr_mat_floatptr = (float complex *) itacacpad->tmp_snr_mat; + } + + for(snr_index = 0; snr_index < 2*itacacpad->maxdata->pad + 1; snr_index++) { + + if (itacac->peak_type == GSTLAL_PEAK_DOUBLE_COMPLEX) + tmp_snr_mat_doubleptr[snr_index * itacacpad->maxdata->channels + channel] = *(((double complex *) itacacpad->data->data) + (series_start + snr_index) * itacacpad->maxdata->channels + channel); + + else if (itacac->peak_type == GSTLAL_PEAK_COMPLEX) + tmp_snr_mat_floatptr[snr_index * itacacpad->maxdata->channels + channel] = *(((float complex *) itacacpad->data->data) + (series_start + snr_index) * itacacpad->maxdata->channels + channel); + } + + // If we reached this point, we have what we need + break; } +} + +static void populate_snr_in_other_detectors(GSTLALItacac *itacac, GSTLALItacacPad *itacacpad) { + guint channel, peak_sample; + + // First zero the tmp_snr_mat objects in the other pads + if(strcmp(itacacpad->instrument, "H1") != 0 && itacac->H1_itacacpad != NULL && !itacac->H1_itacacpad->waiting) + memset(itacac->H1_itacacpad->tmp_snr_mat, 0, autocorrelation_channels(itacacpad) * autocorrelation_length(itacacpad) * itacacpad->maxdata->unit); + if(strcmp(itacacpad->instrument, "K1") != 0 && itacac->K1_itacacpad != NULL && !itacac->K1_itacacpad->waiting) + memset(itacac->K1_itacacpad->tmp_snr_mat, 0, autocorrelation_channels(itacacpad) * autocorrelation_length(itacacpad) * itacacpad->maxdata->unit); + if(strcmp(itacacpad->instrument, "L1") != 0 && itacac->L1_itacacpad != NULL && !itacac->L1_itacacpad->waiting) + memset(itacac->L1_itacacpad->tmp_snr_mat, 0, autocorrelation_channels(itacacpad) * autocorrelation_length(itacacpad) * itacacpad->maxdata->unit); + if(strcmp(itacacpad->instrument, "V1") != 0 && itacac->V1_itacacpad != NULL && !itacac->V1_itacacpad->waiting) + memset(itacac->V1_itacacpad->tmp_snr_mat, 0, autocorrelation_channels(itacacpad) * autocorrelation_length(itacacpad) * itacacpad->maxdata->unit); for(channel = 0; channel < itacacpad->maxdata->channels; channel++) { // Identify which sample was the peak @@ -870,191 +881,40 @@ static void populate_snr_in_other_detectors(GSTLALItacac *itacac, GSTLALItacacPa } peak_sample = itacacpad->maxdata->samples[channel]; + if(strcmp(itacacpad->instrument, "H1") != 0 && itacac->H1_itacacpad != NULL && !itacac->H1_itacacpad->waiting) + get_snr_series(itacac, itacac->H1_itacacpad, channel, peak_sample); + if(strcmp(itacacpad->instrument, "K1") != 0 && itacac->K1_itacacpad != NULL && !itacac->K1_itacacpad->waiting) + get_snr_series(itacac, itacac->K1_itacacpad, channel, peak_sample); + if(strcmp(itacacpad->instrument, "L1") != 0 && itacac->L1_itacacpad != NULL && !itacac->L1_itacacpad->waiting) + get_snr_series(itacac, itacac->L1_itacacpad, channel, peak_sample); + if(strcmp(itacacpad->instrument, "V1") != 0 && itacac->V1_itacacpad != NULL && !itacac->V1_itacacpad->waiting) + get_snr_series(itacac, itacac->V1_itacacpad, channel, peak_sample); - for(itacacpadlist = itacacpad->next_in_coinc_order; itacacpadlist != NULL; itacacpadlist = itacacpadlist->next) { - other_itacacpad = GSTLAL_ITACAC_PAD(itacacpadlist->data); - if(other_itacacpad->waiting) - continue; - - for(data_container_index = 0; data_container_index < other_itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix->size1; data_container_index++) { - nongapsamps_duration = (guint) gsl_matrix_get(other_itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 0); - - // Check if we've looked at all of the available nongaps - if(nongapsamps_duration == 0) - break; - - // Get the start and stop sample indices for this set of nongaps - // data_index describes where to start in the block of nongaps we have - // data_start_in_trigwindow is how many samples came before the beginning of the data we care about in the current trigger window - // notice that data_index and data_start_in_trigwindow give locations of the *same* sample point, just using different metrics - // Thus if you subtract data_start_in_trigwindow from peak_sample, then add that to data_index, you'll find the location of your peak - data_index = (guint) gsl_matrix_get(other_itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 1); - trig_window_offset = (gint) gsl_matrix_get(other_itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 2); - - data_index += other_itacacpad->maxdata->pad; - - if(trig_window_offset < 0) - data_start_in_trigwindow = other_itacacpad->maxdata->pad - (guint) abs(trig_window_offset); - else - data_start_in_trigwindow = (guint) trig_window_offset + other_itacacpad->maxdata->pad; - - - // Check if the samples we care about are in this set of nongaps - // FIXME Can get time series out more often if we zero pad whatever existing time series when its not long enough - if(peak_sample < data_start_in_trigwindow) - break; - if(peak_sample >= data_start_in_trigwindow + (guint) gsl_matrix_get(other_itacacpad->data->duration_dataoffset_trigwindowoffset_peakfindinglength_matrix, data_container_index, 3)) - continue; - - // notice that data_index and data_start_in_trigwindow give locations of the *same* sample point, just using different metrics - // Thus if you subtract data_start_in_trigwindow from peak_sample, then add that to data_index, you'll find the location of your peak - series_start = data_index + (peak_sample - data_start_in_trigwindow) - other_itacacpad->maxdata->pad; - - // find snr time series - // FIXME Should the gstlal*series_around_peak functions be generalized so that they can do this? - if (itacac->peak_type == GSTLAL_PEAK_DOUBLE_COMPLEX) { - tmp_snr_mat_doubleptr = (double complex *) other_itacacpad->tmp_snr_mat; - } else if (itacac->peak_type == GSTLAL_PEAK_COMPLEX) { - tmp_snr_mat_floatptr = (float complex *) other_itacacpad->tmp_snr_mat; - } - - for(snr_index = 0; snr_index < 2*other_itacacpad->maxdata->pad + 1; snr_index++) { - - if (itacac->peak_type == GSTLAL_PEAK_DOUBLE_COMPLEX) - tmp_snr_mat_doubleptr[snr_index * other_itacacpad->maxdata->channels + channel] = *(((double complex *) other_itacacpad->data->data) + (series_start + snr_index) * other_itacacpad->maxdata->channels + channel); - - else if (itacac->peak_type == GSTLAL_PEAK_COMPLEX) - tmp_snr_mat_floatptr[snr_index * other_itacacpad->maxdata->channels + channel] = *(((float complex *) other_itacacpad->data->data) + (series_start + snr_index) * other_itacacpad->maxdata->channels + channel); - } - - // If we reached this point, we have what we need - break; - } - } } - } -static GstBuffer* hardcoded_srcbuf_crap(GSTLALItacac *itacac, GSTLALItacacPad *itacacpad, GstBuffer *srcbuf) { - // FIXME This currently assumes <= 3 IFOs, and assumes that the list goes L1H1V1 if ordered by sensitivity - // FIXME Delete this entire function one day - if(strcmp(itacacpad->instrument, "L1") == 0) { - // - // L1H1V1 - // - if(GST_ELEMENT(itacac)->numsinkpads == 3) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->next->data)->tmp_snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->next->data)->tmp_snr_matrix_view), NULL); - } - // - // L1H1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 2 && strcmp(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->instrument, "H1") == 0) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL, NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL, NULL); - } - // - // L1V1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 2 && strcmp(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->instrument, "V1") == 0) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), NULL, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), NULL, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL); - } - // - // L1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 1) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), NULL, NULL, NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacacpad->snr_matrix_view), NULL, NULL, NULL); - } - } - - } else if(strcmp(itacacpad->instrument, "H1") == 0) { - // - // L1H1V1 - // - if(GST_ELEMENT(itacac)->numsinkpads == 3) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->next->data)->tmp_snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->next->data)->tmp_snr_matrix_view), NULL); - } - // - // L1H1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 2 && strcmp(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->instrument, "L1") == 0) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), NULL, NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), NULL, NULL); - } - // - // H1V1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 2 && strcmp(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->instrument, "V1") == 0) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, &(itacacpad->snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL); - } - // - // H1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 1) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, &(itacacpad->snr_matrix_view), NULL, NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, &(itacacpad->snr_matrix_view), NULL, NULL); - } - } +static GstBuffer* assemble_srcbuf(GSTLALItacac *itacac, GSTLALItacacPad *itacacpad, GstBuffer *srcbuf) { + if(strcmp(itacacpad->instrument, "H1") == 0) { + if(srcbuf == NULL) + srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacac->H1_itacacpad->snr_matrix_view), itacac->K1_itacacpad != NULL ? &(itacac->K1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->L1_itacacpad != NULL ? &(itacac->L1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->V1_itacacpad != NULL ? &(itacac->V1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->difftime); + else + gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(itacac->H1_itacacpad->snr_matrix_view), itacac->K1_itacacpad != NULL ? &(itacac->K1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->L1_itacacpad != NULL ? &(itacac->L1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->V1_itacacpad != NULL ? &(itacac->V1_itacacpad->tmp_snr_matrix_view) : NULL); + } else if(strcmp(itacacpad->instrument, "K1") == 0) { + if(srcbuf == NULL) + srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, itacac->H1_itacacpad != NULL ? &(itacac->H1_itacacpad->tmp_snr_matrix_view) : NULL, &(itacac->K1_itacacpad->snr_matrix_view), itacac->L1_itacacpad != NULL ? &(itacac->L1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->V1_itacacpad != NULL ? &(itacac->V1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->difftime); + else + gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, itacac->H1_itacacpad != NULL ? &(itacac->H1_itacacpad->tmp_snr_matrix_view) : NULL, &(itacac->K1_itacacpad->snr_matrix_view), itacac->L1_itacacpad != NULL ? &(itacac->L1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->V1_itacacpad != NULL ? &(itacac->V1_itacacpad->tmp_snr_matrix_view) : NULL); + } else if(strcmp(itacacpad->instrument, "L1") == 0) { + if(srcbuf == NULL) + srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, itacac->H1_itacacpad != NULL ? &(itacac->H1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->K1_itacacpad != NULL ? &(itacac->K1_itacacpad->tmp_snr_matrix_view) : NULL, &(itacac->L1_itacacpad->snr_matrix_view), itacac->V1_itacacpad != NULL ? &(itacac->V1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->difftime); + else + gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, itacac->H1_itacacpad != NULL ? &(itacac->H1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->K1_itacacpad != NULL ? &(itacac->K1_itacacpad->tmp_snr_matrix_view) : NULL, &(itacac->L1_itacacpad->snr_matrix_view), itacac->V1_itacacpad != NULL ? &(itacac->V1_itacacpad->tmp_snr_matrix_view) : NULL); } else if(strcmp(itacacpad->instrument, "V1") == 0) { - // - // L1H1V1 - // - if(GST_ELEMENT(itacac)->numsinkpads == 3) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->next->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->next->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), NULL); - } - // - // L1V1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 2 && strcmp(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->instrument, "L1") == 0) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL, &(itacacpad->snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), NULL, &(itacacpad->snr_matrix_view), NULL); - } - // - // H1V1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 2 && strcmp(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->instrument, "H1") == 0) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, &(GSTLAL_ITACAC_PAD(itacacpad->next_in_coinc_order->data)->tmp_snr_matrix_view), &(itacacpad->snr_matrix_view), NULL); - } - // - // V1 - // - } else if(GST_ELEMENT(itacac)->numsinkpads == 1) { - if(srcbuf == NULL) { - srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, NULL, &(itacacpad->snr_matrix_view), NULL, itacac->difftime); - } else { - gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, NULL, &(itacacpad->snr_matrix_view), NULL); - } - } + if(srcbuf == NULL) + srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, itacac->H1_itacacpad != NULL ? &(itacac->H1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->K1_itacacpad != NULL ? &(itacac->K1_itacacpad->tmp_snr_matrix_view) : NULL, &itacac->L1_itacacpad != NULL ? &(itacac->L1_itacacpad->tmp_snr_matrix_view) : NULL, &(itacac->V1_itacacpad->snr_matrix_view), itacac->difftime); + else + gstlal_snglinspiral_append_peak_to_buffer(srcbuf, itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, itacac->H1_itacacpad != NULL ? &(itacac->H1_itacacpad->tmp_snr_matrix_view) : NULL, itacac->K1_itacacpad != NULL ? &(itacac->K1_itacacpad->tmp_snr_matrix_view) : NULL, &itacac->L1_itacacpad != NULL ? &(itacac->L1_itacacpad->tmp_snr_matrix_view) : NULL, &(itacac->V1_itacacpad->snr_matrix_view) ); } - return srcbuf; } @@ -1221,7 +1081,7 @@ static GstFlowReturn process(GSTLALItacac *itacac) { } if(triggers_generated && itacacpad->autocorrelation_matrix) { - srcbuf = hardcoded_srcbuf_crap(itacac, itacacpad, srcbuf); + srcbuf = assemble_srcbuf(itacac, itacacpad, srcbuf); } else if(triggers_generated) { if(srcbuf == NULL) { srcbuf = gstlal_snglinspiral_new_buffer_from_peak(itacacpad->maxdata, itacacpad->bankarray, GST_PAD((itacac->aggregator).srcpad), itacac->next_output_offset, itacacpad->n, itacac->next_output_timestamp, itacac->rate, itacacpad->chi2, NULL, NULL, NULL, NULL, itacac->difftime); @@ -1283,6 +1143,8 @@ static GstFlowReturn aggregate(GstAggregator *aggregator, gboolean timeout) // Calculate the coincidence windows and make sure the pads caps are compatible with each other if we're just starting if(itacac->rate == 0) { result = final_setup(itacac); + if(result == GST_FLOW_ERROR) + return result; } if(itacac->EOS) { @@ -1505,9 +1367,6 @@ static void gstlal_itacac_pad_dispose(GObject *object) itacacpad->chi2 = NULL; itacacpad->tmp_chi2 = NULL; - g_list_free(itacacpad->next_in_coinc_order); - itacacpad->next_in_coinc_order = NULL; - G_OBJECT_CLASS(gstlal_itacac_pad_parent_class)->dispose(object); } @@ -1737,5 +1596,9 @@ static void gstlal_itacac_init(GSTLALItacac *itacac) itacac->EOS = FALSE; itacac->waiting = TRUE; + itacac->H1_itacacpad = NULL; + itacac->K1_itacacpad = NULL; + itacac->L1_itacacpad = NULL; + itacac->V1_itacacpad = NULL; } diff --git a/gstlal-inspiral/gst/lal/gstlal_itacac.h b/gstlal-inspiral/gst/lal/gstlal_itacac.h index 824d9061832580a50fcc23f60f926679ae70a519..8273bc965cad24e96b7790102de0a19ac46df297 100644 --- a/gstlal-inspiral/gst/lal/gstlal_itacac.h +++ b/gstlal-inspiral/gst/lal/gstlal_itacac.h @@ -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; diff --git a/gstlal-inspiral/lib/gstlal_snglinspiral.c b/gstlal-inspiral/lib/gstlal_snglinspiral.c index b415397f086f6a2ee310362db9a641d89f600b9a..ff852a66b76997edf0073ef527472dbde2544d34 100644 --- a/gstlal-inspiral/lib/gstlal_snglinspiral.c +++ b/gstlal-inspiral/lib/gstlal_snglinspiral.c @@ -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 diff --git a/gstlal-inspiral/lib/gstlal_snglinspiral.h b/gstlal-inspiral/lib/gstlal_snglinspiral.h index 6254c8913341cc80bfd6e00d9ed2035840e50127..3471239480a23fcf8f2fe2e1fd6b31d52556f1fe 100644 --- a/gstlal-inspiral/lib/gstlal_snglinspiral.h +++ b/gstlal-inspiral/lib/gstlal_snglinspiral.h @@ -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 diff --git a/gstlal-inspiral/lib/snglinspiralrowtype.c b/gstlal-inspiral/lib/snglinspiralrowtype.c index 7f7bb1fe37b184108f9faafda77db462c327d892..5b002a9c28064fc226623687b79a66923990bbc0 100644 --- a/gstlal-inspiral/lib/snglinspiralrowtype.c +++ b/gstlal-inspiral/lib/snglinspiralrowtype.c @@ -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; } diff --git a/gstlal-inspiral/lib/snglinspiralrowtype.h b/gstlal-inspiral/lib/snglinspiralrowtype.h index 54a251db9d849eb1168d6b55c387d0f07f7a48a7..cc53a406a70ab4fd866d4ae9b83309ab66cf4020 100644 --- a/gstlal-inspiral/lib/snglinspiralrowtype.h +++ b/gstlal-inspiral/lib/snglinspiralrowtype.h @@ -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); diff --git a/gstlal-inspiral/python/snglinspiraltable.c b/gstlal-inspiral/python/snglinspiraltable.c index 8748fea444c328e7d6df9ce36a84da60569ba457..e5621810041f779f88f716b6ed90419d56dd8060 100644 --- a/gstlal-inspiral/python/snglinspiraltable.c +++ b/gstlal-inspiral/python/snglinspiraltable.c @@ -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,} };