Commit 38239154 authored by Kipp Cannon's avatar Kipp Cannon

gstlal: port from glue.ligolw to ligo.lw

- gstlal-calibration is not touched
parent da4b19a7
......@@ -17,10 +17,10 @@ from gstlal import snglbursttable
from lal import LIGOTimeGPS
from optparse import OptionParser
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
import lal
import lalsimulation
......
......@@ -41,10 +41,10 @@ import math
import itertools
from glue.ligolw import utils
from glue.ligolw import lsctables
from glue.ligolw import table
from glue.ligolw import ligolw
from ligo.lw import utils as ligolw_utils
from ligo.lw import lsctables
from ligo.lw import table
from ligo.lw import ligolw
lsctables.use_in(ligolw.LIGOLWContentHandler)
from ligo import segments
from lal import LIGOTimeGPS
......@@ -83,14 +83,14 @@ def get_sim_inspirals_from_file(filename):
"""
Get a sim inspiral table from the file name."
"""
xmldoc = utils.load_filename(filename)
xmldoc = ligolw_utils.load_filename(filename)
return table.get_table( xmldoc, lsctables.SimInspiralTable.tableName )
def get_sim_burst_from_file( filename ):
"""
Get a sim burst table from the file name."
"""
xmldoc = utils.load_filename(filename)
xmldoc = ligolw_utils.load_filename(filename)
return table.get_table( xmldoc, lsctables.SimBurstTable.tableName )
def plot_wnb( sim_burst ):
......@@ -189,7 +189,7 @@ analyzed_segments = segments.segmentlistdict()
search_map = defaultdict(list)
event_map = defaultdict(list)
for arg in args:
xmldoc = utils.load_filename( arg )
xmldoc = ligolw_utils.load_filename( arg )
for tbl in lsctables.getTablesByType( xmldoc, lsctables.SnglBurstTable ):
for sb in tbl:
......@@ -247,7 +247,7 @@ segs = segments.segmentlistdict()
searches = lsctables.SearchSummaryTable()
for arg in args:
xmldoc = utils.load_filename( arg )
xmldoc = ligolw_utils.load_filename( arg )
def_id_pair = []
if segment_defs is not None:
segtables = lsctables.SegmentDefTable()
......
......@@ -25,7 +25,7 @@ import ConfigParser
from ConfigParser import SafeConfigParser
import lal
from glue.ligolw import utils as ligolw_utils
from ligo.lw import utils as ligolw_utils
from parts import EPHandler
......
......@@ -25,7 +25,7 @@ from pylal import lalburst
from pylal.lalfft import XLALCreateForwardREAL8FFTPlan, XLALCreateReverseREAL8FFTPlan, XLALREAL8FreqTimeFFT
from pylal import datatypes as laltypes
from glue.ligolw import ligolw, utils, ilwd, lsctables
from ligo.lw import ligolw, utils, ilwd, lsctables
from gstlal.excesspower import utils
......
......@@ -49,12 +49,12 @@ from lalburst import bucluster
from glue import datafind
from glue.ligolw import ligolw, lsctables
from ligo.lw import ligolw, lsctables
lsctables.use_in(ligolw.LIGOLWContentHandler)
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from glue.ligolw.utils import segments as ligolw_segments
from glue.ligolw.utils import search_summary as ligolw_search_summary
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from ligo.lw.utils import segments as ligolw_segments
from ligo.lw.utils import search_summary as ligolw_search_summary
from ligo.segments import segment, segmentlist, segmentlistdict, PosInfinity
from glue.lal import Cache
......@@ -515,7 +515,7 @@ class EPHandler(Handler):
# What comes out of SnglBurst.from_buffer is a
# pylal.xlal.datatypes.snglburst.SnglBurst object. It does not have
# all the trappings of its glue.ligolw.lsctables cousin, so we
# all the trappings of its ligo.lw.lsctables cousin, so we
# convert it here first
for event in [utils.convert_sngl_burst(sb, self.triggers) for sb in SnglBurst.from_buffer(buf)]:
......
......@@ -48,8 +48,8 @@ import lal
from lal import LIGOTimeGPS
from ligo import segments
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from gstlal import aggregator
from gstlal import bottle
......
......@@ -39,8 +39,8 @@ Gst.init(None)
from gstlal import pipeparts
from gstlal import datasource
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import segments as ligolw_segments
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import segments as ligolw_segments
from ligo import segments
import lal
from lal import LIGOTimeGPS
......
from glue.ligolw import ilwd
from glue.ligolw import lsctables
from ligo.lw import lsctables
import lal
from gstlal import _sngltriggertable
......
......@@ -69,8 +69,8 @@ static struct PyMemberDef members[] = {
{"confidence", T_FLOAT, offsetof(gstlal_GSTLALSnglBurst, row.confidence), 0, "confidence"},
{"chisq", T_DOUBLE, offsetof(gstlal_GSTLALSnglBurst, row.chisq), 0, "chisq"},
{"chisq_dof", T_DOUBLE, offsetof(gstlal_GSTLALSnglBurst, row.chisq_dof), 0, "chisq_dof"},
{"_process_id", T_LONG, offsetof(gstlal_GSTLALSnglBurst, row.process_id), 0, "process_id (long)"},
{"_event_id", T_LONG, offsetof(gstlal_GSTLALSnglBurst, row.event_id), 0, "event_id (long)"},
{"process_id", T_LONG, offsetof(gstlal_GSTLALSnglBurst, row.process_id), 0, "process_id (long)"},
{"event_id", T_LONG, offsetof(gstlal_GSTLALSnglBurst, row.event_id), 0, "event_id (long)"},
{NULL,}
};
......
from glue.ligolw import ilwd
from glue.ligolw import lsctables
from ligo.lw import lsctables
import lal
from gstlal import _snglbursttable
......@@ -10,24 +9,5 @@ __all__ = ["GSTLALSnglBurst"]
class GSTLALSnglBurst(_snglbursttable.GSTLALSnglBurst):
__slots__ = ()
process_id_type = ilwd.get_ilwdchar_class("process", "process_id")
event_id_type = ilwd.get_ilwdchar_class("sngl_burst", "event_id")
start = lsctables.gpsproperty("start_time", "start_time_ns")
peak = lsctables.gpsproperty("peak_time", "peak_time_ns")
@property
def process_id(self):
return self.process_id_type(self._process_id)
@process_id.setter
def process_id(self, val):
self._process_id = int(val)
@property
def event_id(self):
return self.event_id_type(self._event_id)
@event_id.setter
def event_id(self, val):
self._event_id = int(val)
......@@ -23,10 +23,10 @@ import itertools
import os
from optparse import OptionParser
from gstlal import spawaveform
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from gstlal import templates
from gstlal import inspiral_pipe
from gstlal import dagparts
......
......@@ -37,11 +37,11 @@ sqlite3.enable_callback_tracebacks(True)
import sys
from glue.ligolw import ligolw
from glue.ligolw import dbtables
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import dbtables
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from lalinspiral import thinca
from gstlal import far
......
......@@ -63,23 +63,24 @@ if missing_options:
raise ValueError, "missing required option(s) %s" % ", ".join("--%s" % option.replace("_", "-") for option in sorted(missing_options))
from glue.ligolw import ligolw
from glue.ligolw import array
from glue.ligolw import param
from ligo.lw import ligolw
from ligo.lw import array
from ligo.lw import param
array.use_in(ligolw.LIGOLWContentHandler)
param.use_in(ligolw.LIGOLWContentHandler)
from gstlal import cbc_template_iir
from pylal.series import read_psd_xmldoc
from glue.ligolw import utils, lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw import lsctables
# read bank file
bank_xmldoc = utils.load_filename(options.template_bank, gz=options.template_bank.endswith('.gz'))
bank_xmldoc = ligolw_utils.load_filename(options.template_bank)
sngl_inspiral_table = lsctables.table.get_table(bank_xmldoc, lsctables.SnglInspiralTable.tableName)
fFinal = max(sngl_inspiral_table.getColumnByName("f_final"))
# read psd file
if options.reference_psd:
ALLpsd = read_psd_xmldoc(utils.load_filename(options.reference_psd, verbose=options.verbose, contenthandler=ligolw.LIGOLWContentHandler))
ALLpsd = read_psd_xmldoc(ligolw_utils.load_filename(options.reference_psd, verbose=options.verbose, contenthandler=ligolw.LIGOLWContentHandler))
bank_sngl_table = lsctables.table.get_table( bank_xmldoc,lsctables.SnglInspiralTable.tableName )
psd = ALLpsd[bank_sngl_table[0].ifo]
# smooth and create an interp object
......@@ -91,7 +92,7 @@ else:
# get the iir coefficients
A, B, D, snrs = cbc_template_iir.makeiirbank(bank_xmldoc, sampleRate = 4096, psd_interp = psd, verbose=options.verbose, padding=options.padding, flower=options.flow, downsample = options.downsample, output_to_xml = True, epsilon = options.epsilon)
utils.write_filename(bank_xmldoc, options.output, gz=options.output.endswith('.gz'))
ligolw_utils.write_filename(bank_xmldoc, options.output, gz=options.output.endswith('.gz'))
#import pylab
#pylab.hist(snrs)
......
......@@ -84,12 +84,12 @@ from gstlal import bottle
from ligo import segments
from ligo.segments import utils as segmentsUtils
from glue.ligolw import ligolw
from glue.ligolw import array as ligolw_array
from glue.ligolw import param as ligolw_param
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import segments as ligolw_segments
from ligo.lw import ligolw
from ligo.lw import array as ligolw_array
from ligo.lw import param as ligolw_param
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import segments as ligolw_segments
from lal import LIGOTimeGPS
from lal import series as lalseries
from gstlal import far
......
......@@ -163,10 +163,10 @@ from ligo.gracedb.rest import DEFAULT_SERVICE_URL as gracedb_default_service_url
from ligo import segments
from ligo.segments import utils as segmentsUtils
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import segments as ligolw_segments
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import segments as ligolw_segments
from gstlal import bottle
from gstlal import datasource
from gstlal import far
......
......@@ -21,9 +21,9 @@
### gstlal_inspiral_mass_model.
import sys
from glue.ligolw import ligolw
from glue.ligolw import lsctables, param as ligolw_param, array as ligolw_array
from glue.ligolw import utils as ligolw_utils
from ligo.lw import ligolw
from ligo.lw import lsctables, param as ligolw_param, array as ligolw_array
from ligo.lw import utils as ligolw_utils
@ligolw_array.use_in
@ligolw_param.use_in
......
......@@ -32,10 +32,10 @@ from optparse import OptionParser
import sys
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from glue.ligolw.utils import segments as ligolw_segments
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from ligo.lw.utils import segments as ligolw_segments
from ligo import segments
from lalburst import calc_likelihood
from lalinspiral import thinca
......
......@@ -31,9 +31,9 @@ from optparse import OptionParser
import sys
from glue.ligolw import ligolw
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from gstlal import far
from lal.utils import CacheEntry
......
......@@ -18,7 +18,8 @@
### A program to extract the loudest coincs from an offline gstlal_inspiral DAG database into single files that can be uploaded to gracedb
from glue.ligolw import ligolw, lsctables, utils, dbtables
from ligo.lw import ligolw, lsctables, dbtables
from ligo.lw import utils as ligolw_utils
import sqlite3
import sys
from optparse import OptionParser
......@@ -139,4 +140,4 @@ for (cid, time, ifos) in cids:
setattr(fullrow, attr, getattr(thisrow, attr))
sngl.append(fullrow)
utils.write_filename(xmldocmain, '%s-LLOID-%d-0.xml.gz' % (ifos.replace(",",""), time), gz=True, verbose=True)
ligolw_utils.write_filename(xmldocmain, '%s-LLOID-%d-0.xml.gz' % (ifos.replace(",",""), time), gz=True, verbose=True)
......@@ -31,12 +31,12 @@
from optparse import OptionParser
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import array as ligolw_array
from glue.ligolw import param as ligolw_param
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import array as ligolw_array
from ligo.lw import param as ligolw_param
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from gstlal import far
......
......@@ -47,7 +47,7 @@ import subprocess, socket, tempfile
from glue import iterutils
from glue import pipeline
from glue import lal
from glue.ligolw import lsctables
from ligo.lw import lsctables
from ligo import segments
from optparse import OptionParser
......
......@@ -36,10 +36,10 @@ import numpy
from optparse import OptionParser
from ligo import segments
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from ligo.lw import ligolw
from ligo.lw import lsctables
from glue.lal import Cache
from glue.ligolw import utils as ligolw_utils
from ligo.lw import utils as ligolw_utils
import lal
from lal.series import *
from lal.utils import CacheEntry
......
......@@ -38,8 +38,8 @@ import sys
os.environ["MPLCONFIGDIR"] = "/tmp"
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.gracedb import rest as gracedb
from lalinspiral.thinca import InspiralCoincDef
......
......@@ -41,7 +41,7 @@ import shutil
import lal
from glue.ligolw import utils as ligolw_utils
from ligo.lw import utils as ligolw_utils
from gstlal import lvalert_helper
from gstlal import plotpsd
from ligo.gracedb import rest as gracedb
......
......@@ -32,10 +32,10 @@ import time
from optparse import OptionParser
import lal
from lal import LIGOTimeGPS
from glue.ligolw import ligolw
from glue.ligolw import table
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from ligo.lw import ligolw
from ligo.lw import table
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from gstlal import lvalert_helper
from ligo.gracedb import rest as gracedb
"""
......
......@@ -52,11 +52,11 @@ from gstlal import rate_estimation
from ligo import segments
from glue.lal import CacheEntry
from glue.ligolw import ligolw
from glue.ligolw import dbtables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw import lsctables
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import dbtables
from ligo.lw import utils as ligolw_utils
from ligo.lw import lsctables
from ligo.lw.utils import process as ligolw_process
from glue.text_progress_bar import ProgressBar
from lalinspiral import thinca
......
......@@ -40,7 +40,7 @@ import json
import lal
from glue.ligolw import utils as ligolw_utils
from ligo.lw import utils as ligolw_utils
from gstlal import lvalert_helper
from gstlal import plotpsd
from ligo.gracedb import rest as gracedb
......
......@@ -39,11 +39,11 @@ import sys
import json
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import coincs as ligolw_coincs
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import coincs as ligolw_coincs
from ligo.lw.utils import process as ligolw_process
from gstlal import lvalert_helper
import lal
from ligo.gracedb import rest as gracedb
......
......@@ -50,10 +50,10 @@ import lal
from lal import LIGOTimeGPS
from lal import rate
from lal.utils import CacheEntry
from glue.ligolw import ligolw
from glue.ligolw import table
from glue.ligolw import lsctables
from glue.ligolw import utils as ligolw_utils
from ligo.lw import ligolw
from ligo.lw import table
from ligo.lw import lsctables
from ligo.lw import utils as ligolw_utils
from gstlal import lvalert_helper
from ligo.gracedb import rest as gracedb
......
......@@ -38,11 +38,11 @@ from os import path
import sys
import urlparse
from glue.ligolw import ligolw
from glue.ligolw import lsctables
from glue.ligolw import array as ligolw_array
from glue.ligolw import param as ligolw_param
from glue.ligolw import utils as ligolw_utils
from ligo.lw import ligolw
from ligo.lw import lsctables
from ligo.lw import array as ligolw_array
from ligo.lw import param as ligolw_param
from ligo.lw import utils as ligolw_utils
from gstlal import inspiral
from gstlal import lvalert_helper
from gstlal import svd_bank
......
......@@ -37,9 +37,9 @@ from optparse import OptionParser
import time
from glue.ligolw import ligolw
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from glue.text_progress_bar import ProgressBar
from gstlal import reference_psd
from gstlal.stats import inspiral_extrinsics
......
......@@ -41,9 +41,9 @@
from optparse import OptionParser
from glue.ligolw import ligolw
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
from lal.utils import CacheEntry
......
......@@ -19,10 +19,10 @@
import h5py
import argparse
import numpy
from glue.ligolw import ligolw
from glue.ligolw import lsctables, param as ligolw_param, array as ligolw_array
from glue.ligolw import utils as ligolw_utils
from glue.ligolw.utils import process as ligolw_process
from ligo.lw import ligolw
from ligo.lw import lsctables, param as ligolw_param, array as ligolw_array
from ligo.lw import utils as ligolw_utils
from ligo.lw.utils import process as ligolw_process
import lal.series
from lal import rate
from gstlal import reference_psd
......
......@@ -53,10 +53,10 @@ import lal.series
from lal.utils import CacheEntry
from glue import pipeline
from ligo import segments
from glue.ligolw import ligolw
from glue.ligolw import lsctables
import glue.ligolw.utils as ligolw_utils
import glue.ligolw.utils.segments as ligolw_segments
from ligo.lw import ligolw
from ligo.lw import lsctables
import ligo.lw.utils as ligolw_utils
import ligo.lw.utils.segments as ligolw_segments
from gstlal import inspiral, inspiral_pipe
from gstlal import dagparts
from gstlal import datasource
......
......@@ -51,8 +51,8 @@ import sqlite3
import sys
from glue.ligolw import dbtables
from glue.ligolw import lsctables
from ligo.lw import dbtables