diff --git a/ex-6/dist-plot.py b/ex-6/dist-plot.py index 16c3768..4a774b4 100755 --- a/ex-6/dist-plot.py +++ b/ex-6/dist-plot.py @@ -6,7 +6,8 @@ import sys n = int(input()) a, b, f = loadtxt(sys.stdin, unpack=True) -figure(figsize=(6.3, 3)) +figure(figsize=(6.3, 2.5)) +plt.rcParams['font.size'] = 8 subplot(131) title('FFT') @@ -29,4 +30,6 @@ hist(a[2*n:], insert(b[2*n:], 0, a[2*n]), weights=f[2*n:], ticklabel_format(style='sci', axis='x', scilimits=(0, 0), useMathText=True) tight_layout() -show() + +name = (sys.argv[1] if len(sys.argv) > 1 else "prova") +savefig('notes/images/' + name + '.pdf' ) diff --git a/ex-6/plot.py b/ex-6/plot.py index 5ab7515..0bdbe8a 100755 --- a/ex-6/plot.py +++ b/ex-6/plot.py @@ -3,7 +3,8 @@ from pylab import * import sys -rcParams['font.size'] = 12 +plt.figure(figsize=(5, 3)) +rcParams['font.size'] = 8 a, b, f = loadtxt(sys.stdin, unpack=True) title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right') @@ -11,5 +12,7 @@ hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f), histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b') xlabel(r'$\theta$ (radians)') ylabel(r'$I(\theta)$ (a.u.)') + tight_layout() -show() +name = sys.argv[2] if len(sys.argv) > 2 else "prova" +savefig('notes/images/' + name + '.pdf' ) diff --git a/ex-6/plots/emd-round-conv.txt b/ex-6/plots/emd-round-conv.txt new file mode 100644 index 0000000..40768ec --- /dev/null +++ b/ex-6/plots/emd-round-conv.txt @@ -0,0 +1,75 @@ +#rounds mean stddev skew +#σ = 1 + 1 1.88e-04 1.4e-05 0.26 + 2 3.17e-04 1.4e-05 0.19 + 3 1.80e-04 1.4e-05 0.27 + 4 2.02e-04 1.5e-05 0.21 + 5 1.70e-04 1.4e-05 0.27 + 6 1.64e-04 1.4e-05 0.27 + 7 1.75e-04 1.4e-05 0.27 + 8 1.67e-04 1.4e-05 0.27 + 9 1.61e-04 1.4e-05 0.26 + 10 1.57e-04 1.4e-05 0.25 + 11 1.59e-04 1.4e-05 0.26 + 12 1.56e-04 1.4e-05 0.25 + 13 1.54e-04 1.4e-05 0.25 + 14 1.53e-04 1.4e-05 0.25 + 15 1.51e-04 1.4e-05 0.25 + 16 1.50e-04 1.3e-05 0.25 + 17 1.49e-04 1.3e-05 0.25 + 18 1.48e-04 1.3e-05 0.25 + 19 1.46e-04 1.3e-05 0.25 + 20 1.47e-04 1.3e-05 0.25 + 40 1.35e-04 1.3e-05 0.29 + 60 1.28e-04 1.3e-05 0.31 + 80 1.24e-04 1.3e-05 0.33 + 100 1.21e-04 1.3e-05 0.35 + 400 1.02e-04 1.2e-05 0.40 + 800 9.37e-05 1.1e-05 0.36 + 1600 8.61e-05 1.0e-05 0.27 + 3800 7.98e-05 9.2e-06 0.26 + 7600 7.97e-05 9.2e-06 0.28 +10000 8.06e-05 9.2e-06 0.26 +15000 8.16e-05 9.2e-06 0.25 +#σ = 0.5 + 1 1.17e-04 8.0e-06 0.25 + 2 2.47e-05 3.0e-06 0.32 + 3 3.65e-05 3.8e-06 0.35 + 4 5.85e-05 5.4e-06 0.34 + 5 1.48e-05 3.3e-06 0.51 + 6 1.82e-05 3.0e-06 0.44 + 7 1.22e-05 3.8e-06 0.42 + 8 1.31e-05 3.6e-06 0.47 + 9 1.19e-05 3.9e-06 0.38 +10 1.17e-05 3.9e-06 0.36 +11 1.16e-05 4.0e-06 0.35 +12 1.16e-05 4.0e-06 0.34 +13 1.16e-05 4.0e-06 0.34 +14 1.16e-05 4.0e-06 0.34 +15 1.16e-05 4.0e-06 0.34 +16 1.16e-05 4.0e-06 0.34 +17 1.16e-05 4.0e-06 0.34 +18 1.16e-05 4.0e-06 0.34 +19 1.16e-05 4.0e-06 0.34 +20 1.16e-05 4.0e-06 0.34 +#σ = 0.1 + 1 4.23e-16 3.1e-16 0.81 + 2 4.23e-16 3.2e-16 0.85 + 3 4.24e-16 3.1e-16 0.87 + 4 4.24e-16 3.1e-16 0.88 + 5 4.25e-16 3.2e-16 0.82 + 6 4.25e-16 3.2e-16 0.82 + 7 4.24e-16 3.1e-16 0.87 + 8 4.24e-16 3.1e-16 0.87 + 9 4.24e-16 3.1e-16 0.87 +10 4.25e-16 3.2e-16 0.82 +11 4.25e-16 3.2e-16 0.82 +12 4.24e-16 3.1e-16 0.87 +13 4.25e-16 3.2e-16 0.82 +14 4.24e-16 3.1e-16 0.87 +15 4.25e-16 3.2e-16 0.82 +16 4.24e-16 3.1e-16 0.87 +17 4.25e-16 3.2e-16 0.82 +18 4.24e-16 3.1e-16 0.87 +19 4.25e-16 3.2e-16 0.82 +20 4.24e-16 3.1e-16 0.87 diff --git a/ex-6/plots/emd-round.txt b/ex-6/plots/emd-round-noise.txt similarity index 100% rename from ex-6/plots/emd-round.txt rename to ex-6/plots/emd-round-noise.txt diff --git a/ex-6/plots/emd-round.py b/ex-6/plots/emd-round.py index 30549e3..2db2b64 100644 --- a/ex-6/plots/emd-round.py +++ b/ex-6/plots/emd-round.py @@ -3,10 +3,11 @@ import matplotlib.pyplot as plt def plot(table, title='', log=False): - plt.figure(figsize=(6.3, 6)) + plt.figure(figsize=(5, 2)) + plt.rcParams['font.size'] = 8 plt.suptitle(title) - plt.subplot(211) + plt.subplot(111) if log: plt.xscale('log') plt.title('EMD' + ' '*10, loc='right') @@ -24,20 +25,22 @@ def plot(table, title='', log=False): twin.ticklabel_format(style='sci', axis='y', scilimits=(0, 0), useMathText=True) - plt.subplot(212) - if log: - plt.xscale('log') - plt.title('skewness', loc='right') - plt.xlabel('RL rounds') - plt.plot(table[0], table[3], color='xkcd:gray') + # plt.subplot(212) + # if log: + # plt.xscale('log') + # plt.title('skewness', loc='right') + # plt.xlabel('RL rounds') + # plt.plot(table[0], table[3], color='xkcd:gray') plt.tight_layout() -table = np.loadtxt('ex-6/plots/emd-round.txt') +table = np.loadtxt('ex-6/plots/emd-round-noise.txt') -plot(table[:27].T, title='noiseless', log=True) -plot(table[27:47].T, title=r'noise at $\sigma=0.005$') -plot(table[47:67].T, title=r'noise at $\sigma=0.01$') -plot(table[67:].T, title=r'noise at $\sigma=0.05$') -plt.show() +# plot(table[:27].T, title='noiseless', log=True) +plot(table[27:47].T, title=r'noise at $\sigma_N = 0.005$') +plt.savefig('notes/images/6-rounds-noise-0.005.pdf') +plot(table[47:67].T, title=r'noise at $\sigma_N = 0.01$') +plt.savefig('notes/images/6-rounds-noise-0.01.pdf') +plot(table[67:].T, title=r'noise at $\sigma_N = 0.05$') +plt.savefig('notes/images/6-rounds-noise-0.05.pdf') diff --git a/notes/images/6-emd-rounds-0.005.pdf b/notes/images/6-noise-rounds-0.005.pdf similarity index 67% rename from notes/images/6-emd-rounds-0.005.pdf rename to notes/images/6-noise-rounds-0.005.pdf index a900305..669171c 100644 Binary files a/notes/images/6-emd-rounds-0.005.pdf and b/notes/images/6-noise-rounds-0.005.pdf differ diff --git a/notes/images/6-noise-rounds-0.01.pdf b/notes/images/6-noise-rounds-0.01.pdf new file mode 100644 index 0000000..1512449 Binary files /dev/null and b/notes/images/6-noise-rounds-0.01.pdf differ diff --git a/notes/images/6-emd-rounds-0.pdf b/notes/images/6-noise-rounds-0.05.pdf similarity index 60% rename from notes/images/6-emd-rounds-0.pdf rename to notes/images/6-noise-rounds-0.05.pdf index 02c7a92..ff6b5c3 100644 Binary files a/notes/images/6-emd-rounds-0.pdf and b/notes/images/6-noise-rounds-0.05.pdf differ diff --git a/notes/images/6-noisy.pdf b/notes/images/6-noisy.pdf new file mode 100644 index 0000000..71b0316 Binary files /dev/null and b/notes/images/6-noisy.pdf differ diff --git a/notes/images/6-nonoise-emd-0.1.pdf b/notes/images/6-nonoise-emd-0.1.pdf new file mode 100644 index 0000000..6d0f914 Binary files /dev/null and b/notes/images/6-nonoise-emd-0.1.pdf differ diff --git a/notes/images/6-nonoise-emd-0.5.pdf b/notes/images/6-nonoise-emd-0.5.pdf new file mode 100644 index 0000000..76f7433 Binary files /dev/null and b/notes/images/6-nonoise-emd-0.5.pdf differ diff --git a/notes/images/6-nonoise-emd-1.pdf b/notes/images/6-nonoise-emd-1.pdf new file mode 100644 index 0000000..158daba Binary files /dev/null and b/notes/images/6-nonoise-emd-1.pdf differ diff --git a/notes/images/6-emd-rounds-0.01.pdf b/notes/images/6-nonoise-rounds-0.1.pdf similarity index 69% rename from notes/images/6-emd-rounds-0.01.pdf rename to notes/images/6-nonoise-rounds-0.1.pdf index 0642ee9..0f071bb 100644 Binary files a/notes/images/6-emd-rounds-0.01.pdf and b/notes/images/6-nonoise-rounds-0.1.pdf differ diff --git a/notes/images/6-emd-rounds-0.05.pdf b/notes/images/6-nonoise-rounds-0.5.pdf similarity index 69% rename from notes/images/6-emd-rounds-0.05.pdf rename to notes/images/6-nonoise-rounds-0.5.pdf index 2baf84c..56cfe1e 100644 Binary files a/notes/images/6-emd-rounds-0.05.pdf and b/notes/images/6-nonoise-rounds-0.5.pdf differ diff --git a/notes/images/6-nonoise-rounds-1.pdf b/notes/images/6-nonoise-rounds-1.pdf new file mode 100644 index 0000000..655a3fc Binary files /dev/null and b/notes/images/6-nonoise-rounds-1.pdf differ