From 7f8a99795f81eb8659e347764295887232d0dc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 9 Feb 2020 22:40:52 +0100 Subject: Add power level distribution plot of the Crocell kit snare. --- .../power_level_distribution/plot_histogram.py | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py (limited to 'sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py') diff --git a/sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py b/sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py new file mode 100755 index 0000000..f1989f2 --- /dev/null +++ b/sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +import numpy as np +import matplotlib.mlab as mlab +import matplotlib.pyplot as plt +import sys + +if len(sys.argv) != 3: + print("Wrong number of arguments.") + print("USAGE: ./plot_histogram.py ") + quit() + +input_file = sys.argv[1] +output_file = sys.argv[2] + +f = open(input_file) +X = [float(i) for i in f.readlines()] +X.sort() + +# the histogram of the data +n, bins, patches = plt.hist(X, facecolor='red') + +# add a 'best fit' line +# y = mlab.normpdf( bins, mu, sigma) +# l = plt.plot(bins, y, 'r--', linewidth=1) + +plt.xlabel('Power Level') +plt.ylabel('Number of Samples') +# plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$') +# plt.axis([40, 160, 0, 0.03]) + +# TODO: adapt for different drum kits! +# plt.xlim(0,97) +plt.grid(True) + +plt.savefig(output_file) -- cgit v1.2.3