Пример #1
0
    def GetChannelData(self, index_list, start, duration):
        freq = self.GetSamplingFrequency(index_list)

        chunk_start_index, chunk_end_index = utils.GetSampleRange(
            freq, duration, start)
        channel_dict = {}
        for index in index_list:
            key = self._lookup.GetKeyFromIndex(index)
            if self._feature[key].HasField('float_list'):
                channel_data = self._feature[key].float_list.value
            else:
                raise ValueError('Channel %s is not a float value.' % key)
            channel_dict[str(
                index)] = channel_data[chunk_start_index:chunk_end_index]
        return channel_dict
Пример #2
0
 def testGetSampleRange(self):
   self.assertEqual((10, 20), utils.GetSampleRange(1, 10, 10))