libcw/py/dsp_recorder_plot.py

39 lines
584 B
Python
Raw Permalink Normal View History

2024-07-07 17:36:42 +00:00
# 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 )