Commit f856b48e authored by Leo Pound Singer's avatar Leo Pound Singer

Port from glue.ligolw to ligo.lw

parent a0585967
......@@ -4,8 +4,8 @@ import logging
import urllib.parse
from celery.exceptions import Ignore
from glue.ligolw.utils import load_fileobj
from glue.ligolw.utils.ligolw_add import merge_ligolws
from ligo.lw.utils import load_fileobj
from ligo.lw.utils.ligolw_add import merge_ligolws
from ligo.skymap import bayestar as _bayestar
from ligo.skymap.io import events
from ligo.skymap.io import fits
......@@ -61,8 +61,8 @@ def localize(coinc_psd, graceid, filename='bayestar.fits.gz',
# Combine coinc.xml and psd.xml.gz into one XML document
doc = None
for filecontents in coinc_psd:
doc, _ = load_fileobj(io.BytesIO(filecontents), xmldoc=doc,
contenthandler=events.ligolw.ContentHandler)
doc = load_fileobj(io.BytesIO(filecontents), xmldoc=doc,
contenthandler=events.ligolw.ContentHandler)
merge_ligolws(doc)
# Parse event
......
......@@ -5,8 +5,8 @@ import random
from celery.task import PeriodicTask
from celery.utils.log import get_task_logger
from glue.ligolw import utils
from glue.ligolw import lsctables
from ligo.lw import utils
from ligo.lw import lsctables
import lal
from ligo.skymap.io.events.ligolw import ContentHandler
import numpy as np
......@@ -21,7 +21,7 @@ log = get_task_logger(__name__)
def pick_coinc():
"""Pick a coincidence from the "First Two Years" paper."""
with resources.open_binary(data_first2years, 'gstlal.xml.gz') as f:
xmldoc, _ = utils.load_fileobj(f, contenthandler=ContentHandler)
xmldoc = utils.load_fileobj(f, contenthandler=ContentHandler)
root, = xmldoc.childNodes
# Remove unneeded tables
......@@ -111,7 +111,7 @@ def pick_coinc():
def _jitter_snr(coinc_bytes):
coinc_xml = io.BytesIO(coinc_bytes)
xmldoc, _ = utils.load_fileobj(coinc_xml, contenthandler=ContentHandler)
xmldoc = utils.load_fileobj(coinc_xml, contenthandler=ContentHandler)
coinc_inspiral_table = lsctables.CoincInspiralTable.get_table(xmldoc)
......
......@@ -2,8 +2,8 @@ from importlib import resources
import io
from unittest.mock import call, patch
from glue.ligolw import utils
from glue.ligolw import lsctables
from ligo.lw import utils
from ligo.lw import lsctables
from ligo.skymap.io.events.ligolw import ContentHandler
import pytest
......@@ -21,8 +21,8 @@ def mock_now():
@patch('lal.GPSTimeNow', mock_now)
def test_pick_coinc():
coinc = pick_coinc()
xmldoc, _ = utils.load_fileobj(io.BytesIO(coinc),
contenthandler=ContentHandler)
xmldoc = utils.load_fileobj(io.BytesIO(coinc),
contenthandler=ContentHandler)
coinc_inspiral_table = lsctables.CoincInspiralTable.get_table(xmldoc)
......
......@@ -20,7 +20,7 @@ ligo-followup-advocate >= 1.1.6
ligo-gracedb >= 2.3.0
ligo-raven >= 1.17
ligo-segments
ligo.skymap >= 0.1.13
ligo.skymap >= 0.4.0
lscsoft-glue
lxml
numpy
......
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