Skip to content
Snippets Groups Projects
Commit 47b25ab1 authored by Madeline Wade's avatar Madeline Wade
Browse files

Adding an example Makefile for running gstlal_compute_strain in O2, a filters...

Adding an example Makefile for running gstlal_compute_strain in O2, a filters file, and an example plotting script for O2
parent d1426d30
No related branches found
No related tags found
No related merge requests found
File added
#!/usr/bin/env python
from gwpy.timeseries import TimeSeries
import glob
from math import pi
from gwpy.plotter import BodePlot
import numpy
from optparse import OptionParser, Option
parser = OptionParser()
parser.add_option("--ifo", metavar = "name", help = "Name of the IFO")
parser.add_option("--gps-start-time", metavar = "seconds", help = "Set the GPS start time.")
parser.add_option("--gps-end-time", metavar = "seconds", help = "Set the GPS end time.")
parser.add_option("--raw-frame-cache", metavar = "name", help = "Raw frame cache file")
parser.add_option("--gds-frame-cache", metavar = "name", help = "GDS frame cache file.")
parser.add_option("--gds-channel-name", metavar = "name", default = "GDS-CALIB_STRAIN", help = "Channel name for h(t) channel in GDS frames. (Default = GDS-CALIB_STRAIN)")
parser.add_option("--calcs-channel-name", metavar = "name", default = "CAL-DELTAL_EXTERNAL_DQ", help = "Channel name for h(t) channel in raw frames. (Default = CAL-DELTAL_EXTERNAL_DQ)")
options, filenames = parser.parse_args()
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)
# 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)
# 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)
#dewhiten CALCS
calcs_asd = calcs_asd.filter([30]*6, [0.3]*6, 1e-12 / 4e3)
#plot spectrum
plot=calcs_asd.plot(label='CALCS h(t) ASD')
plot.gca().plot(gds_asd,label='GDS h(t) ASD')
ax = plot.gca()
ax.set_ylabel = 'Strain [Hz$^{-1/2}$]'
ax.set_xlabel = 'Frequency [Hz]'
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")
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)
plot.save('CALCS_GDS_residual.png')
# time of GW170817 1187008882
START = 1187007882 # Thu Aug 17 12:24:24 GMT 2017
END = 1187008582 # Thu Aug 17 12:36:04 GMT 2017
FILTERS = 'L1DCS_1175961600.npz'
# Filters file from aligocalibration/trunk/Runs/O2/GDSFilters/L1DCS_1175961600.npz
all: L1_hoft_frames.cache
L1_raw_frames.cache:
gw_data_find -o L -t L1_R -s $(START) -e $(END) -l --url-type file > $@
L1_hoft_frames.cache: L1_raw_frames.cache
gstlal_compute_strain --data-source frames --frame-cache L1_raw_frames.cache --gps-start-time $(START) --gps-end-time $(END) --frame-duration=4 --frames-per-file=1 --filters-file $(FILTERS) --ifo L1 --frame-type L1_TEST --compression-scheme=6 --compression-level=3 --full-calibration --control-sample-rate 16384 --factors-from-filters-file --expected-fcc 376.0 --no-fs --no-srcQ --coherence-uncertainty-threshold 0.02 --kappas-default-to-median --apply-kappatst --apply-kappapu --apply-kappac --verbose
ls *.gwf | lalapps_path2cache > $@
clean:
rm *.cache *.gwf
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