Commit bbd1b4c3 authored by moritz's avatar moritz
Browse files

Moritz Huebner: Added proper handling of None for parameters

parent 6747502a
......@@ -22,11 +22,12 @@ class WaveformGenerator(object):
"""
def __init__(self, source_model, sampling_frequency=4096, time_duration=1):
def __init__(self, source_model, sampling_frequency=4096, time_duration=1,
parameters=None):
self.time_duration = time_duration
self.sampling_frequency = sampling_frequency
self.source_model = source_model
self.parameters = inspect.getargspec(source_model).args
self.parameters = parameters
@property
def frequency_array(self):
......@@ -48,7 +49,11 @@ class WaveformGenerator(object):
@parameters.setter
def parameters(self, parameters):
if isinstance(parameters, list):
if parameters is None:
parameters = inspect.getargspec(self.source_model).args
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
elif isinstance(parameters, list):
parameters.pop(0)
self.__parameters = dict.fromkeys(parameters)
elif isinstance(parameters, dict):
......
......@@ -32,7 +32,9 @@ simulation_parameters = dict(
# Create the waveform_generator using a LAL BinaryBlackHole source function
waveform_generator = peyote.waveform_generator.WaveformGenerator(
sampling_frequency=sampling_frequency, time_duration=time_duration, source_model=peyote.source.lal_binary_black_hole)
sampling_frequency=sampling_frequency,
time_duration=time_duration,
source_model=peyote.source.lal_binary_black_hole)
waveform_generator.parameters = simulation_parameters
hf_signal = waveform_generator.frequency_domain_strain()
......
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