Skip to content
Snippets Groups Projects
Commit 94871415 authored by Aaron Viets's avatar Aaron Viets
Browse files

gstlal-calibration examples: edited plotting script so that it works.

parent 519c5b3d
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import matplotlib
matplotlib.use('Agg')
from gwpy.timeseries import TimeSeriesDict
from gwpy.timeseries import TimeSeries
import glob
from math import pi
from gwpy.plotter import BodePlot
import numpy
from optparse import OptionParser, Option
from glue import datafind
parser = OptionParser()
......@@ -23,14 +27,14 @@ start_time = int(options.gps_start_time)
end_time = int(options.gps_end_time)
# Grab CALCS data
calcs_data=TimeSeriesDict.read(options.raw_frame_cache, channels = ['%s:%S' % (options.ifo, options.calcs_channel_name], start = start_time, end = end_time)
calcs_data=TimeSeries.read(options.raw_frame_cache, '%s:%s' % (options.ifo, options.calcs_channel_name), start_time, end_time)
# grab GDS/DCS data
gds_data = TimeSeriesDict.read(options.gds_frame_cache, channels = ["%s:%s" % (options.ifo, options.gds_channel_name)], start = start_time, end = end_time)
gds_data = TimeSeries.read(options.gds_frame_cache, "%s:%s" % (options.ifo, options.gds_channel_name), start_time, end_time)
# make asds
calcs_asd = calcs_data["%s:%s" % (options.ifo, options.calcs_channel_name)].asd(4,2)
gds_asd = gds_data["%s:%s" % (options.ifo, options.gds_channel_name)].asd(4,2)
calcs_asd = calcs_data.asd(4,2)
gds_asd = gds_data.asd(4,2)
#dewhiten CALCS
calcs_asd = calcs_asd.filter([30]*6, [0.3]*6, 1e-12 / 4e3)
......@@ -45,11 +49,11 @@ ax.set_xlim(10,8192)
ax.set_ylim(1e-24,1e-16)
plot.save('spectrum_comparison.png')
diff = abs(calcs_asd - gds_asd) / gds_asd
plot = diff.plot(label="Percent diff CALCS vs. GDS")
diff = calcs_asd / gds_asd
plot = diff.plot(label="ASD ratio CALCS / GDS", logy = False)
ax = plot.gca()
ax.set_ylabel = 'Strain [Hz$^{-1/2}$]'
ax.set_xlabel = 'Frequency [Hz]'
ax.set_xlim(10,5000)
ax.set_ylim(0,0.5)
ax.set_ylim(0.7, 1.3)
plot.save('CALCS_GDS_residual.png')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment