Ejemplo n.º 1
0
 def test_can_produce_time_slice_iterable_from_timestamps(self):
     slices = TimeSlice.slices([Seconds(1), Milliseconds(1), Seconds(2)])
     self.assertEqual(2, len(slices))
     self.assertEqual(
         TimeSlice(start=Milliseconds(1), duration=Milliseconds(999)),
         slices[0])
     self.assertEqual(TimeSlice(start=Seconds(1), duration=Seconds(1)),
                      slices[1])
Ejemplo n.º 2
0
 def _process(self, data):
     td = data.dimensions[0]
     frequency = td.frequency
     timestamps = [self.pos + (i * frequency)
             for i, d in enumerate(data)
             if random() > 0.9]
     slices = TimeSlice.slices(timestamps)
     yield VariableRateTimeSeries(
         (ts, np.zeros(0)) for ts in slices)
     self.pos += frequency * len(data)