HyperSpy is really an awesome package for EELS analysis in python.
It's very convenient for use and we can get more detail information from the dm files.
Here are some sample code of HyperSpy for EELS spectrum image.
====================================
import hyperspy.api as hs
ds=hs.load('si.dm3')
ch=100
w=3
# average spectrum
w=w//2
linesig=ds.inav[ch-w:ch+w+1].mean()
# signal silcing
E0=405
Ee=580
print('Assignd by energy range --> using float(E0)')
E0=float(E0)
Ee=float(Ee)
lin01=linesig.isig[E0:Ee]
print('E0=%6.0f. , Ee=%6.0f. , data points=%i' % (E0,Ee,linesig.isig[E0:Ee].axes_manager[-1].size ))
lin01.plot()
print('Assignd by channel --> using int(E0)')
E0=int(E0)
Ee=int(Ee)
lin02=linesig.isig[E0:Ee]
print('E0=%i , Ee=%i , data points=%i' % (E0,Ee,linesig.isig[E0:Ee].axes_manager[-1].size ))
lin02.plot()
==================================
Results:
Figure1
It's very convenient for use and we can get more detail information from the dm files.
Here are some sample code of HyperSpy for EELS spectrum image.
====================================
import hyperspy.api as hs
ds=hs.load('si.dm3')
ch=100
w=3
# average spectrum
w=w//2
linesig=ds.inav[ch-w:ch+w+1].mean()
# Get the x-axis and y-axis values
xx=linesig.axes_manager[-1].axis
yy=linesig.data
print('Figure 1')
plt.figure(1)
plt.plot(xx,yy)
plt.xlabel('%s (%s)' % (linesig.axes_manager[-1].name, linesig.axes_manager[-1].units))
plt.ylabel('Counts (a.u.)')
plt.legend(['smooth data'])
plt.show()
# signal silcing
E0=405
Ee=580
print('Assignd by energy range --> using float(E0)')
E0=float(E0)
Ee=float(Ee)
lin01=linesig.isig[E0:Ee]
print('E0=%6.0f. , Ee=%6.0f. , data points=%i' % (E0,Ee,linesig.isig[E0:Ee].axes_manager[-1].size ))
lin01.plot()
print('Assignd by channel --> using int(E0)')
E0=int(E0)
Ee=int(Ee)
lin02=linesig.isig[E0:Ee]
print('E0=%i , Ee=%i , data points=%i' % (E0,Ee,linesig.isig[E0:Ee].axes_manager[-1].size ))
lin02.plot()
==================================
Results:
Figure1
Assignd by energy range --> using float(E0)
E0= 400. , Ee= 580. , data points=720
Assignd by energy channel --> using int(E0)
E0=400 , Ee=580 , data points=180
Comments
Post a Comment