-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEELSplot.py
More file actions
122 lines (93 loc) · 2.8 KB
/
EELSplot.py
File metadata and controls
122 lines (93 loc) · 2.8 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
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
# file to read in FEFF data and plot the data
import matplotlib.mlab as mlab
import numpy as np
import matplotlib.pyplot as plt
import plotly.plotly as py
# import files
#file='/home/tara/eelsMD.dat'
file='/home/tara/eelsDFT.dat'
fileenergy='/home/tara/expEELS.txt'
# define loop parameters and data collected
energy=[]
intensity=[]
energyexp=[]
intensityexp=[] # oxidized
intGBreduced=[] # reduced GB like
linecounter=0
# open the FEFF data and read through the lines
fileopen=open(file)
for line in fileopen:
linecounter+=1
if linecounter >= 13:
line=line.split()
intensity.append(float(line[3]))
energy.append(float(line[0]))
# close file
fileopen.close()
##! open the experimental data and read through
fileopen=open(fileenergy)
for line in fileopen:
line=line.split()
intensityexp.append(float(line[1]))
intGBreduced.append(float(line[2]))
energyexp.append(float(line[0]))
# close file
fileopen.close()
# normailze the intensity of all data
maxintEXP=max(intensityexp)
maxintGB=max(intGBreduced)
maxint=max(intensity)
intensity=[x/maxint for x in intensity]
intensityexp=[x/maxintEXP for x in intensityexp]
intGBreduced=[x/maxintGB for x in intGBreduced]
## MD intensity shift
# # shift the FEFF data
# energy=[x-1 for x in energy]
# intensityexp=[x+.8 for x in intensityexp]
# intensity=[x-.7 for x in intensity]
## DFT intensity shift
# shift the FEFF data
energy=[x for x in energy]
intensityexp=[x+.8 for x in intensityexp]
intensity=[x-.7 for x in intensity]
#! The DFT tail
def tail(list):
return list[30:]
# ## for the MD tail
# def tail(list):
# return list[30:]
intensity=tail(intensity)
energy=tail(energy)
##! MD EELS plot
# # plot the data together and save FEFF-MD and
# fig= plt.figure()
# plt.plot(energyexp,intensityexp,label='Exp-Oxidized GB like')
# plt.plot(energyexp,intGBreduced,label='Exp- Reduced GB like')
# plt.plot(energy,intensity,label='FEFF-MD',color='red')
# plt.legend(loc='lower right')
# plt.xlim([530,550])
# plt.yticks([])
# plt.title("Core-Loss EELS: (210) Grain Boundary")
# plt.xlabel(r'Energy Loss (eV)',fontsize=14)
# plt.ylabel("Normalized Intensity",fontsize=14)
# plt.minorticks_on()
# plt.show()
#
#
# fig.savefig('210_corelossEELS-MD.png', transparent=True)
##! dft EELS plot
#plot the data together and save FEFF-MD and
fig= plt.figure()
plt.plot(energyexp,intensityexp,label=r'Oxidized $CeO_2$')
plt.plot(energyexp,intGBreduced,label=r'Reduced CeO$_{\rm 2}$')
# or \mathrm
plt.plot(energy,intensity,label='FEFF-DFT')
plt.legend(loc='lower right')
plt.xlim([530,550])
plt.yticks([])
plt.title("Core-Loss EELS: (210) Grain Boundary")
plt.xlabel(r'Energy Loss (eV)',fontsize=14)
plt.ylabel("Normailized Intensity",fontsize=14)
plt.minorticks_on()
plt.show()
fig.savefig('210_corelossEELS-DFT.png', transparent=True)