#!/usr/bin/env python
import sys
from collections import defaultdict

import matplotlib
#matplotlib.use("Agg")
from matplotlib import pyplot

import numpy

from pylal.series import read_psd_xmldoc
from glue.ligolw import utils

import lalsimutils as lsu

pyplot.figure()
i = 1
for d in ["H1", "L1", "V1"]:
    series = lsu.frame_data_to_hoft(sys.argv[1], "%s:FAKE-STRAIN" % d)
    pyplot.subplot(3, 1, i)
    pyplot.grid()
    i += 1
    t = numpy.arange(float(series.epoch), float(series.epoch)+len(series.data.data)*series.deltaT, series.deltaT)
    pyplot.title(d)
    pyplot.plot(t, series.data.data, '-', label=d)
    pyplot.xlim([1e9+14, 1e9+14.3]) # these should be set interactively -- we may change the event time
    pyplot.legend()

pyplot.savefig("ts.jpeg")
