From 1c39480b6fb422726ae8fafa76dd5d3dffd62191 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 19 Dec 2021 12:21:02 -0500 Subject: [PATCH] dsp_recorder_plot.py : Initial commit of plotter for cwDspTransforms:recorder. --- dsp_recorder_plot.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 dsp_recorder_plot.py diff --git a/dsp_recorder_plot.py b/dsp_recorder_plot.py new file mode 100644 index 0000000..0ea062c --- /dev/null +++ b/dsp_recorder_plot.py @@ -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 ) + +