Skip to content

Instantly share code, notes, and snippets.

@cmbiwer
Last active January 22, 2016 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmbiwer/8a25180671ae10217732 to your computer and use it in GitHub Desktop.
Save cmbiwer/8a25180671ae10217732 to your computer and use it in GitHub Desktop.
Quick follow up of hardware injections SNR time series.
#!/bin/bash
# quick follow up of hardware injections SNR time series
# pycbc v1.3.4 and lalsuite v6.36
set -e
# injection options
INJECTION_TIME=1134345930.46611
INJECTION_PREFIX=coherentbbh10_1128678894
# make output dir
HTML_DIR=/home/cbiwer/public_html/hwinj_single_tmplt/${INJECTION_TIME}_${INJECTION_PREFIX}
mkdir -p ${HTML_DIR}
# get SVN with waveform information
svn co https://daqsvn.ligo-la.caltech.edu/svn/injection/hwinj/Details/Inspiral/
# get parameters from XML file
INJECTION_FILE=Inspiral/${INJECTION_PREFIX}.xml
MASS1=`lwtprint -t sim_inspiral -c mass1 ${INJECTION_FILE}`
MASS2=`lwtprint -t sim_inspiral -c mass2 ${INJECTION_FILE}`
SPIN1Z=`lwtprint -t sim_inspiral -c spin1z ${INJECTION_FILE}`
SPIN2Z=`lwtprint -t sim_inspiral -c spin2z ${INJECTION_FILE}`
# get start and end time for matched filtering executable
INJECTION_TIME_INT=${INJECTION_TIME%.*}
GPS_START_TIME=$((${INJECTION_TIME_INT} - 1024))
GPS_END_TIME=$((${INJECTION_TIME_INT} + 1024))
# match filter
CHANNEL_NAME=L1:GDS-CALIB_STRAIN
FRAME_TYPE=L1_HOFT_C00
OUTPUT_FILE=L1-SINGLE_TEMPLATE.hdf
pycbc_single_template --segment-end-pad 16 --segment-length 256 \
--low-frequency-cutoff 30 --pad-data 8 --sample-rate 4096 \
--segment-start-pad 112 --psd-segment-stride 8 --psd-inverse-length 16 \
--psd-segment-length 16 --processing-scheme mkl --approximant SEOBNRv2_ROM_DoubleSpin \
--psd-estimation median --strain-high-pass 20 \
--order -1 --chisq-bins 16 --channel-name ${CHANNEL_NAME} \
--output-file ${OUTPUT_FILE} \
--mass1 ${MASS1} --mass2 ${MASS2} --spin1z ${SPIN1Z} --spin2z ${SPIN2Z} \
--gps-start-time ${GPS_START_TIME} --gps-end-time ${GPS_END_TIME} --verbose \
--frame-type ${FRAME_TYPE}
# plot SNR time seires
IMG_FILE=${HTML_DIR}/L1-SINGLE_TEMPLATE-100MS.png
pycbc_single_template_plot --window 0.10 \
--single-template-file ${OUTPUT_FILE} \
--output-file ${IMG_FILE} \
--event-time ${INJECTION_TIME}
# plot SNR time series
IMG_FILE=${HTML_DIR}/L1-SINGLE_TEMPLATE-10S.png
pycbc_single_template_plot --window 10 \
--single-template-file ${OUTPUT_FILE} \
--output-file ${IMG_FILE} \
--event-time ${INJECTION_TIME}
# match filter
CHANNEL_NAME=H1:GDS-CALIB_STRAIN
FRAME_TYPE=H1_HOFT_C00
OUTPUT_FILE=H1-SINGLE_TEMPLATE.hdf
pycbc_single_template --segment-end-pad 16 --segment-length 256 \
--low-frequency-cutoff 30 --pad-data 8 --sample-rate 4096 \
--segment-start-pad 112 --psd-segment-stride 8 --psd-inverse-length 16 \
--psd-segment-length 16 --processing-scheme mkl --approximant SEOBNRv2_ROM_DoubleSpin \
--psd-estimation median --strain-high-pass 20 \
--order -1 --chisq-bins 16 --channel-name ${CHANNEL_NAME} \
--output-file ${OUTPUT_FILE} \
--mass1 ${MASS1} --mass2 ${MASS2} --spin1z ${SPIN1Z} --spin2z ${SPIN2Z} \
--gps-start-time ${GPS_START_TIME} --gps-end-time ${GPS_END_TIME} --verbose \
--frame-type ${FRAME_TYPE}
# plot SNR time series
IMG_FILE=${HTML_DIR}/H1-SINGLE_TEMPLATE-100MS.png
pycbc_single_template_plot --window 0.10 \
--single-template-file ${OUTPUT_FILE} \
--output-file ${IMG_FILE} \
--event-time ${INJECTION_TIME}
# plot SNR time series
IMG_FILE=${HTML_DIR}/H1-SINGLE_TEMPLATE-10S.png
pycbc_single_template_plot --window 10 \
--single-template-file ${OUTPUT_FILE} \
--output-file ${IMG_FILE} \
--event-time ${INJECTION_TIME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment