Skip to content
Snippets Groups Projects
Commit 568769cd authored by Mattia Mancini's avatar Mattia Mancini
Browse files

Adapt to new pmt interface and fix invalid read

parent 827327c3
Branches
No related tags found
No related merge requests found
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],
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment