Commit 108d4c8b authored by Markus Mirz's avatar Markus Mirz

add timeseries interpolation for real type

parent 2c01763e
......@@ -69,6 +69,16 @@ class TimeSeries:
return fft_freqs[:freqs_num], np.abs(fft_values[:freqs_num])/freqs_num
def interpolate(self, timestep):
""" Interpolates timeseries with new timestep
:param timestep:
:return:
"""
interpl_time = np.arange(self.time[0], self.time[-1], timestep)
values = np.interp(interpl_time, self.time, self.values)
ts_return = TimeSeries(self.name+'_intpl', interpl_time, values)
return ts_return
def interpolate_cmpl(self, timestep):
""" Interpolates complex timeseries with new timestep
:param timestep:
......@@ -117,6 +127,18 @@ class TimeSeries:
result_list[ts.name] = ts_shift
return result_list
@staticmethod
def interpolate_list(timeseries_list, timestep):
""" Interpolates timeseries list with new timestep
:param timestep:
:return:
"""
result_list = {}
for name, ts in timeseries_list.items():
ts_intp = ts.interpolate(timestep)
result_list[ts_intp.name] = ts_intp
return result_list
@staticmethod
def interpolate_cmpl_list(timeseries_list, timestep):
""" Interpolates list of complex timeseries with new timestep
......
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