-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotLDOSAndDelta.py
143 lines (103 loc) · 3.42 KB
/
plotLDOSAndDelta.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# -*- encoding: utf-8 -*-
## @package TBTKview
# @file plotLDOS.py
# @brief Plot local density of states
#
# @author Kristofer Björnson
import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.axes
import matplotlib.cm
import scipy.ndimage.filters
import mpl_toolkits.mplot3d
import sys
from scipy.signal import find_peaks
if(len(sys.argv) != 2):
print( "Error, the following parameters are needed: .hdf5-file")
exit(1)
filename = sys.argv[1]
sigma = 0.002
peak_height = 7.5
file = h5py.File(filename, 'r');
dataset = file['LDOS']
data_dimensions = dataset.shape
y_plane = int(np.floor(data_dimensions[1]/2))
physical_dimensions = len(data_dimensions) - 1 #Last dimensions are for energy.
energy_resolution = data_dimensions[physical_dimensions];
limits = dataset.attrs['UpLowLimits']
datasetDeltaReal = file['deltaReal0']
datasetDeltaImag = file['deltaImag0']
delta = abs(np.array(datasetDeltaReal) + 1j*np.array(datasetDeltaImag))
size_x = data_dimensions[0]
size_y = data_dimensions[1]
x = np.arange(0, data_dimensions[0], 1)
y = np.arange(limits[1], limits[0], (limits[0] - limits[1])/energy_resolution)
X, Y = np.meshgrid(x, y)
fig = matplotlib.pyplot.figure()
Z = dataset[:,y_plane,:]
sigma_discrete_units = sigma*energy_resolution/(limits[0] - limits[1])
for xp in range(0, size_x):
Z[xp,:] = scipy.ndimage.filters.gaussian_filter1d(Z[xp,:], sigma_discrete_units)
#Color map figure
ax = fig.gca()
im = ax.pcolormesh(X.transpose(), Y.transpose(), Z, cmap=matplotlib.cm.coolwarm)
plt.ylim([-1, 1])
fig.colorbar(im)
fig.savefig('figures/LDOS.png')
sigma = 0.001
sigma_discrete_units = sigma*energy_resolution/(limits[0] - limits[1])
Z1 = dataset[y_plane, y_plane, :]
signal = Z1[: int(data_dimensions[2]/2)]
Z2 = dataset[0, 0, :]
plt.figure()
Z1 = scipy.ndimage.filters.gaussian_filter1d(Z1, sigma_discrete_units)
peaks, _ = find_peaks(signal, height=peak_height)
Z2 = scipy.ndimage.filters.gaussian_filter1d(Z2, sigma_discrete_units)
plt.plot(y, Z1)
plt.plot(y[peaks[-1]], Z1[peaks[-1]], 'x')
plt.plot(y, Z2, '--')
plt.xlim([-1, 1])
plt.savefig('figures/LDOS_middle.png')
plt.close()
plt.figure()
x = np.arange(0, data_dimensions[0], 1)
y = np.arange(0, data_dimensions[1], 1)
X, Y = np.meshgrid(x, y)
Z = delta
plt.pcolormesh(X.transpose(), Y.transpose(), Z, cmap=matplotlib.cm.coolwarm)
plt.colorbar()
plt.savefig("figures/delta.png")
plt.close()
plt.figure()
plt.plot(x, delta[:,y_plane])
plt.savefig("figures/delta_profile.png")
plt.close()
# Find peaks in the LDOS (Eg):
Eg = np.zeros_like(delta)
ratio = np.zeros_like(delta)
for i in range(data_dimensions[0]):
for j in range(data_dimensions[1]):
signal = dataset[i, j, : int(np.floor(data_dimensions[2]/2))]
signal = scipy.ndimage.filters.gaussian_filter1d(signal, sigma_discrete_units)
peaks, _ = find_peaks(signal, height=peak_height)
Eg[i,j] = signal[peaks[-1]]
ratio[i,j] = Eg[i,j]/delta[i,j]
plt.figure()
x = np.arange(0, data_dimensions[0], 1)
y = np.arange(0, data_dimensions[1], 1)
X, Y = np.meshgrid(x, y)
Z = Eg
plt.pcolormesh(X.transpose(), Y.transpose(), Z, cmap=matplotlib.cm.coolwarm)
plt.colorbar()
plt.savefig("figures/Eg.png")
plt.close()
plt.figure()
x = np.arange(0, data_dimensions[0], 1)
y = np.arange(0, data_dimensions[1], 1)
X, Y = np.meshgrid(x, y)
Z = ratio
plt.pcolormesh(X.transpose(), Y.transpose(), Z, cmap=matplotlib.cm.coolwarm)
plt.colorbar()
plt.savefig("figures/ration.png")
plt.close()