ex-6: an unexplainable error occurred. Fixed
This commit is contained in:
parent
7ad45a829e
commit
49e9fbd5b7
@ -6,9 +6,7 @@ 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, 2.5))
|
figure()
|
||||||
plt.rcParams['font.size'] = 8
|
|
||||||
|
|
||||||
subplot(131)
|
subplot(131)
|
||||||
title('FFT')
|
title('FFT')
|
||||||
xlabel('EMD', x=0)
|
xlabel('EMD', x=0)
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
from pylab import *
|
from pylab import *
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
plt.figure(figsize=(5, 3))
|
figure()
|
||||||
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')
|
||||||
@ -13,5 +12,7 @@ hist(a, np.insert(b, 0, a[0]), weights=100*f/sum(f),
|
|||||||
xlabel(r'$\theta$ (radians)')
|
xlabel(r'$\theta$ (radians)')
|
||||||
ylabel(r'$I(\theta)$ (a.u.)')
|
ylabel(r'$I(\theta)$ (a.u.)')
|
||||||
|
|
||||||
|
xlabel('$\\theta$')
|
||||||
|
ylabel('$I(\\theta)$')
|
||||||
tight_layout()
|
tight_layout()
|
||||||
show()
|
show()
|
||||||
|
@ -6,8 +6,7 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def plot(table, title='', log=False):
|
def plot(table, title='', log=False):
|
||||||
plt.figure(figsize=(5, 2))
|
plt.figure()
|
||||||
plt.rcParams['font.size'] = 8
|
|
||||||
plt.suptitle(title)
|
plt.suptitle(title)
|
||||||
|
|
||||||
plt.subplot(111)
|
plt.subplot(111)
|
||||||
@ -32,13 +31,18 @@ def plot(table, title='', log=False):
|
|||||||
|
|
||||||
file = sys.argv[1] if len(sys.argv) > 1 else 'noiseless'
|
file = sys.argv[1] if len(sys.argv) > 1 else 'noiseless'
|
||||||
table = np.loadtxt('ex-6/plots/emd-' + file + '.txt')
|
table = np.loadtxt('ex-6/plots/emd-' + file + '.txt')
|
||||||
|
|
||||||
if file == 'noiseless':
|
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[31:51].T, title=r'noise at $\sigma_N = 0.005$')
|
||||||
plot(table[51:].T, title=r'noise at $\sigma_N = 0.01$')
|
plot(table[51:].T, title=r'noise at $\sigma_N = 0.01$')
|
||||||
else:
|
else:
|
||||||
plot(table[:20].T, title=r'noise at $\sigma_N = 0.005$')
|
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[20:40].T, title=r'noise at $\sigma_N = 0.005$')
|
||||||
plot(table[40:].T, title=r'noise at $\sigma_N = 0.01$')
|
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user