Commit 810e0f9b authored by Markus Mirz's avatar Markus Mirz

fix interpolation functions

parent c9fe0586
...@@ -70,16 +70,15 @@ class TimeSeries: ...@@ -70,16 +70,15 @@ class TimeSeries:
return fft_freqs[:freqs_num], np.abs(fft_values[:freqs_num])/freqs_num return fft_freqs[:freqs_num], np.abs(fft_values[:freqs_num])/freqs_num
def interpolate_cmpl(self, timestep): def interpolate_cmpl(self, timestep):
""" Not tested yet! """ Interpolates complex timeseries with new timestep
Interpolates complex timeseries with timestep
:param timestep: :param timestep:
:return: :return:
""" """
interpl_time = np.arange(self.time[0], self.time[-1], timestep) interpl_time = np.arange(self.time[0], self.time[-1], timestep)
realValues = interp1d(interpl_time, self.values.real) realValues = np.interp(interpl_time, self.time, self.values.real)
imagValues = interp1d(interpl_time, self.values.imag) imagValues = np.interp(interpl_time, self.time, self.values.imag)
ts_return = TimeSeries('_intpl', time, np.vectorize(complex)(realValues, imagValues)) ts_return = TimeSeries('_intpl', interpl_time, np.vectorize(complex)(realValues, imagValues))
return timeseries return ts_return
@staticmethod @staticmethod
def multi_frequency_shift(timeseries_list, freqs_list): def multi_frequency_shift(timeseries_list, freqs_list):
...@@ -117,7 +116,19 @@ class TimeSeries: ...@@ -117,7 +116,19 @@ class TimeSeries:
ts_shift = ts.frequency_shift(freq) ts_shift = ts.frequency_shift(freq)
result_list[] = ts_shift result_list[] = ts_shift
return result_list return result_list
def interpolate_cmpl_list(timeseries_list, timestep):
""" Interpolates list of complex timeseries with new timestep
:param timestep:
result_list = {}
for name, ts in timeseries_list.items():
ts_intp = ts.interpolate_cmpl(timestep)
result_list[] = ts_intp
return result_list
@staticmethod @staticmethod
def create_emt_from_dp(timeseries_list, freqs_list, new_name = 'emt_signal'): def create_emt_from_dp(timeseries_list, freqs_list, new_name = 'emt_signal'):
""" Calculate shifted frequency results of all time series in list """ Calculate shifted frequency results of all time series in list
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