Simu: add raw_time func to DigiSignal

This commit is contained in:
Eric Teunis de Boone 2022-04-11 12:22:15 +02:00
parent 73b7fcb601
commit d0817560ae

View file

@ -82,11 +82,14 @@ class DigitisedSignal(Signal):
def __len__(self):
return self.sample_length
def raw_time(self):
return np.arange(0, self.time_length, 1/self.sample_rate)
def _translate(self, t_f = None, x_f = None, t_0 = None, x_0 = None, velocity = None):
"""
Translate the signal from (t_0, x_0) to (t_f, x_f) with optional velocity.
Returns the signal at (t_f, x_f)
Returns the signal at (t_f, x_f) and the total time offset
"""
total_time_offset = self.total_time_offset(t_f=t_f, x_f=x_f, t_0=t_0, x_0=x_0, velocity=velocity)
@ -137,7 +140,7 @@ class DigitisedSignal(Signal):
amplitude = self.raw[n_offset_int]
if not self.periodic:
if hasattr(amplitude, 'ndim'):
if hasattr(amplitude, 'ndim') and amplitude.ndim > 0:
amplitude[mask_idx] = 0
return amplitude, total_time_offset