From 08779047dca3aee7fb5889001da86770edf7105d Mon Sep 17 00:00:00 2001
From: frcojimenez <frco.jimenez@gmail.com>
Date: Wed, 11 Nov 2020 15:48:27 +0000
Subject: [PATCH] injection_tests

---
 injection_tests/inference_config.ini | 101 ++++++++++++++++++
 injection_tests/run.sh               |  20 ++++
 injection_tests/workflow_config.ini  | 152 +++++++++++++++++++++++++++
 3 files changed, 273 insertions(+)
 create mode 100644 injection_tests/inference_config.ini
 create mode 100644 injection_tests/run.sh
 create mode 100644 injection_tests/workflow_config.ini

diff --git a/injection_tests/inference_config.ini b/injection_tests/inference_config.ini
new file mode 100644
index 0000000..c34c13f
--- /dev/null
+++ b/injection_tests/inference_config.ini
@@ -0,0 +1,101 @@
+[model]
+name = gaussian_noise
+low-frequency-cutoff = H1:20.0 L1:20.0 V1:20.0
+
+[data]
+instruments = H1 L1 V1
+trigger-time = 0
+analysis-start-time = -8
+analysis-end-time = 8
+; fake strain and ASD from file:
+fake-strain-from-file = H1:/work/julian.westerweck/projects/ringdown/combined_population/noise_curves/AplusDesign.txt L1:/work/julian.westerweck/projects/ringdown/combined_population/noise_curves/AplusDesign.txt V1:/work/julian.westerweck/projects/ringdown/combined_population/noise_curves/avirgo_O5high_NEW.txt
+asd-file = H1:/work/julian.westerweck/projects/ringdown/combined_population/noise_curves/AplusDesign.txt L1:/work/julian.westerweck/projects/ringdown/combined_population/noise_curves/AplusDesign.txt V1:/work/julian.westerweck/projects/ringdown/combined_population/noise_curves/avirgo_O5high_NEW.txt
+; analytic PSD and fake strain based on that
+;fake-strain = H1:aLIGOZeroDetHighPower L1:aLIGOZeroDetHighPower V1:aLIGOZeroDetHighPower
+;psd-model = H1:aLIGOZeroDetHighPower L1:aLIGOZeroDetHighPower V1:aLIGOZeroDetHighPower
+; zero Noise and analytic PSD
+;fake-strain = H1:zeroNoise L1:zeroNoise V1:zeroNoise
+;psd-model = H1:aLIGOZeroDetHighPower L1:aLIGOZeroDetHighPower V1:aLIGOZeroDetHighPower
+fake-strain-seed = 1
+pad-data = 8
+strain-high-pass = 15
+sample-rate = 8192
+data-conditioning-low-freq = 20
+psd-inverse-length = 4
+channel-name = H1:DCS-CALIB_STRAIN_C02 L1:DCS-CALIB_STRAIN_C02 V1:DCS-CALIB_STRAIN_C02
+
+[sampler]
+name = dynesty
+nlive = 1000
+dlogz = 0.1
+
+[sampler-burn_in]
+burn-in-test = nacl & max_posterior
+
+[variable_params]
+f_220 =
+tau_220 =
+amp220 =
+phi220 =
+f_221 =
+tau_221 =
+amp221 =
+phi221 =
+;polarization =
+;inclination =
+
+[static_params]
+approximant = TdQNMfromFreqTau
+f_lower = 18
+f_ref = 20
+tc = FROM_INJECTION
+lmns = 222
+t_final = 1
+ra = FROM_INJECTION
+dec = FROM_INJECTION
+polarization = 0 
+inclination = 0
+
+[prior-f_220+tau_220]
+name = uniform_f0_tau
+rdfreq = f_220
+damping_time = tau_220
+min-f0 = 50
+max-f0 = 2048
+min-tau = 0.0033
+max-tau = 0.03
+final_mass = 10, 200
+final_spin = -0.99, 0.99
+
+[prior-f_221+tau_221]
+name = uniform_f0_tau
+rdfreq = f_221
+damping_time = tau_221
+min-f0 = 50
+max-f0 = 2048
+min-tau = 0.00001
+max-tau = 0.003
+final_mass = 10, 200
+final_spin = -0.99, 0.99
+
+[prior-amp220]
+name = uniform_log10
+min-amp220 = 1e-25
+max-amp220 = 1e-17
+
+[prior-phi220]
+name = uniform_angle
+
+[prior-amp221]
+name = uniform_log10
+min-amp221 = 0.0
+max-amp221 = 0.8
+
+[prior-phi221]
+name = uniform_angle
+
+[prior-inclination]
+name = sin_angle
+
+[prior-polarization]
+name = uniform_angle
diff --git a/injection_tests/run.sh b/injection_tests/run.sh
new file mode 100644
index 0000000..bd4e4d2
--- /dev/null
+++ b/injection_tests/run.sh
@@ -0,0 +1,20 @@
+#! /bin/bash
+VIRTUALENV=/work/julian.westerweck/virtualenvs/pycbc-condor1-rd_population/bin/activate
+source ${VIRTUALENV}
+# name of the workflow
+WORKFLOW_NAME="rdpe-overtones"
+## path to output dir
+#OUTPUT_DIR=output
+# input configuration files
+CONFIG_PATH=config.ini
+INJECTION_FILE_PATH=injections.hdf
+# run workflow generator on simulated data
+pycbc_make_inference_inj_workflow \
+    --workflow-name ${WORKFLOW_NAME} \
+    --output-dir output \
+    --config-files ${CONFIG_PATH} \
+    --injection-file ${INJECTION_FILE_PATH} \
+    --seed 0
+###The bin pycbc_submit_dax is not updated automatically in pycbc-dev/bin/ when pulling into src/pycbc/ from git. So use the one in src/pycbc/bin instead. 
+cd output
+bash /work/julian.westerweck/virtualenvs/pycbc-condor1-rd_population/bin/pycbc_submit_dax --no-create-proxy --no-grid --accounting-group cbc.test.rdpe --enable-shared-filesystem --dax ${WORKFLOW_NAME}.dax
diff --git a/injection_tests/workflow_config.ini b/injection_tests/workflow_config.ini
new file mode 100644
index 0000000..3d2addf
--- /dev/null
+++ b/injection_tests/workflow_config.ini
@@ -0,0 +1,152 @@
+[workflow]
+; basic information used by the workflow generator
+file-retention-level = all_triggers
+;h1-channel-name = H1:DCS-CALIB_STRAIN_C02
+;l1-channel-name = L1:DCS-CALIB_STRAIN_C02
+;v1-channel-name = I1:DCS-CALIB_STRAIN_C02
+start-time = -8
+end-time = 8
+[workflow-ifos]
+; the IFOs to analyze
+h1 =
+l1 =
+v1 =
+
+[workflow-inference]
+; how the workflow generator should setup inference nodes
+config-files = inference_config.ini
+
+[extract_posterior]
+parameters = '*'
+force =
+
+[workflow-summary_plots]
+; parameters that will plotted on the summary page
+; summary groups should be limited to 1 or 2 dimensions (though this is not
+; enforced)
+; parameters must be from the set specified in extract_posterior
+plot-group-ft220 = f_220 tau_220
+plot-group-ft221 = f_221 tau_221
+plot-group-amps = amp220 amp221
+plot-group-phis = phi220 phi221
+[workflow-plot_params]
+
+; parameters to plot in posterior pages
+; parameters must be from the set specified in posterior_parameters
+plot-group-all = f_220 tau_220 amp220 phi220 f_221 tau_221 amp221 phi221 #inclination polarization
+
+[workflow-summary_table]
+; parameters that will be printed in the summary table
+; parameters must be from the set specified in extract_posterior
+table-params = f_220 tau_220 amp220 phi220 f_221 tau_221 amp221 phi221 'snr_from_loglr(loglikelihood-lognl):SNR'  #inclination polarization 'snr_from_loglr(loglikelihood-lognl):SNR'
+
+;[workflow-pp_test]
+;; this section will cause a PP test to be done on the given parameters
+;; the parameters must be parameters that are in the posterior file
+;pp-params = f_220 tau_220 amp220 phi220 f_330 tau_330 amp330 phi330 inclination polarization
+
+[executables]
+; paths to executables to use in workflow
+create_injections = ${which:pycbc_create_injections}
+inference = ${which:run_pycbc_inference}
+extract_posterior = ${which:pycbc_inference_extract_samples}
+plot_posterior = ${which:pycbc_inference_plot_posterior}
+plot_posterior_summary = ${which:pycbc_inference_plot_posterior}
+plot_prior = ${which:pycbc_inference_plot_prior}
+table_summary = ${which:pycbc_inference_table_summary}
+
+;create_fits_file = ${which:pycbc_inference_create_fits}
+;plot_skymap = ${which:pycbc_inference_plot_skymap}
+plot_spectrum = ${which:pycbc_plot_psd_file}
+results_page = ${which:pycbc_make_html_page}
+; diagnostic plots
+;plot_acceptance_rate = ${which:pycbc_inference_plot_acceptance_rate}
+;plot_samples = ${which:pycbc_inference_plot_samples}
+; executables for percentile-percentile test
+;pp_table_summary = ${which:pycbc_inference_pp_table_summary}
+;plot_pp = ${which:pycbc_inference_plot_pp}
+inj_recovery = ${which:pycbc_inference_plot_inj_recovery}
+
+[create_injections]
+; command line options use --help for more information
+;ninjections = 10
+;dist-section = prior
+
+[inference]
+; command line options use --help for more information
+processing-scheme = cpu
+nprocesses = 8
+force =
+
+[pegasus_profile]
+condor|+MaxRunTimeHours = 8
+
+[pegasus_profile-inference]
+; pegasus profile for inference nodes
+condor|request_memory = 10G
+condor|request_cpus = 8
+
+[pegasus_profile-plot_prior]
+condor|request_memory = 4G
+;[pegasus_profile-plot_skymap]
+;condor|request_memory = 4G
+
+[pegasus_profile-plot_posterior]
+condor|request_memory = 4G
+
+[pegasus_profile-plot_posterior_summary]
+condor|request_memory = 4G
+;[pegasus_profile-plot_samples]
+;condor|request_memory = 4G
+
+[plot_posterior]
+; command line options use --help for more information
+plot-scatter =
+plot-contours =
+plot-marginal =
+z-arg = snr
+
+plot-injection-parameters =
+;plot-prior = /work/julian.westerweck/projects/ringdown/population/combined_population/workflow/test/inference_config.ini
+
+[plot_posterior_summary]
+; command line options use --help for more information
+plot-contours =
+plot-marginal =
+plot-density =
+density-cmap = Blues
+contour-color = black
+plot-injection-parameters =
+
+[plot_prior]
+; command line options use --help for more information
+;[plot_samples]
+;; command line options use --help for more information
+;walkers = all
+;thin-start = 0
+;thin-interval = 1
+
+[table_summary]
+; command line options use --help for more information
+
+[plot_spectrum]
+; command line options use --help for more information
+dyn-range-factor = 1
+;[pp_table_summary]
+; command line options for percentile-percentile table summary
+; do not provide parameters or injection-samples map here, as that is read
+; from the [workflow-pp_test] section
+;[plot_pp]
+; command line options for percentile-percentile plot
+; do not provide parameters or injection-samples map here, as that is read
+; from the [workflow-pp_test] section
+
+[inj_recovery]
+; command line options for injection recovery plots
+; do not provide parameters or injection-samples map here, as that is read
+; from the [workflow-pp_test] section
+
+[results_page]
+; command line options use --help for more information
+analysis-title = "Ringdown PE for overtones"
+output-path = "/work/xisco/WWW/overtones"
-- 
GitLab