Skip to content
Snippets Groups Projects
Commit 1de008e6 authored by Wolf Widdra's avatar Wolf Widdra
Browse files

Updating Examples

parent c58ee368
No related branches found
No related tags found
No related merge requests found
Examples/KTaO3.png

29.4 KiB

......@@ -2,6 +2,7 @@
import matplotlib.pyplot as plt
import numpy as np
from libhreels.calcHREELS import lambin, importMaterials
import os
###### Define Strontium titanate film on Silver ####
## (Thickness is given in Angstroem as second parm)#
......@@ -20,4 +21,9 @@ plt.xlabel('Energy Loss (cm$^{-1}$)')
plt.title(thinFilm[0][0]['name'])
plt.ylim(bottom=0.)
plt.legend()
plt.text(0.99, 0.01,os.path.basename(__file__), fontsize=10, ha='right', va='bottom', transform=plt.gcf().transFigure)
output_filename = os.path.splitext(__file__)[0] + '.png'
plt.savefig(output_filename)
plt.show()
\ No newline at end of file
Examples/calcHREELS1.png

28.3 KiB

......@@ -2,6 +2,7 @@
import matplotlib.pyplot as plt
import numpy as np
from libhreels import calcHREELS
import os
###### Define Strontium titanate film on Silver ####
## (Thickness is given in Angstroem as second parm)#
......@@ -20,4 +21,9 @@ plt.xlabel('Energy Loss (cm$^{-1}$)')
plt.title(r'SrTiO$_3$')
plt.ylim(bottom=0.)
plt.legend()
plt.text(0.99, 0.01,os.path.basename(__file__), fontsize=10, ha='right', va='bottom', transform=plt.gcf().transFigure)
output_filename = os.path.splitext(__file__)[0] + '.png'
plt.savefig(output_filename)
plt.show()
\ No newline at end of file
Examples/calcHREELS3.png

24.6 KiB

......@@ -2,12 +2,13 @@
import matplotlib.pyplot as plt
import numpy as np
from libhreels.calcHREELS import lambin, importMaterials
import os
# Experimental setup as dictionary:
setup = {
"e0": 4.0, # Primary electron energy
"theta": 60., # Scattering angle wrt surface normal
"phia": 2.0,
"phia": 0.33,
"phib": 2.0,
"temperature": 80.,# Sample temperature
"debug": False
......@@ -32,7 +33,7 @@ thinFilm = [[{'eps': 5.1295,
20000.]]
d = lambin(thinFilm, setup=setup, instrument=instrument)
x = np.linspace(-100,1000,1100)
x = np.linspace(-100,1000,2000)
x,y = d.calcHREELS(x)
###### Plotting ###########################
......@@ -42,4 +43,9 @@ plt.ylabel('Relative HREELS signal')
plt.xlabel('Energy Loss (cm$^{-1}$)')
plt.ylim(bottom=0.)
plt.legend()
plt.text(0.99, 0.01,os.path.basename(__file__), fontsize=10, ha='right', va='bottom', transform=plt.gcf().transFigure)
output_filename = os.path.splitext(__file__)[0] + '.png'
plt.savefig(output_filename)
plt.show()
\ No newline at end of file
Examples/showHREELS1.png

30.7 KiB

from libhreels import HREELS as hh
import sys
import os
import matplotlib.pyplot as plt
import numpy as np
# datapath = ".\\data"
# datapath = "./Examples/data"
datapath = "./data"
d2 = hh.HREELS('c1a02', datapath=datapath)
......@@ -19,4 +19,9 @@ d2.plot(normalized=True, color='gray', factor = 1, label=None)
d1.ax.set_ylim(bottom=0)
d1.ax.set_xlim(left=-200,right=1300)
plt.axvline(x=69,ymax=0.4, linestyle='dashed')
plt.text(0.99, 0.01,os.path.basename(__file__), fontsize=10, ha='right', va='bottom', transform=plt.gcf().transFigure)
output_filename = os.path.splitext(__file__)[0] + '.png'
plt.savefig(output_filename)
plt.show()
\ No newline at end of file
Examples/showHREELS2.png

37.1 KiB

from libhreels import HREELS
import matplotlib.pyplot as plt
import os
d = './data'
# d = './Examples/data'
......@@ -10,4 +12,9 @@ xmin = 35
d1 = HREELS.HREELS(file,d)
d1.plotInfoAmp(factor=factor, xmin=xmin)
d1.pickPeak()
d1.fig.text(0.99, 0.01,os.path.basename(__file__), fontsize=10, ha='right', va='bottom', transform=plt.gcf().transFigure)
output_filename = os.path.splitext(__file__)[0] + '.png'
d1.fig.savefig(output_filename)
d1.show()
......@@ -402,9 +402,11 @@ class HREELS:
''' Set vertical marker with text label. Note that self.figure() needs to be
called before use.'''
trans = offset(self.ax, 0, 30)
plt.plot([x,x],[ymin,y], lw=1, c='black', ls='dashed')
# plt.plot([x,x],[ymin,y], lw=1, c='black', ls='dashed')
self.ax.plot([x,x],[ymin,y], lw=1, c='black', ls='dashed')
x = round(x)
plt.text(x,y,'%4i' % x, rotation=90,
# plt.text(x,y,'%4i' % x, rotation=90,
self.ax.text(x,y,'%4i' % x, rotation=90,
verticalalignment='bottom', horizontalalignment='center', transform=trans)
return
......
......@@ -11,21 +11,21 @@ libDir = os.path.dirname(os.path.realpath(__file__))
setup = {
"e0": 4.0,
"theta": 60.,
"phia": 2.0,
"phia": 0.33,
"phib": 2.0,
"temperature": 298.,
"debug": False
}
# Instrumental function describing elastic peak shape:
instrument = {
"width": 19.,
"width": 18.,
"intensity": 100000.,
"asym": 0.1,
"gauss": 0.8
"asym": 0.01,
"gauss": 0.88
}
def importMaterials(string, path=libDir):
def importMaterials(string='', path=libDir):
file = os.path.join(myPath(path),'materials.json')
with open(file) as json_file:
materials = json.load(json_file)
......@@ -33,6 +33,7 @@ def importMaterials(string, path=libDir):
mat = materials[string]
except:
print('No data for material >>{}<< found in {} materials.json!!'.format(string, path))
print('Available materials:\n{}\n'.format(materials.keys()))
mat = 'None'
return mat
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment