summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2020-02-09 18:09:25 +0100
committerAndré Nusser <andre.nusser@googlemail.com>2020-02-09 18:09:25 +0100
commit630de07ec76cea8d7dff038afa05a90e3ec8967a (patch)
treeabd049aed5e0f4c887fa23bfa00d9d4d6ab87702
parentc5b234c7ff7a1ebb178b0eb0c9ec491e715d7c14 (diff)
Fix plots.
-rwxr-xr-xsampling_alg_lac2020/midi_tests/plot_histogram.py14
-rwxr-xr-xsampling_alg_lac2020/midi_tests/test_and_plot.sh36
2 files changed, 31 insertions, 19 deletions
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