diff options
author | André Nusser <andre.nusser@googlemail.com> | 2020-02-09 22:40:52 +0100 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2020-02-09 22:41:20 +0100 |
commit | 7f8a99795f81eb8659e347764295887232d0dc4b (patch) | |
tree | d14c2e46a3f4c60305bad4b439c36a9c455cd737 /sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py | |
parent | 7e78ab7b9abb11610e7cac4e211aee5341893c9b (diff) |
Add power level distribution plot of the Crocell kit snare.
Diffstat (limited to 'sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py')
-rwxr-xr-x | sampling_alg_lac2020/figures/power_level_distribution/plot_histogram.py | 35 |
1 files changed, 35 insertions, 0 deletions
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 <input_file> <output_file>") + 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) |