Use the longterm script for daily image generation

This commit is contained in:
Thomas Kolb 2023-07-02 16:29:07 +02:00
parent 0d3b5a9c19
commit cb26f47e5f
2 changed files with 8 additions and 10 deletions

View file

@ -1,7 +1,5 @@
PYTHON=python
SRCS:=$(wildcard logs/*.csv) SRCS:=$(wildcard logs/*.csv)
IMGS1:=$(patsubst %.csv, %-avg.webp, $(SRCS)) IMGS1:=$(patsubst %.csv, %-avg_pwr.webp, $(SRCS))
IMGS2:=$(patsubst %.csv, %-peak.webp, $(SRCS)) IMGS2:=$(patsubst %.csv, %-peak.webp, $(SRCS))
IMGS:=$(patsubst logs/%, imgs/%, $(IMGS1) $(IMGS2)) IMGS:=$(patsubst logs/%, imgs/%, $(IMGS1) $(IMGS2))
@ -11,27 +9,27 @@ all: imgs/ $(IMGS)
imgs/: imgs/:
mkdir -p $@ mkdir -p $@
imgs/%-avg.webp: logs/%.csv imgs/%-avg_pwr.webp: logs/%.csv
tmpfile=$$(mktemp /tmp/spec.XXXXX.png) && \ tmpfile=$$(mktemp /tmp/spec.XXXXX.png) && \
$(PYTHON) ./plot_wf.py avg 60 $< $$tmpfile && \ ./plot_wf_longterm.py -a avg_pwr -r 60 -o $$tmpfile $< && \
convert $$tmpfile -quality 100 $@ && \ convert $$tmpfile -quality 100 $@ && \
rm $$tmpfile rm $$tmpfile
imgs/%-peak.webp: logs/%.csv imgs/%-peak.webp: logs/%.csv
tmpfile=$$(mktemp /tmp/spec.XXXXX.png) && \ tmpfile=$$(mktemp /tmp/spec.XXXXX.png) && \
$(PYTHON) ./plot_wf.py peak 60 $< $$tmpfile && \ ./plot_wf_longterm.py -a peak -r 60 -o $$tmpfile $< && \
convert $$tmpfile -quality 100 $@ && \ convert $$tmpfile -quality 100 $@ && \
rm $$tmpfile rm $$tmpfile
# high-resolution (in time) images, not generated by default # high-resolution (in time) images, not generated by default
IMGS_HIGHRES:=$(patsubst %.csv, %-highres.webp, $(SRCS)) IMGS_HIGHRES:=$(patsubst %.csv, %-avg_pwr-highres.webp, $(SRCS))
.PHONY: highres .PHONY: highres
highres: imgs/ $(IMGS_HIGHRES) highres: imgs/ $(IMGS_HIGHRES)
imgs/%-highres.webp: logs/%.csv imgs/%-avg_pwr-highres.webp: logs/%.csv
tmpfile=$$(mktemp /tmp/spec.XXXXX.png) && \ tmpfile=$$(mktemp /tmp/spec.XXXXX.png) && \
$(PYTHON) ./plot_wf.py avg 10 $< $$tmpfile && \ ./plot_wf_longterm.py -a avg_pwr -r 10 -o $$tmpfile $< && \
convert $$tmpfile -quality 100 $@ && \ convert $$tmpfile -quality 100 $@ && \
rm $$tmpfile rm $$tmpfile

View file

@ -37,7 +37,7 @@ for inputfilename in args.input:
stream = LZMAFile(filename=inputfilename, mode='r') stream = LZMAFile(filename=inputfilename, mode='r')
else: else:
print(f"Loading '{inputfilename}' as uncompressed stream...") print(f"Loading '{inputfilename}' as uncompressed stream...")
stream = open(inputfilename, 'r') stream = open(inputfilename, 'rb')
for line in stream: for line in stream:
# extract the timestamp # extract the timestamp