Commit 7b6100e6 authored by Cody Messick's avatar Cody Messick

All of the changes necessary to build and run itacac instead of itac. Note...

All of the changes necessary to build and run itacac instead of itac. Note that itac will no longer work after this commit
parent 6c6ab4c7
......@@ -843,7 +843,8 @@ for output_file_number, (svd_bank_url_dict, output_url, ranking_stat_output_url,
if options.verbose:
print >>sys.stderr, "attaching appsinks to pipeline ...",
appsync = pipeparts.AppSync(appsink_new_buffer = handler.appsink_new_buffer)
appsinks = set(appsync.add_sink(pipeline, src, caps = Gst.Caps.from_string("application/x-lal-snglinspiral"), name = "%s_sink_%d" % (instrument, n)) for instrument, srcs in triggersrc.items() for n, src in enumerate(srcs))
appsinks = set(appsync.add_sink(pipeline, src, caps = Gst.Caps.from_string("application/x-lal-snglinspiral"), name = "bank_%s_sink" % bank_id) for bank_id, src in triggersrc.items())
if options.verbose:
print >>sys.stderr, "attached %d, done" % len(appsinks)
......
......@@ -4,7 +4,7 @@ plugin_LTLIBRARIES = lib@GSTPLUGINPREFIX@gstlalinspiral.la
lib@GSTPLUGINPREFIX@gstlalinspiral_la_SOURCES = \
gstlalinspiral.c \
gstlal_itac.h gstlal_itac.c
gstlal_itacac.h gstlal_itacac.c
#gstlal_triggergen.h gstlal_triggergen.c
#gstlal_blcbc_triggergen.h gstlal_blcbc_triggergen.c \
#gstlal_coinc.h gstlal_coinc.c \
......
......@@ -50,14 +50,15 @@
#include <gstlal/gstlal_tags.h>
#include <gstlal_itacac.h>
/*
#include <gstlal_coinc.h>
#include <gstlal_skymap.h>
#include <gstlal_triggergen.h>
#include <gstlal_timeslicechisq.h>
#include <gstlal_blcbc_triggergen.h>
*/
#include <gstlal_itac.h>
*/
/*
......@@ -79,8 +80,9 @@ static gboolean plugin_init(GstPlugin *plugin)
{"lal_skymap", GSTLAL_SKYMAP_TYPE},
{"lal_triggergen", GSTLAL_TRIGGERGEN_TYPE},
{"lal_timeslicechisq", GSTLAL_TIMESLICECHISQUARE_TYPE},
{"lal_blcbctriggergen", GSTLAL_BLCBC_TRIGGERGEN_TYPE},*/
{"lal_itac", GSTLAL_ITAC_TYPE},
{"lal_blcbctriggergen", GSTLAL_BLCBC_TRIGGERGEN_TYPE},
{"lal_itac", GSTLAL_ITAC_TYPE}, */
{"lal_itacac", GSTLAL_ITACAC_TYPE},
{NULL, 0},
};
......
This diff is collapsed.
......@@ -47,10 +47,13 @@ int gstlal_set_instrument_in_snglinspiral_array(SnglInspiralTable *bankarray, in
int gstlal_set_sigmasq_in_snglinspiral_array(SnglInspiralTable *bankarray, int length, double *sigmasq);
int gstlal_set_min_offset_in_snglinspiral_array(SnglInspiralTable *bankarray, int length, GstClockTimeDiff *difftime);
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 *snr_matrix_view, GstClockTimeDiff);
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 L1, 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);
G_END_DECLS
......
......@@ -37,6 +37,7 @@
#include <snglinspiralrowtype.h>
/**
* Allocate a new struct GSTLALSnglInspiral
*
......@@ -44,11 +45,16 @@
*/
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t length)
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t H1_length, size_t L1_length, size_t V1_length, size_t K1_length)
{
struct GSTLALSnglInspiral *row = calloc(1, sizeof(*row) + length * sizeof(row->snr[0]));
if (row)
row->length = length;
struct GSTLALSnglInspiral *row = calloc(1, sizeof(*row) + (H1_length + L1_length + V1_length + K1_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;
}
return row;
}
......
......@@ -56,12 +56,15 @@ struct GSTLALSnglInspiral {
SnglInspiralTable parent;
LIGOTimeGPS epoch;
double deltaT;
size_t length;
size_t L1_length;
size_t H1_length;
size_t V1_length;
size_t K1_length;
float complex snr[];
};
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t length);
struct GSTLALSnglInspiral *gstlal_snglinspiral_new(size_t L1_length, size_t H1_length, size_t V1_length, size_t K1_length);
void gstlal_snglinspiral_free(struct GSTLALSnglInspiral *row);
......
......@@ -555,6 +555,7 @@ class GracedBWrapper(object):
if self.verbose:
print >>sys.stderr, "sending %s to gracedb ..." % filename
print >>sys.stderr, "sending %s to gracedb ..." % filename
message = StringIO.StringIO()
xmldoc = last_coincs[coinc_event.coinc_event_id]
# give the alert all the standard inspiral
......@@ -568,13 +569,19 @@ class GracedBWrapper(object):
# already has it
pass
# add SNR time series if available
# FIXME Probably only want one time series for each ifo
for event in last_coincs.sngl_inspirals(coinc_event.coinc_event_id):
snr_time_series = event.snr_time_series
if snr_time_series is not None:
xmldoc.childNodes[-1].appendChild(lalseries.build_COMPLEX8TimeSeries(snr_time_series)).appendChild(ligolw_param.Param.from_pyvalue(u"event_id", event.event_id))
for ifo in ("H1", "L1", "V1", "K1"):
snr_time_series = getattr(event, "%s_snr_time_series" % ifo)
if snr_time_series is not None:
snr_time_series_element = lalseries.build_COMPLEX8TimeSeries(snr_time_series)
snr_time_series_element.appendChild(ligolw_param.Param.from_pyvalue(u"event_id", event.event_id))
snr_time_series_element.appendChild(ligolw_param.Param.from_pyvalue(u"ifo", ifo))
xmldoc.childNodes[-1].appendChild(snr_time_series_element)
# translate IDs from integers to ilwd:char for
# backwards compatibility
ilwdify.do_it_to(xmldoc)
# serialize to XML
ligolw_utils.write_fileobj(xmldoc, message, gz = False)
xmldoc.unlink()
......
......@@ -950,7 +950,7 @@ class Handler(simplehandler.Handler):
memory.unmap(mapinfo)
# FIXME: ugly way to get the instrument
instrument = elem.get_name().split("_", 1)[0]
instruments = set([event.ifo for event in events])
# extract segment. move the segment's upper
# boundary to include all triggers. ARGH the 1 ns
......@@ -958,10 +958,7 @@ class Handler(simplehandler.Handler):
# "in" the segment (segments are open from above)
# FIXME: is there another way?
buf_timestamp = LIGOTimeGPS(0, buf.pts)
if events:
buf_seg = segments.segment(buf_timestamp, max(buf_timestamp + LIGOTimeGPS(0, buf.duration), max(event.end for event in events) + 0.000000001))
else:
buf_seg = segments.segment(buf_timestamp, buf_timestamp + LIGOTimeGPS(0, buf.duration))
buf_seg = dict((instrument, segments.segment(buf_timestamp, max(buf_timestamp + LIGOTimeGPS(0, buf.duration), max(event.end for event in events if event.ifo == instrument) + 0.000000001))) for instrument in instruments)
buf_is_gap = bool(buf.mini_object.flags & Gst.BufferFlags.GAP)
# sanity check that gap buffers are empty
assert not (buf_is_gap and events)
......@@ -1062,12 +1059,35 @@ class Handler(simplehandler.Handler):
# is aware of this buffer.
if not buf_is_gap:
snr_min = self.rankingstat.snr_min
self.rankingstat.denominator.triggerrates[instrument].add_ratebin(map(float, buf_seg), len([event for event in events if event.snr >= snr_min]))
for instrument in instruments:
# FIXME At the moment, empty triggers are added to
# inform the "how many instruments were on test", the
# correct thing to do is probably to add metadata to
# the buffer containing information about which
# instruments were on
self.rankingstat.denominator.triggerrates[instrument].add_ratebin(map(float, buf_seg[instrument]), len([event for event in events if event.snr >= snr_min and event.ifo == instrument]))
# FIXME At the moment, empty triggers are added to
# inform the "how many instruments were on test", the
# correct thing to do is probably to add metadata to
# the buffer containing information about which
# instruments were on
real_events = []
for event in events:
if event.snr >= snr_min:
real_events.append(event)
events = real_events
# run stream thinca.
for absent_instrument in self.absent_instruments:
self.stream_thinca.push(absent_instrument, (), buf_timestamp)
if self.stream_thinca.push(instrument, events, buf_timestamp):
for instrument in self.rankingstat.instruments:
if instrument in instruments or instrument in self.absent_instruments:
continue
self.stream_thinca.push(instrument, (), buf_timestamp)
if any([self.stream_thinca.push(instrument, [event for event in events if event.ifo == instrument], buf_timestamp) for instrument in instruments]):
flushed_sngls = self.stream_thinca.pull(self.rankingstat, fapfar = self.fapfar, zerolag_rankingstatpdf = self.zerolag_rankingstatpdf, coinc_sieve = self.rankingstat.fast_path_cut_from_triggers, cluster = self.cluster)
self.coincs_document.commit()
......@@ -1080,7 +1100,10 @@ class Handler(simplehandler.Handler):
# that are too old to be used to form
# candidates.
for event in flushed_sngls:
del event.snr_time_series
del event.H1_snr_time_series
del event.L1_snr_time_series
del event.V1_snr_time_series
del event.K1_snr_time_series
def _record_horizon_distance(self, instrument, timestamp, horizon_distance):
......@@ -1274,7 +1297,10 @@ class Handler(simplehandler.Handler):
# for the triggers that are too old to be used to form
# candidates.
for event in flushed_sngls:
del event.snr_time_series
del event.H1_snr_time_series
del event.L1_snr_time_series
del event.V1_snr_time_series
del event.K1_snr_time_series
def __do_gracedb_alerts(self, last_coincs):
......
......@@ -81,6 +81,7 @@ from glue import iterutils
from gstlal import datasource
from gstlal import multirate_datasource
from gstlal import pipeparts
from gstlal import pipeio
#
......@@ -656,8 +657,8 @@ def mkLLOIDmulti(pipeline, detectors, banks, psd, psd_fft_length = 32, ht_gate_t
# construct trigger generators
#
triggersrcs = dict((instrument, set()) for instrument in hoftdicts)
for instrument, bank in [(instrument, bank) for instrument, banklist in banks.items() for bank in banklist]:
itacac_dict = {}
for i, (instrument, bank) in enumerate([(instrument, bank) for instrument, banklist in banks.items() for bank in banklist]):
suffix = "%s%s" % (instrument, (bank.logname and "_%s" % bank.logname or ""))
if control_branch is not None:
if instrument != "H2":
......@@ -695,10 +696,19 @@ def mkLLOIDmulti(pipeline, detectors, banks, psd, psd_fft_length = 32, ht_gate_t
# but 4 is about the lowest we can do stably for
# coincidence online...
nsamps_window = max(max(bank.get_rates()) / 4, 256) # FIXME stupid hack
head = pipeparts.mkitac(pipeline, snr, nsamps_window, bank.template_bank_filename, autocorrelation_matrix = bank.autocorrelation_bank, mask_matrix = bank.autocorrelation_mask, snr_thresh = 4.0, sigmasq = bank.sigmasq)
if verbose:
head = pipeparts.mkprogressreport(pipeline, head, "progress_xml_%s" % suffix)
triggersrcs[instrument].add(head)
if bank.bank_id not in itacac_dict:
itacac_dict[bank.bank_id] = pipeparts.mkgeneric(pipeline, None, "lal_itacac")
head = itacac_dict[bank.bank_id]
pad = head.get_request_pad("sink%d" % len(head.sinkpads))
if instrument == 'H1' or instrument == 'L1':
for prop, val in [("n", nsamps_window), ("snr-thresh", 4.0), ("bank_filename", bank.template_bank_filename), ("sigmasq", bank.sigmasq), ("autocorrelation_matrix", pipeio.repack_complex_array_to_real(bank.autocorrelation_bank)), ("autocorrelation_mask", bank.autocorrelation_mask)]:
pad.set_property(prop, val)
snr.srcpads[0].link(pad)
else:
for prop, val in [("n", nsamps_window), ("snr-thresh", 4.0), ("bank_filename", bank.template_bank_filename), ("sigmasq", bank.sigmasq), ("autocorrelation_matrix", pipeio.repack_complex_array_to_real(bank.autocorrelation_bank)), ("autocorrelation_mask", bank.autocorrelation_mask)]:
pad.set_property(prop, val)
snr.srcpads[0].link(pad)
else:
raise NotImplementedError("Currently only 'autochisq' is supported")
# FIXME: find a way to use less memory without this hack
......@@ -710,5 +720,8 @@ def mkLLOIDmulti(pipeline, detectors, banks, psd, psd_fft_length = 32, ht_gate_t
# done
#
assert any(triggersrcs.values())
return triggersrcs
assert any(itacac_dict.values())
if verbose:
for bank_id, head in itacac_dict.items():
itacac_dict[bank_id] = pipeparts.mkprogressreport(pipeline, head, "progress_xml_bank_%s" % bank_id)
return itacac_dict
This diff is collapsed.
......@@ -30,20 +30,20 @@ class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral):
spin2 = lsctables.SnglInspiral.spin2
@property
def snr_time_series(self):
def H1_snr_time_series(self):
try:
name = self._snr_name
name = self._H1_snr_name
except ValueError:
# C interface raises ValueError if the internal snr
# pointer is NULL
return None
series = lal.CreateCOMPLEX8TimeSeries(
name,
lal.LIGOTimeGPS(self._snr_epoch_gpsSeconds, self._snr_epoch_gpsNanoSeconds),
self._snr_f0,
self._snr_deltaT,
lal.Unit(self._snr_sampleUnits),
self._snr_data_length
lal.LIGOTimeGPS(self._H1_snr_epoch_gpsSeconds, self._H1_snr_epoch_gpsNanoSeconds),
self._H1_snr_f0,
self._H1_snr_deltaT,
lal.Unit(self._H1_snr_sampleUnits),
self._H1_snr_data_length
)
# we want to be able to keep the table row object in memory
# for an extended period of time so we need to be able to
......@@ -53,9 +53,102 @@ class GSTLALSnglInspiral(_snglinspiraltable.GSTLALSnglInspiral):
# allowed references to the original memory to leak out
# into Python land we could never know if it's safe to free
# it
series.data.data[:] = self._snr_data
series.data.data[:] = self._H1_snr_data
return series
@snr_time_series.deleter
def snr_time_series(self):
self._snr_time_series_deleter()
@property
def L1_snr_time_series(self):
try:
name = self._L1_snr_name
except ValueError:
# C interface raises ValueError if the internal snr
# pointer is NULL
return None
series = lal.CreateCOMPLEX8TimeSeries(
name,
lal.LIGOTimeGPS(self._L1_snr_epoch_gpsSeconds, self._L1_snr_epoch_gpsNanoSeconds),
self._L1_snr_f0,
self._L1_snr_deltaT,
lal.Unit(self._L1_snr_sampleUnits),
self._L1_snr_data_length
)
# we want to be able to keep the table row object in memory
# for an extended period of time so we need to be able to
# release the memory used by the SNR time series when we no
# longer need it, and so we copy the data here instead of
# holding a reference to the original memory. if we
# allowed references to the original memory to leak out
# into Python land we could never know if it's safe to free
# it
series.data.data[:] = self._L1_snr_data
return series
@property
def V1_snr_time_series(self):
try:
name = self._V1_snr_name
except ValueError:
# C interface raises ValueError if the internal snr
# pointer is NULL
return None
series = lal.CreateCOMPLEX8TimeSeries(
name,
lal.LIGOTimeGPS(self._V1_snr_epoch_gpsSeconds, self._V1_snr_epoch_gpsNanoSeconds),
self._V1_snr_f0,
self._V1_snr_deltaT,
lal.Unit(self._V1_snr_sampleUnits),
self._V1_snr_data_length
)
# we want to be able to keep the table row object in memory
# for an extended period of time so we need to be able to
# release the memory used by the SNR time series when we no
# longer need it, and so we copy the data here instead of
# holding a reference to the original memory. if we
# allowed references to the original memory to leak out
# into Python land we could never know if it's safe to free
# it
series.data.data[:] = self._V1_snr_data
return series
@property
def K1_snr_time_series(self):
try:
name = self._K1_snr_name
except ValueError:
# C interface raises ValueError if the internal snr
# pointer is NULL
return None
series = lal.CreateCOMPLEX8TimeSeries(
name,
lal.LIGOTimeGPS(self._K1_snr_epoch_gpsSeconds, self._K1_snr_epoch_gpsNanoSeconds),
self._K1_snr_f0,
self._K1_snr_deltaT,
lal.Unit(self._K1_snr_sampleUnits),
self._K1_snr_data_length
)
# we want to be able to keep the table row object in memory
# for an extended period of time so we need to be able to
# release the memory used by the SNR time series when we no
# longer need it, and so we copy the data here instead of
# holding a reference to the original memory. if we
# allowed references to the original memory to leak out
# into Python land we could never know if it's safe to free
# it
series.data.data[:] = self._K1_snr_data
return series
@H1_snr_time_series.deleter
def H1_snr_time_series(self):
self._H1_snr_time_series_deleter()
@L1_snr_time_series.deleter
def L1_snr_time_series(self):
self._L1_snr_time_series_deleter()
@V1_snr_time_series.deleter
def V1_snr_time_series(self):
self._V1_snr_time_series_deleter()
@K1_snr_time_series.deleter
def K1_snr_time_series(self):
self._K1_snr_time_series_deleter()
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib
plugin_LTLIBRARIES = libgstlal_adder.la libgstpythonplugin.la
plugin_LTLIBRARIES = libgstlal_adder.la
libgstlal_adder_la_SOURCES = \
gstadder.h gstadder.c \
......@@ -8,7 +8,3 @@ libgstlal_adder_la_SOURCES = \
libgstlal_adder_la_CFLAGS = $(AM_CFLAGS) $(ORC_CFLAGS) $(gstreamer_CFLAGS) $(gstreamer_audio_CFLAGS) -DGST_PACKAGE_NAME=\"gstlal\" -DGST_PACKAGE_ORIGIN=\"\"
libgstlal_adder_la_LIBADD = $(top_builddir)/lib/gstlal/libgstlal.la $(top_builddir)/lib/gstlal/libgstlaltypes.la
libgstlal_adder_la_LDFLAGS = $(AM_LDFLAGS) $(ORC_LIBS) $(gstreamer_LIBS) $(gstreamer_audio_LIBS) $(GSTLAL_PLUGIN_LDFLAGS)
libgstpythonplugin_la_SOURCES = gstpythonplugin.c
libgstpythonplugin_la_CFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) $(PYGOBJECT_CFLAGS) $(gstreamer_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) -DPYTHON_VERSION="\"$(PYTHON_VERSION)\"" -DPY_LIB_LOC="\"$(PYTHON_LIB_LOC)\"" -DPY_ABI_FLAGS="\"$(PYTHON_ABI_FLAGS)\"" -DPY_LIB_SUFFIX="\"$(PYTHON_LIB_SUFFIX)\"" -DGST_API_VERSION="\"$(GSTREAMER_RELEASE)\"" -DPLUGINDIR="\"$(plugindir)\""
libgstpythonplugin_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LIBS) $(gstreamer_LIBS) $(GSTLAL_PLUGIN_LDFLAGS) $(PYGOBJECT_LIBS)
......@@ -25,6 +25,7 @@ struct gstlal_peak_state *gstlal_peak_state_new(guint channels, gstlal_peak_type
new->thresh = 0;
new->type = type;
new->is_gap = FALSE;
new->no_peaks_past_threshold = TRUE;
switch (new->type)
{
......@@ -84,6 +85,9 @@ int gstlal_peak_state_clear(struct gstlal_peak_state *val)
memset(val->interpvalues.as_float, 0.0, val->channels * val->unit);
val->num_events = 0;
val->is_gap = FALSE;
// dont reset the value of no peaks past threshold, user is responsibile for that
// FIXME This will be removed eventually, see itacac for more info
//val->no_peaks_past_threshold = TRUE;
return 0;
}
......
......@@ -48,6 +48,7 @@ struct gstlal_peak_state {
LanczosTriggerInterpolant *interp;
gboolean is_gap;
gboolean no_peaks_past_threshold;
};
......
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