def test_trimmed_array(self, default_array): """ ensure the array was trimmed when a negative time_before is used """ negative_pad_time = pad_time(default_array, time_before=self.negative_time) old_time = default_array.time.values new_time = negative_pad_time.time.values assert old_time[0] - new_time[0] == self.negative_time
def test_start_zeroed(self, default_array): """ ensure the zeroed array starts at zero """ zeroed = pad_time( default_array, time_before=self.time_before, start_at_zero=True ) t1 = zeroed.time t2 = default_array.time assert t1[0] == 0 assert t1[-1] > t2[-1]
def test_start_end_padding(self, default_array): """ ensure the end and start can be padded """ padded = pad_time( default_array, time_after=self.time_after, time_before=self.time_before ) dtimes = default_array.time times = padded.time assert times[0] == -self.time_before duration = times[-1] - times[0] dduration = dtimes[-1] - times[0] assert duration > dduration
def padded_array(self, default_array): """ pad the default array """ return pad_time(default_array, total_time=self.total_time)