From 988bb9df9ab135c3f1ce8003212f606d40670d8a Mon Sep 17 00:00:00 2001
From: Gregory Ashton <gregory.ashton@ligo.org>
Date: Tue, 12 Jun 2018 16:58:27 +1000
Subject: [PATCH] Updates all examples to use new argument

---
 examples/injection_examples/basic_tutorial.py            | 6 +++---
 .../basic_tutorial_dist_time_phase_marg.py               | 9 +++++++--
 .../injection_examples/basic_tutorial_time_phase_marg.py | 8 ++++++--
 examples/injection_examples/change_sampled_parameters.py | 7 +++++--
 examples/injection_examples/how_to_specify_the_prior.py  | 8 ++++++--
 examples/injection_examples/marginalized_likelihood.py   | 8 ++++++--
 examples/open_data_examples/GW150914.py                  | 4 ++--
 7 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/examples/injection_examples/basic_tutorial.py b/examples/injection_examples/basic_tutorial.py
index 1dccdf758..f2cf31e6b 100644
--- a/examples/injection_examples/basic_tutorial.py
+++ b/examples/injection_examples/basic_tutorial.py
@@ -32,15 +32,15 @@ injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5
                             ra=1.375, dec=-1.2108)
 
 # Fixed arguments passed into the source model
-fixed_arguments = dict(waveform_approximant='IMRPhenomPv2',
-                       reference_frequency=50.)
+waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
+                          reference_frequency=50.)
 
 # Create the waveform_generator using a LAL BinaryBlackHole source function
 waveform_generator = tupak.WaveformGenerator(time_duration=time_duration,
                                              sampling_frequency=sampling_frequency,
                                              frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
                                              parameters=injection_parameters,
-                                             fixed_arguments=fixed_arguments)
+                                             waveform_arguments=waveform_arguments)
 hf_signal = waveform_generator.frequency_domain_strain()
 
 # Set up interferometers.  In this case we'll use three interferometers (LIGO-Hanford (H1), LIGO-Livingston (L1),
diff --git a/examples/injection_examples/basic_tutorial_dist_time_phase_marg.py b/examples/injection_examples/basic_tutorial_dist_time_phase_marg.py
index 211020258..f28e35d10 100644
--- a/examples/injection_examples/basic_tutorial_dist_time_phase_marg.py
+++ b/examples/injection_examples/basic_tutorial_dist_time_phase_marg.py
@@ -27,13 +27,18 @@ np.random.seed(88170235)
 # spins of both black holes (a, tilt, phi), etc.
 injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5, tilt_2=1.0, phi_12=1.7, phi_jl=0.3,
                             luminosity_distance=2000., iota=0.4, psi=2.659, phase=1.3, geocent_time=1126259642.413,
-                            waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
+                            ra=1.375, dec=-1.2108)
+
+# Fixed arguments passed into the source model
+waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
+                          reference_frequency=50.)
 
 # Create the waveform_generator using a LAL BinaryBlackHole source function
 waveform_generator = tupak.WaveformGenerator(time_duration=time_duration,
                                              sampling_frequency=sampling_frequency,
                                              frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
-                                             parameters=injection_parameters)
+                                             parameters=injection_parameters,
+                                             waveform_arguments=waveform_arguments)
 hf_signal = waveform_generator.frequency_domain_strain()
 
 # Set up interferometers.  In this case we'll use three interferometers (LIGO-Hanford (H1), LIGO-Livingston (L1),
diff --git a/examples/injection_examples/basic_tutorial_time_phase_marg.py b/examples/injection_examples/basic_tutorial_time_phase_marg.py
index cfa4c692e..47768d1a6 100644
--- a/examples/injection_examples/basic_tutorial_time_phase_marg.py
+++ b/examples/injection_examples/basic_tutorial_time_phase_marg.py
@@ -27,13 +27,17 @@ np.random.seed(88170235)
 # spins of both black holes (a, tilt, phi), etc.
 injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5, tilt_2=1.0, phi_12=1.7, phi_jl=0.3,
                             luminosity_distance=2000., iota=0.4, psi=2.659, phase=1.3, geocent_time=1126259642.413,
-                            waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
+                            ra=1.375, dec=-1.2108)
+
+waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
+                          reference_frequency=50.)
 
 # Create the waveform_generator using a LAL BinaryBlackHole source function
 waveform_generator = tupak.WaveformGenerator(time_duration=time_duration,
                                              sampling_frequency=sampling_frequency,
                                              frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
-                                             parameters=injection_parameters)
+                                             parameters=injection_parameters,
+                                             waveform_arguments=waveform_arguments)
 hf_signal = waveform_generator.frequency_domain_strain()
 
 # Set up interferometers.  In this case we'll use three interferometers (LIGO-Hanford (H1), LIGO-Livingston (L1),
diff --git a/examples/injection_examples/change_sampled_parameters.py b/examples/injection_examples/change_sampled_parameters.py
index 711e195c0..1b774774c 100644
--- a/examples/injection_examples/change_sampled_parameters.py
+++ b/examples/injection_examples/change_sampled_parameters.py
@@ -20,7 +20,10 @@ np.random.seed(151226)
 
 injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5, tilt_2=1.0, phi_12=1.7, phi_jl=0.3,
                             luminosity_distance=3000., iota=0.4, psi=2.659, phase=1.3, geocent_time=1126259642.413,
-                            waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
+                            ra=1.375, dec=-1.2108)
+
+waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
+                          reference_frequency=50.)
 
 # Create the waveform_generator using a LAL BinaryBlackHole source function
 waveform_generator = tupak.gw.waveform_generator.WaveformGenerator(
@@ -28,7 +31,7 @@ waveform_generator = tupak.gw.waveform_generator.WaveformGenerator(
     frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
     parameter_conversion=tupak.gw.conversion.convert_to_lal_binary_black_hole_parameters,
     non_standard_sampling_parameter_keys=['chirp_mass', 'mass_ratio'],
-    parameters=injection_parameters)
+    parameters=injection_parameters, waveform_arguments=waveform_arguments)
 hf_signal = waveform_generator.frequency_domain_strain()
 
 # Set up interferometers.
diff --git a/examples/injection_examples/how_to_specify_the_prior.py b/examples/injection_examples/how_to_specify_the_prior.py
index 67e3e209b..5554f18e2 100644
--- a/examples/injection_examples/how_to_specify_the_prior.py
+++ b/examples/injection_examples/how_to_specify_the_prior.py
@@ -18,13 +18,17 @@ np.random.seed(151012)
 
 injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5, tilt_2=1.0, phi_12=1.7, phi_jl=0.3,
                             luminosity_distance=4000., iota=0.4, psi=2.659, phase=1.3, geocent_time=1126259642.413,
-                            waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
+                            ra=1.375, dec=-1.2108)
+
+waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
+                          reference_frequency=50.)
 
 # Create the waveform_generator using a LAL BinaryBlackHole source function
 waveform_generator = tupak.WaveformGenerator(time_duration=time_duration,
                                              sampling_frequency=sampling_frequency,
                                              frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
-                                             parameters=injection_parameters)
+                                             parameters=injection_parameters,
+                                             waveform_arguments=waveform_arguments)
 hf_signal = waveform_generator.frequency_domain_strain()
 
 # Set up interferometers.
diff --git a/examples/injection_examples/marginalized_likelihood.py b/examples/injection_examples/marginalized_likelihood.py
index 5ca2ed1b8..e819e8d5b 100644
--- a/examples/injection_examples/marginalized_likelihood.py
+++ b/examples/injection_examples/marginalized_likelihood.py
@@ -17,12 +17,16 @@ np.random.seed(170608)
 
 injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5, tilt_2=1.0, phi_12=1.7, phi_jl=0.3,
                             luminosity_distance=4000., iota=0.4, psi=2.659, phase=1.3, geocent_time=1126259642.413,
-                            waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
+                            ra=1.375, dec=-1.2108)
+
+waveform_arguments = dict(waveform_approximant='IMRPhenomPv2',
+                          reference_frequency=50.)
 
 # Create the waveform_generator using a LAL BinaryBlackHole source function
 waveform_generator = tupak.WaveformGenerator(
     time_duration=time_duration, sampling_frequency=sampling_frequency,
-    frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole, parameters=injection_parameters)
+    frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole, parameters=injection_parameters,
+    waveform_arguments=waveform_arguments)
 hf_signal = waveform_generator.frequency_domain_strain()
 
 # Set up interferometers.
diff --git a/examples/open_data_examples/GW150914.py b/examples/open_data_examples/GW150914.py
index d873df323..6ccb8a00f 100644
--- a/examples/open_data_examples/GW150914.py
+++ b/examples/open_data_examples/GW150914.py
@@ -39,8 +39,8 @@ prior = tupak.gw.prior.BBHPriorSet(filename='GW150914.prior')
 waveform_generator = tupak.WaveformGenerator(time_duration=interferometers[0].duration,
                                              sampling_frequency=interferometers[0].sampling_frequency,
                                              frequency_domain_source_model=tupak.gw.source.lal_binary_black_hole,
-                                             parameters={'waveform_approximant': 'IMRPhenomPv2',
-                                                         'reference_frequency': 50})
+                                             waveform_arguments={'waveform_approximant': 'IMRPhenomPv2',
+                                                                 'reference_frequency': 50})
 
 # In this step, we define the likelihood. Here we use the standard likelihood
 # function, passing it the data and the waveform generator.
-- 
GitLab