aboutsummaryrefslogtreecommitdiff
path: root/devlib/instrument/frames.py
diff options
context:
space:
mode:
Diffstat (limited to 'devlib/instrument/frames.py')
-rw-r--r--devlib/instrument/frames.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/devlib/instrument/frames.py b/devlib/instrument/frames.py
index d5a2147..a2e06b3 100644
--- a/devlib/instrument/frames.py
+++ b/devlib/instrument/frames.py
@@ -1,3 +1,4 @@
+from __future__ import division
from devlib.instrument import (Instrument, CONTINUOUS,
MeasurementsCsv, MeasurementType)
from devlib.utils.rendering import (GfxinfoFrameCollector,
@@ -16,9 +17,11 @@ class FramesInstrument(Instrument):
self.collector_target = collector_target
self.period = period
self.keep_raw = keep_raw
+ self.sample_rate_hz = 1 / self.period
self.collector = None
self.header = None
self._need_reset = True
+ self._raw_file = None
self._init_channels()
def reset(self, sites=None, kinds=None, channels=None):
@@ -26,6 +29,7 @@ class FramesInstrument(Instrument):
self.collector = self.collector_cls(self.target, self.period,
self.collector_target, self.header)
self._need_reset = False
+ self._raw_file = None
def start(self):
if self._need_reset:
@@ -37,13 +41,15 @@ class FramesInstrument(Instrument):
self._need_reset = True
def get_data(self, outfile):
- raw_outfile = None
if self.keep_raw:
- raw_outfile = outfile + '.raw'
- self.collector.process_frames(raw_outfile)
+ self._raw_file = outfile + '.raw'
+ self.collector.process_frames(self._raw_file)
active_sites = [chan.label for chan in self.active_channels]
self.collector.write_frames(outfile, columns=active_sites)
- return MeasurementsCsv(outfile, self.active_channels)
+ return MeasurementsCsv(outfile, self.active_channels, self.sample_rate_hz)
+
+ def get_raw(self):
+ return [self._raw_file] if self._raw_file else []
def _init_channels(self):
raise NotImplementedError()