Commit 9585ea16 authored by moritz's avatar moritz
Browse files

Moritz Huebner: Added FFT/IFFT functionality to create strain data for both...

Moritz Huebner: Added FFT/IFFT functionality to create strain data for both domains even if only one source model is given.
parent d2193568
...@@ -35,10 +35,21 @@ class WaveformGenerator(object): ...@@ -35,10 +35,21 @@ class WaveformGenerator(object):
def frequency_domain_strain(self): def frequency_domain_strain(self):
""" Wrapper to source_model """ """ Wrapper to source_model """
return self.frequency_domain_source_model(self.frequency_array, **self.parameters) if self.frequency_domain_source_model is not None:
return self.frequency_domain_source_model(self.frequency_array, **self.parameters)
elif self.time_domain_source_model is not None:
fft_data, self.frequency_array = utils.nfft(self.time_domain_source_model(self.time_array, **self.parameters), self.sampling_frequency)
return fft_data
else:
raise RuntimeError("No source model given")
def time_domain_strain(self): def time_domain_strain(self):
return self.time_domain_source_model(self.time_array, **self.parameters) if self.time_domain_source_model is not None:
return self.time_domain_source_model(self.time_array, **self.parameters)
elif self.frequency_domain_source_model is not None:
return utils.infft(self.frequency_domain_source_model(self.frequency_array, **self.parameters))
else:
raise RuntimeError("No source model given")
@property @property
def frequency_array(self): def frequency_array(self):
...@@ -49,6 +60,10 @@ class WaveformGenerator(object): ...@@ -49,6 +60,10 @@ class WaveformGenerator(object):
self.__frequency_array_updated = True self.__frequency_array_updated = True
return self.__frequency_array return self.__frequency_array
@frequency_array.setter
def frequency_array(self, frequency_array):
self.__frequency_array = frequency_array
@property @property
def time_array(self): def time_array(self):
if self.__time_array_updated is False: if self.__time_array_updated is False:
......
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