ex-6: an unexplainable error occurred. Fixed

This commit is contained in:
Giù Marcer 2020-05-24 12:45:05 +02:00 committed by rnhmjoj
parent 7ad45a829e
commit 49e9fbd5b7
3 changed files with 12 additions and 9 deletions

View File

@ -6,9 +6,7 @@ import sys
n = int(input())
a, b, f = loadtxt(sys.stdin, unpack=True)
figure(figsize=(6.3, 2.5))
plt.rcParams['font.size'] = 8
figure()
subplot(131)
title('FFT')
xlabel('EMD', x=0)

View File

@ -3,8 +3,7 @@
from pylab import *
import sys
plt.figure(figsize=(5, 3))
rcParams['font.size'] = 8
figure()
a, b, f = loadtxt(sys.stdin, unpack=True)
title(sys.argv[1] if len(sys.argv) > 1 else "", loc='right')
@ -13,5 +12,7 @@ hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f),
xlabel(r'$\theta$ (radians)')
ylabel(r'$I(\theta)$ (a.u.)')
xlabel('$\\theta$')
ylabel('$I(\\theta)$')
tight_layout()
show()

View File

@ -6,8 +6,7 @@ import sys
def plot(table, title='', log=False):
plt.figure(figsize=(5, 2))
plt.rcParams['font.size'] = 8
plt.figure()
plt.suptitle(title)
plt.subplot(111)
@ -32,13 +31,18 @@ def plot(table, title='', log=False):
file = sys.argv[1] if len(sys.argv) > 1 else 'noiseless'
table = np.loadtxt('ex-6/plots/emd-' + file + '.txt')
if file == 'noiseless':
plot(table[:31].T, title=r'noise at $\sigma_N = 0.005$')
plot(table[:31].T, title=r'noise at $\sigma_N = 0.005$', log=True)
plot(table[31:51].T, title=r'noise at $\sigma_N = 0.005$')
plot(table[51:].T, title=r'noise at $\sigma_N = 0.01$')
else:
plot(table[:20].T, title=r'noise at $\sigma_N = 0.005$')
plot(table[20:40].T, title=r'noise at $\sigma_N = 0.005$')
plot(table[40:].T, title=r'noise at $\sigma_N = 0.01$')
plt.show()
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()