-
Notifications
You must be signed in to change notification settings - Fork 0
/
commutation_error.py
50 lines (35 loc) · 1.36 KB
/
commutation_error.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# File name: commutation_error.py
# Created by: gemusia
# Creation date: 02-08-2017
# Last modified: 03-08-2017 12:38:33
# Purpose:draws commutation error coefficients
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import numpy as np
import matplotlib.pyplot as plt
import homfigs as hfig
from os.path import expanduser
n = 32
def f(x):
return (np.sin((x+1)/32.0*np.pi)*np.sin((x-1)/32.0*np.pi) - (np.sin(x/32.0*np.pi))**2)/(np.sin(x/32.0*np.pi)*np.sin((x-1)/32.0*np.pi)*(np.sin(x/32.0*np.pi)+np.sin((x-1)/32.0*np.pi)))
def g(x):
return 1/6.0*np.pi*(np.sin(np.pi/64.0))**2*(np.sin(2*np.pi*x))
def h(x):
return np.sin(np.pi/(2*n))*np.cos(x/float(n)*np.pi)/( np.cos(np.pi/(2*n))*np.sin(x/float(n)*np.pi))
y = np.arange(2,31,1)
z = np.arange(0,1,0.1)
print z
print g(z)
file_path = expanduser("~") + "/Documents/Doktorat_current/picts/"
pict_path = file_path
asymmetry_coeff = hfig.Homfig(title= "Difference of right and left side wall-normal filter",
ylabel="$c$", xlabel="y", xlim=[1,31])
# ylabel="$c$", xlabel="y", xlim=[0,1])
plotFileName = pict_path + "filter_skewness.eps"
asymmetry_coeff.add_plot(h(y))
asymmetry_coeff.hdraw()
asymmetry_coeff.save(plotFileName)
print "plot created: " + plotFileName
plt.close(asymmetry_coeff.fig)