-
Notifications
You must be signed in to change notification settings - Fork 37
/
report-ms5837.py
39 lines (28 loc) · 1007 Bytes
/
report-ms5837.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python3
import matplotlib.pyplot as plt
DEVICE = 'ms5837'
def generate_figures(log):
footer = f'{DEVICE} test report'
f, spec = log.figure(height_ratios=[1,1], suptitle=f'{DEVICE} data', footer=footer)
""" TODO: uncomment once rom and config are available from test-ms5837.py
plt.subplot(spec[0,0])
log.rom.T.ttable(rl=True)
plt.subplot(spec[0,1])
log.config.T.ttable(rl=True)
"""
plt.subplot(spec[1,:])
log.data.pressure.pplot(log.data.temperature)
if __name__ == '__main__':
from llog import LLogReader
from matplotlib.backends.backend_pdf import PdfPages
parser = LLogReader.create_default_parser(__file__, DEVICE)
args = parser.parse_args()
log = LLogReader(args.input, args.meta)
generate_figures(log)
if args.output:
# todo check if it exists!
with PdfPages(args.output) as pdf:
for n in plt.get_fignums():
pdf.savefig(n)
if args.show:
plt.show()