Commit 8ca3964e authored by moritz's avatar moritz
Browse files

Moritz Huebner: Fixed waveform generator with GW150914.py

parent 60a339df
Pipeline #18683 failed with stages
in 59 seconds
......@@ -54,7 +54,7 @@ waveform_generator = tupak.waveform_generator.WaveformGenerator(
# function, passing it the data and the waveform generator.
likelihood = tupak.likelihood.Likelihood(interferometers, waveform_generator)
# Finally, we run the sampler. This function takes the likelihood and prior
# Finally, we run the sampler. This function takes the likelihood and prio
# along with some options for how to do the sampling and how to save the data
result = tupak.sampler.run_sampler(likelihood, prior, sampler='dynesty',
outdir=outdir, label=label)
......
......@@ -92,31 +92,27 @@ class WaveformGenerator(object):
@parameters.setter
def parameters(self, parameters):
if parameters is None:
if self.frequency_domain_source_model is not None:
parameters = inspect.getargspec(self.frequency_domain_source_model).args
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
elif self.time_domain_source_model is not None:
parameters = inspect.getargspec(self.time_domain_source_model).args
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
elif isinstance(parameters, list):
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
self.__parameters_from_source_model()
elif isinstance(parameters, dict):
if not hasattr(self, '_WaveformGenerator__parameters'):
self.__parameters = parameters
self.__parameters_from_source_model()
for key in self.__parameters.keys():
if key in parameters.keys():
self.__parameters[key] = parameters[key]
else:
raise KeyError('The provided dictionary did not '
'contain key {}'.format(key))
else:
raise TypeError('Parameters must either be set as a list of keys or'
' a dictionary of key-value pairs.')
def __parameters_from_source_model(self):
if self.frequency_domain_source_model is not None:
parameters = inspect.getargspec(self.frequency_domain_source_model).args
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
elif self.time_domain_source_model is not None:
parameters = inspect.getargspec(self.time_domain_source_model).args
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
@property
def time_duration(self):
return self.__time_duration
......
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