-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotting.py
More file actions
29 lines (27 loc) · 1.08 KB
/
Plotting.py
File metadata and controls
29 lines (27 loc) · 1.08 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
import numpy as np
from matplotlib import pyplot as plt
from ew_utils import ExitWave
def Argand_plot(exitwave, start, end, steps, spot=None):
wavefunction = exitwave.wavefunction
rec = []
m, n = wavefunction.shape
if spot is None:
spot=(m//2, n//2)
for deltaf in np.arange(start, end, steps):
ew_prop = ExitWave.propagation(wavefunction, deltaf,
sampling=exitwave.sampling,
energy=exitwave.energy)
selected = ew_prop[spot[0], spot[1]]
rec.append(selected)
return np.array(rec)
def draw_Argand(exitwave, start, end, steps, spot=None, color=None, label=None):
Argand = Argand_plot(exitwave, start, end, steps, spot)
if not (color is None) and not (label is None):
plt.plot(np.real(Argand), np.imag(Argand), color=color, label=label)
elif not (label is None):
plt.plot(np.real(Argand), np.imag(Argand), label=label)
else:
plt.plot(np.real(Argand), np.imag(Argand))
plt.xlabel("Re")
plt.ylabel("Im")
plt.axis("square")