1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 from timeside.core import implements, interfacedoc
23 from timeside.analyzer.core import Analyzer
24 from timeside.api import IValueAnalyzer
25 import numpy
29 implements(IValueAnalyzer)
30
31 @interfacedoc
32 - def setup(self, channels=None,
33 samplerate=None,
34 blocksize=None,
35 totalframes=None):
39
40 @staticmethod
41 @interfacedoc
43 return "mean_dc_shift"
44
45 @staticmethod
46 @interfacedoc
48 return "Mean DC shift"
49
50 @staticmethod
51 @interfacedoc
54
55 - def process(self, frames, eod=False):
56 if frames.size:
57 self.values = numpy.append(self.values, numpy.mean(frames))
58 return frames, eod
59
60 - def post_process(self):
61 dc_result = self.new_result(data_mode='value', time_mode='global')
62 dc_result.data_object.value = numpy.round(
63 numpy.mean(100 * self.values), 3)
64 self.process_pipe.results.add(dc_result)
65