diff --git a/AMPSplotSNR.py b/AMPSplotSNR.py new file mode 100755 index 0000000000000000000000000000000000000000..20b136c835058d7b06892293144560da3ec0c3e1 --- /dev/null +++ b/AMPSplotSNR.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +import os, re, sys +import matplotlib as matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plt +import matplotlib.cm as cm +import numpy as np + +# Generate scatterplots of the AMPS and LDAS SNR +# Using the data set of recovered iHope S6 hardware +# Injections generated by Ian Harry +# Description of methods: +# https://www.lsc-group.phys.uwm.edu/ligovirgo/cbcnote/S6Plan/130422155409DQandVetoesHWInjs_in_AMPS_data +# Location of files on the CIT cluster: +# /home/spxiwh/S6/AMPS-STRAIN/hardware_inj_test/dump_snr/[H,L]1-HWINJS_WITH_SNR.dat +# 02013-05-15 (JD 2456428) +# Grant David Meadors +# g m e a d o r s @ u m i c h . e d u + +def scatterplotter(observatory): + print 'Plotting SNR scatterplot for this observatory:' + print observatory + + # Assume that the file is in the local directory: + # Since this is S6 data, the detector will be number 1, + # Either H1 or L1 + SNRfile = observatory + '1-HWINJS_WITH_SNR.dat' + LDAS, AMPS = np.loadtxt(SNRfile, delimiter = ' ', usecols=(0, 1), unpack=True) + plt.figure() + p1 = plt.scatter(LDAS, AMPS) + plt.grid(True) + plt.xlabel('SNR before feedforward (LDAS)') + plt.ylabel('SNR after feedforward (AMPS)') + plt.title('iHope SNR after vs before feedforward') + plt.savefig('AMPSplotSNR.png') + plt.savefig('AMPSplotSNR.pdf') + plt.close() + + plt.figure() + p2 = plt.scatter(LDAS, (AMPS-LDAS)/LDAS) + plt.grid(True) + plt.xlabel('SNR before feedforward (LDAS)') + plt.ylabel('SNR ratio: (AMPS-LDAS)/LDAS') + plt.title('iHope SNR (after-before)/before feedforward') + plt.savefig('AMPSratioSNR.png') + plt.savefig('AMPSratioSNR.pdf') + plt.close() + +scatterplotter(sys.argv[1])