-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresent.py
55 lines (42 loc) · 1.61 KB
/
present.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
"""
#Visulization
Present VMI Data and Results
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
__version__ = '0.1.1'
# Setup figure defult values
mpl.rcParams['figure.dpi'] = 120
mpl.rcParams['figure.figsize'] = [8.0, 6.0]
class Present:
def plot_electron_count_vs_energy(self, xi:int=None, xf:int=None, chose:list=None, yscale = 'log'):
chose = range(self.lines.shape[-1]) if chose == None else chose
plt.cla()
self.plots = plt.plot(self.energy_axis,self.lines[xi:xf, chose])
plt.xlabel('Energy (eV)')
plt.ylabel('Counts (a.u.)')
plt.legend(self.plots, list(np.arange(90,-1,-15)[chose])) # The zero angle at the y-axis
if yscale == 'log':
plt.yscale(yscale)
plt.ylim(1,None)
def plot_sep_electron_count(self, dpi = 200, figsize = [8,6], yscale = 'log'):
fig, a = plt.subplots(4,2, dpi = dpi, figsize = figsize)
a = a.flatten()
ang = [0, 15, 30, 45, 60, 75, 90][::-1]
for i,l in enumerate(self.lines.T):
a[i].plot(l[10:500], label = ang[i])
a[i].legend()
plt.show()
def show(self, colorbar=False, vmin = None, vmax = None):
"""
To show the image
in kw:
vmin: min value in the gray scale
vmax: max value in teh gray scale
alpha: The alpha blending value, between 0 (transparent) and 1 (opaque).
"""
plt.imshow(self.data, cmap='gray', vmin = vmin, vmax = vmax)
if colorbar:
plt.colorbar()
#plt.show()