Commit e4ac1430 authored by moritz's avatar moritz

Moritz Huebner: Removed default parameters for sampling frequency and time...

Moritz Huebner: Removed default parameters for sampling frequency and time duration in the waveform generator
parent e6d489c6
Pipeline #19174 passed with stages
in 7 minutes and 14 seconds
......@@ -23,10 +23,10 @@ injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5
waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
# Create the waveform_generator using a LAL BinaryBlackHole source function
waveform_generator = tupak.waveform_generator.WaveformGenerator(
sampling_frequency=sampling_frequency, time_duration=time_duration,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=injection_parameters)
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=time_duration,
sampling_frequency=sampling_frequency,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=injection_parameters)
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers.
......
......@@ -26,11 +26,10 @@ def sine_gaussian(f, A, f0, tau, phi0, geocent_time, ra, dec, psi):
# We now define some parameters that we will inject and then a waveform generator
injection_parameters = dict(A=1e-21, f0=10, tau=1, phi0=0, geocent_time=0,
ra=0, dec=0, psi=0)
waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=sine_gaussian,
sampling_frequency=sampling_frequency,
time_duration=time_duration,
parameters=injection_parameters)
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=time_duration,
sampling_frequency=sampling_frequency,
frequency_domain_source_model=sine_gaussian,
parameters=injection_parameters)
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers.
......
......@@ -19,10 +19,10 @@ injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5
waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
# Create the waveform_generator using a LAL BinaryBlackHole source function
waveform_generator = tupak.waveform_generator.WaveformGenerator(
sampling_frequency=sampling_frequency, time_duration=time_duration,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=injection_parameters)
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=time_duration,
sampling_frequency=sampling_frequency,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=injection_parameters)
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers.
......
......@@ -15,9 +15,10 @@ def main():
label = 'injection'
# Create the waveform generator
waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=tupak.source.lal_binary_black_hole, sampling_frequency=2048, time_duration=4,
parameters={'reference_frequency': 50.0, 'waveform_approximant': 'IMRPhenomPv2'})
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=4, sampling_frequency=2048,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters={'reference_frequency': 50.0,
'waveform_approximant': 'IMRPhenomPv2'})
# Define the prior
# Merger time is some time in 2018, shame LIGO will never see it...
......
......@@ -20,10 +20,10 @@ injection_parameters = dict(mass_1=36., mass_2=29., a_1=0.4, a_2=0.3, tilt_1=0.5
waveform_approximant='IMRPhenomPv2', reference_frequency=50., ra=1.375, dec=-1.2108)
# Create the waveform_generator using a LAL BinaryBlackHole source function
waveform_generator = tupak.waveform_generator.WaveformGenerator(
sampling_frequency=sampling_frequency, time_duration=time_duration,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=injection_parameters)
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=time_duration,
sampling_frequency=sampling_frequency,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=injection_parameters)
hf_signal = waveform_generator.frequency_domain_strain()
# Set up interferometers.
......
......@@ -30,7 +30,9 @@ parameters['ra'] = 0
parameters['dec'] = 0
parameters['psi'] = 0
wg = tupak.waveform_generator.WaveformGenerator(time_domain_source_model=time_domain_sine_gaussian, time_duration=2000, sampling_frequency=1000, parameters=parameters)
wg = tupak.waveform_generator.WaveformGenerator(time_duration=2000, sampling_frequency=1000,
time_domain_source_model=time_domain_sine_gaussian,
parameters=parameters)
wg.parameters = parameters
plt.plot(wg.frequency_array, wg.frequency_domain_strain()['plus'])
plt.xlim(4, 6)
......
......@@ -44,11 +44,12 @@ prior['luminosity_distance'] = tupak.prior.PowerLaw(
# creates the frequency-domain strain. In this instance, we are using the
# `lal_binary_black_hole model` source model. We also pass other parameters:
# the waveform approximant and reference frequency.
waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
sampling_frequency=interferometers[0].sampling_frequency,
time_duration=interferometers[0].duration,
parameters={'waveform_approximant': 'IMRPhenomPv2', 'reference_frequency': 50})
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=interferometers[0].duration,
sampling_frequency=interferometers[
0].sampling_frequency,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters={'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.
......
......@@ -68,9 +68,9 @@ fig.savefig('{}/data.png'.format(outdir))
# name doesn't make so much sense. But essentially this is an objects that
# can generate a signal. We give it information on how to make the time series
# and the model() we wrote earlier.
waveform_generator = tupak.waveform_generator.WaveformGenerator(
sampling_frequency=sampling_frequency, time_duration=time_duration,
time_domain_source_model=model)
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=time_duration,
sampling_frequency=sampling_frequency,
time_domain_source_model=model)
# Now lets instantiate a version of out Likelihood, giving it the time, data
......
......@@ -32,9 +32,8 @@ simulation_parameters = dict(
psi=2.659
)
waveform_generator = WaveformGenerator(frequency_domain_source_model=tupak.source.lal_binary_black_hole,
sampling_frequency=sampling_frequency,
time_duration=time_duration,
waveform_generator = WaveformGenerator(time_duration=time_duration, sampling_frequency=sampling_frequency,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters=simulation_parameters)
signal = waveform_generator.frequency_domain_strain()
......
......@@ -17,8 +17,8 @@ def gaussian_frequency_domain_strain_2(frequency_array, a, m, s, ra, dec, geocen
class TestWaveformGeneratorInstantiationWithoutOptionalParameters(unittest.TestCase):
def setUp(self):
self.waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=gaussian_frequency_domain_strain)
self.waveform_generator = tupak.waveform_generator.WaveformGenerator(1, 4096,
frequency_domain_source_model=gaussian_frequency_domain_strain)
self.simulation_parameters = dict(amplitude=1e-21, mu=100, sigma=1,
ra=1.375,
dec=-1.2108,
......@@ -52,8 +52,8 @@ class TestWaveformGeneratorInstantiationWithoutOptionalParameters(unittest.TestC
class TestParameterSetter(unittest.TestCase):
def setUp(self):
self.waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=gaussian_frequency_domain_strain)
self.waveform_generator = tupak.waveform_generator.WaveformGenerator(1, 4096,
frequency_domain_source_model=gaussian_frequency_domain_strain)
self.simulation_parameters = dict(amplitude=1e-21, mu=100, sigma=1,
ra=1.375,
dec=-1.2108,
......@@ -91,8 +91,8 @@ class TestParameterSetter(unittest.TestCase):
class TestSourceModelSetter(unittest.TestCase):
def setUp(self):
self.waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=gaussian_frequency_domain_strain)
self.waveform_generator = tupak.waveform_generator.WaveformGenerator(1, 4096,
frequency_domain_source_model=gaussian_frequency_domain_strain)
self.waveform_generator.frequency_domain_source_model = gaussian_frequency_domain_strain_2
self.simulation_parameters = dict(amplitude=1e-21, mu=100, sigma=1,
ra=1.375,
......
......@@ -150,12 +150,12 @@ def get_binary_black_hole_likelihood(interferometers):
likelihood: tupak.likelihood.Likelihood
The likelihood to pass to `run_sampler`
"""
waveform_generator = tupak.waveform_generator.WaveformGenerator(
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
sampling_frequency=interferometers[0].sampling_frequency,
time_duration=interferometers[0].duration,
parameters={'waveform_approximant': 'IMRPhenomPv2',
'reference_frequency': 50})
waveform_generator = tupak.waveform_generator.WaveformGenerator(time_duration=interferometers[0].duration,
sampling_frequency=interferometers[
0].sampling_frequency,
frequency_domain_source_model=tupak.source.lal_binary_black_hole,
parameters={'waveform_approximant': 'IMRPhenomPv2',
'reference_frequency': 50})
likelihood = tupak.likelihood.Likelihood(
interferometers, waveform_generator)
return likelihood
......
......@@ -23,8 +23,8 @@ class WaveformGenerator(object):
"""
def __init__(self, frequency_domain_source_model=None, time_domain_source_model=None, sampling_frequency=4096, time_duration=1,
parameters=None):
def __init__(self, time_duration, sampling_frequency, frequency_domain_source_model=None,
time_domain_source_model=None, parameters=None):
self.time_duration = time_duration
self.sampling_frequency = sampling_frequency
self.frequency_domain_source_model = frequency_domain_source_model
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment