Ejemplo n.º 1
0
 def _snr_series_by_sngl_inspiral(cls, doc):
     for elem in doc.getElementsByTagName(LIGO_LW.tagName):
         try:
             if elem.Name != lal.COMPLEX8TimeSeries.__name__:
                 continue
             array.get_array(elem, 'snr')
             event_id = param.get_pyvalue(elem, 'event_id')
             if not isinstance(event_id, SnglInspiralID):
                 continue
         except (AttributeError, ValueError):
             continue
         else:
             yield event_id, lal.series.parse_COMPLEX8TimeSeries(elem)
Ejemplo n.º 2
0
 def _snr_series_by_sngl_inspiral(cls, doc):
     for elem in doc.getElementsByTagName(LIGO_LW.tagName):
         try:
             if elem.Name != lal.COMPLEX8TimeSeries.__name__:
                 continue
             array.get_array(elem, 'snr')
             event_id = param.get_pyvalue(elem, 'event_id')
             if not isinstance(event_id, SnglInspiralID):
                 continue
         except (AttributeError, ValueError):
             continue
         else:
             yield event_id, lal.series.parse_COMPLEX8TimeSeries(elem)
Ejemplo n.º 3
0
def get_snr_series(xmldoc):
    for elem in xmldoc.getElements(is_COMPLEX8TimeSeries):
        try:
            event_id = get_pyvalue(elem, 'event_id')
            array = get_array(elem, 'snr')
        except ValueError:
            pass
        else:
            yield event_id, array
Ejemplo n.º 4
0
def binned_array_from_xml(xml, name):
	"""
	Search for the description of a rate.BinnedArray object named
	"name" in the XML document tree rooted at xml, and construct and
	return a new rate.BinnedArray object from the data contained
	therein.
	"""
	xml = [elem for elem in xml.getElementsByTagName(ligolw.LIGO_LW.tagName) if elem.hasAttribute(u"Name") and elem.Name == u"%s:pylal_rate_binnedarray" % name]
	try:
		xml, = xml
	except ValueError:
		raise ValueError("document must contain exactly 1 BinnedArray named '%s'" % name)
	# an empty binning is used for the initial object creation instead
	# of using the real binning to avoid the creation of a (possibly
	# large) array that would otherwise accompany this step
	binnedarray = BinnedArray(NDBins())
	binnedarray.bins = bins_from_xml(xml)
	binnedarray.array = ligolw_array.get_array(xml, u"array").array
	return binnedarray