ex-6: generated plots

All the usefull plots were generated and the codes were suitably modified
for this purpose.
This commit is contained in:
Giù Marcer 2020-05-21 18:47:44 +02:00 committed by rnhmjoj
parent cf0a3216b3
commit 5634f2f418
15 changed files with 102 additions and 18 deletions

View File

@ -6,7 +6,8 @@ import sys
n = int(input()) n = int(input())
a, b, f = loadtxt(sys.stdin, unpack=True) 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) subplot(131)
title('FFT') 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) ticklabel_format(style='sci', axis='x', scilimits=(0, 0), useMathText=True)
tight_layout() tight_layout()
show()
name = (sys.argv[1] if len(sys.argv) > 1 else "prova")
savefig('notes/images/' + name + '.pdf' )

View File

@ -3,7 +3,8 @@
from pylab import * from pylab import *
import sys import sys
rcParams['font.size'] = 12 plt.figure(figsize=(5, 3))
rcParams['font.size'] = 8
a, b, f = loadtxt(sys.stdin, unpack=True) a, b, f = loadtxt(sys.stdin, unpack=True)
title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right') 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') histtype='stepfilled', color='#e3c5ca', edgecolor='#92182b')
xlabel(r'$\theta$ (radians)') xlabel(r'$\theta$ (radians)')
ylabel(r'$I(\theta)$ (a.u.)') ylabel(r'$I(\theta)$ (a.u.)')
tight_layout() tight_layout()
show() name = sys.argv[2] if len(sys.argv) > 2 else "prova"
savefig('notes/images/' + name + '.pdf' )

View File

@ -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

View File

@ -3,10 +3,11 @@ import matplotlib.pyplot as plt
def plot(table, title='', log=False): 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.suptitle(title)
plt.subplot(211) plt.subplot(111)
if log: if log:
plt.xscale('log') plt.xscale('log')
plt.title('EMD' + ' '*10, loc='right') plt.title('EMD' + ' '*10, loc='right')
@ -24,20 +25,22 @@ def plot(table, title='', log=False):
twin.ticklabel_format(style='sci', axis='y', twin.ticklabel_format(style='sci', axis='y',
scilimits=(0, 0), useMathText=True) scilimits=(0, 0), useMathText=True)
plt.subplot(212) # plt.subplot(212)
if log: # if log:
plt.xscale('log') # plt.xscale('log')
plt.title('skewness', loc='right') # plt.title('skewness', loc='right')
plt.xlabel('RL rounds') # plt.xlabel('RL rounds')
plt.plot(table[0], table[3], color='xkcd:gray') # plt.plot(table[0], table[3], color='xkcd:gray')
plt.tight_layout() 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].T, title='noiseless', log=True)
plot(table[27:47].T, title=r'noise at $\sigma=0.005$') plot(table[27:47].T, title=r'noise at $\sigma_N = 0.005$')
plot(table[47:67].T, title=r'noise at $\sigma=0.01$') plt.savefig('notes/images/6-rounds-noise-0.005.pdf')
plot(table[67:].T, title=r'noise at $\sigma=0.05$') plot(table[47:67].T, title=r'noise at $\sigma_N = 0.01$')
plt.show() 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')

Binary file not shown.

BIN
notes/images/6-noisy.pdf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.