From 630de07ec76cea8d7dff038afa05a90e3ec8967a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 9 Feb 2020 18:09:25 +0100 Subject: Fix plots. --- sampling_alg_lac2020/midi_tests/plot_histogram.py | 14 ++++++++- sampling_alg_lac2020/midi_tests/test_and_plot.sh | 36 +++++++++++------------ 2 files changed, 31 insertions(+), 19 deletions(-) (limited to 'sampling_alg_lac2020') diff --git a/sampling_alg_lac2020/midi_tests/plot_histogram.py b/sampling_alg_lac2020/midi_tests/plot_histogram.py index ca529b7..931e177 100755 --- a/sampling_alg_lac2020/midi_tests/plot_histogram.py +++ b/sampling_alg_lac2020/midi_tests/plot_histogram.py @@ -14,9 +14,19 @@ output_file = sys.argv[2] f = open(input_file) X = [int(i) for i in f.readlines()] +X.sort() + +# Y = {} +# for x in X: +# if x in Y: +# Y[x] = Y[x] + 1 +# else: +# Y[x] = 1 +# +# print(Y) # the histogram of the data -n, bins, patches = plt.hist(X, max(X)-min(X), facecolor='green') +n, bins, patches = plt.hist(X, max(X)-min(X)+1, facecolor='green') # add a 'best fit' line # y = mlab.normpdf( bins, mu, sigma) @@ -26,6 +36,8 @@ plt.xlabel('Sample Index') plt.ylabel('Number of Selections') # 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) diff --git a/sampling_alg_lac2020/midi_tests/test_and_plot.sh b/sampling_alg_lac2020/midi_tests/test_and_plot.sh index 18101fa..2c9ac32 100755 --- a/sampling_alg_lac2020/midi_tests/test_and_plot.sh +++ b/sampling_alg_lac2020/midi_tests/test_and_plot.sh @@ -1,32 +1,32 @@ # new -./run_tests.sh rise_0_127_8.mid new sweep_new_output.txt +# ./run_tests.sh rise_0_127_8.mid new sweep_new_output.txt ./plot_histogram.py sweep_new_output.txt sweep_new.pdf -# + # ./run_tests.sh 16_1016.mid new 16_new_output.txt -# ./plot_histogram.py 16_new_output.txt 16_new.pdf -# +./plot_histogram.py 16_new_output.txt 16_new.pdf + # ./run_tests.sh 48_1016.mid new 48_new_output.txt -# ./plot_histogram.py 48_new_output.txt 48_new.pdf -# +./plot_histogram.py 48_new_output.txt 48_new.pdf + # ./run_tests.sh 80_1016.mid new 80_new_output.txt -# ./plot_histogram.py 80_new_output.txt 80_new.pdf -# +./plot_histogram.py 80_new_output.txt 80_new.pdf + # ./run_tests.sh 112_1016.mid new 112_new_output.txt -# ./plot_histogram.py 112_new_output.txt 112_new.pdf +./plot_histogram.py 112_new_output.txt 112_new.pdf # old # ./run_tests.sh rise_0_127_8.mid old sweep_old_output.txt -# ./plot_histogram.py sweep_old_output.txt sweep_old.pdf -# +./plot_histogram.py sweep_old_output.txt sweep_old.pdf + # ./run_tests.sh 16_1016.mid old 16_old_output.txt -# ./plot_histogram.py 16_old_output.txt 16_old.pdf -# +./plot_histogram.py 16_old_output.txt 16_old.pdf + # ./run_tests.sh 48_1016.mid old 48_old_output.txt -# ./plot_histogram.py 48_old_output.txt 48_old.pdf -# +./plot_histogram.py 48_old_output.txt 48_old.pdf + # ./run_tests.sh 80_1016.mid old 80_old_output.txt -# ./plot_histogram.py 80_old_output.txt 80_old.pdf -# +./plot_histogram.py 80_old_output.txt 80_old.pdf + # ./run_tests.sh 112_1016.mid old 112_old_output.txt -# ./plot_histogram.py 112_old_output.txt 112_old.pdf +./plot_histogram.py 112_old_output.txt 112_old.pdf -- cgit v1.2.3