File: plot_resampler_test_dump.py

package info (click to toggle)
roc-toolkit 0.4.0%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,684 kB
  • sloc: cpp: 102,987; ansic: 8,959; python: 6,125; sh: 942; makefile: 16; javascript: 9
file content (35 lines) | stat: -rwxr-xr-x 687 bytes parent folder | download
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
#!/usr/bin/env python3
#
# usage:
# roc-test-audio -v -g resampler -n upscale_downscale_mono |& \
#  ./scripts/plot_resampler_test_dump.py
#
import pylab
import numpy
import re
import fileinput

orig = []
proc = []

for line in fileinput.input():
    m = re.search('roc_test: dump (\S+) (\S+)', line)
    if m:
        orig.append(float(m.group(1)))
        proc.append(float(m.group(2)))

orig = numpy.array(orig)
proc = numpy.array(proc)

_, px = pylab.subplots(2, 1, sharex=True)

px[0].plot(orig, '.-', label='orig')
px[0].plot(proc, '.-', label='proc')
px[0].legend()
px[0].grid()

px[1].plot(numpy.abs(orig-proc), '.-', label='abs(diff)')
px[1].legend()
px[1].grid()

pylab.show()