diff --git a/pmt-view/main.py b/pmt-view/main.py index 79d1622dde1a8bd7352b4d9cd12a0978029fd669..bbfecc67728e93a3f290d36fddff795be118b273 100644 --- a/pmt-view/main.py +++ b/pmt-view/main.py @@ -1,5 +1,5 @@ from argparse import ArgumentParser -import pmt +import pypmt import time from bokeh.plotting import figure from bokeh.io import show @@ -7,6 +7,7 @@ from bokeh.embed import file_html from bokeh.io import curdoc from bokeh.models import ColumnDataSource import config +import pmt def parse_args(): @@ -78,20 +79,22 @@ class Display: def callback(self): if self.state is None: + #first read is garbage + self.state = self.sensor.read() self.state = self.sensor.read() time.sleep(1) n_state = self.sensor.read() - self.cur_second += pmt.seconds(self.state, n_state) + self.cur_second += pypmt.PMT.seconds(self.state, n_state) row = { "Joules": [ - pmt.joules(self.state, n_state), + pypmt.PMT.joules(self.state, n_state), ], - "Watts": [pmt.joules(self.state, n_state)], + "Watts": [pypmt.PMT.joules(self.state, n_state)], "Average watts": [ - pmt.joules(self.state, n_state) / pmt.seconds(self.state, n_state) + pypmt.PMT.joules(self.state, n_state) / pypmt.PMT.seconds(self.state, n_state) ], "Average joules": [ - pmt.watts(self.state, n_state) / pmt.seconds(self.state, n_state) + pypmt.PMT.watts(self.state, n_state) / pypmt.PMT.seconds(self.state, n_state) ], "Seconds": [self.cur_second], }