-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_scheme.py
More file actions
44 lines (35 loc) · 1.35 KB
/
plot_scheme.py
File metadata and controls
44 lines (35 loc) · 1.35 KB
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
import numpy as np
import matplotlib.pyplot as plt
import csv
def plot_wavenumber(k,mkr,mki,formula):
equation = r'$'+formula+'$'
plt.title(equation)
plt.plot(k,k, color="grey", linewidth=0.5, linestyle="-", label="exact")
plt.plot(k,mkr, color="red", linewidth=1.5, linestyle="-", label="real")
plt.plot(k,mki, color="blue", linewidth=1.5, linestyle="-", label="image")
plt.legend()
plt.xlabel('wavenumber')
plt.xlim(0, np.pi)
plt.ylabel('modified wavenumber')
plt.ylim(min(mki)*1.01, np.pi)
plt.axhline(linewidth=0.5, color='black')
plt.show()
def file_write_wavenumber(filename,k,mkr,mki):
with open(filename, "w") as f:
print("{:>18} {:>18} {:>18}".format('k','real(modified_k)','image(modified_k)'),file=f)
for n in range(0,len(k)):
print("{:.12E} {:.12E} {:.12E}".format(k[n],mkr[n],mki[n]),file=f)
print(' << ',filename)
def plot_wavenumber_filter(k,mkr,mki,formula):
equation = r'$'+formula+'$'
plt.title(equation)
plt.text(0.05, 1.1, r'$\alpha = 0.49$', fontsize=14)
plt.plot(k,mkr, color="red", linewidth=1.5, linestyle="-", label="real")
plt.plot(k,mki, color="blue", linewidth=1.5, linestyle="-", label="image")
plt.legend()
plt.xlabel('wavenumber')
plt.xlim(0, np.pi)
plt.ylabel('spectral function')
plt.ylim(-0.2, 1.2)
plt.axhline(linewidth=0.5, color='black')
plt.show()