dsp_recorder_plot.py : Initial commit of plotter for cwDspTransforms:recorder.

This commit is contained in:
kevin 2021-12-19 12:21:02 -05:00
parent f8d155baaa
commit 1c39480b6f

38
dsp_recorder_plot.py Normal file
View File

@ -0,0 +1,38 @@
# Plot the output of a libcw:cwDspTransform.cpp: 'recorder' object.
import sys,os,json
import matplotlib.pyplot as plt
def plot_file( fname ):
r = None
with open(fname,"r") as f:
r = json.load(f)
idx = 0
while True:
label = "{}".format(idx)
if label not in r:
break
plt.plot(r[label])
idx += 1
plt.show()
if __name__ == "__main__":
fname = os.path.expanduser("~/temp/temp_1.json")
if len(sys.argv) > 1:
fname = sys.argv[1]
plot_file( fname )