diff --git a/simulations/lib/signals/digitisedsignal.py b/simulations/lib/signals/digitisedsignal.py index a618b2a..f77c792 100755 --- a/simulations/lib/signals/digitisedsignal.py +++ b/simulations/lib/signals/digitisedsignal.py @@ -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