-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathspin_current_plt.py
More file actions
33 lines (26 loc) · 977 Bytes
/
spin_current_plt.py
File metadata and controls
33 lines (26 loc) · 977 Bytes
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
# This is the script for plotting the spin
# texture and spin currents
# Here we will calculate the series expansion
# for sin(x) up to an arbitrary order N.
#
# Tian-Qi Chen, 18/11/2016
#from scipy.special import jn
from matplotlib.pyplot import cm
import matplotlib.pyplot as plt
import numpy as np
# Here we plot the spin superfluid current
Y, X = np.mgrid[-2:2:20j, -2:2:20j] # X, Y are the plot starting points
U = -Y/(X**2+Y**2)*np.exp(-0.5*(X**2+Y**2))
V = X/(X**2+Y**2)*np.exp(-0.5*(X**2+Y**2))
speed = np.sqrt(U**2 + V**2)
UN = U/speed
VN = V/speed
plot1 = plt.figure()
plt.quiver(X, Y, UN, VN, # data
speed, # colour the arrows based on this array
cmap=cm.seismic, # colour map
headlength=6) # length of the arrows
plt.colorbar() # adds the colour bar
#plt.title('Spin superfluid current')
plt.show(plot1) # display the plot
# Here we add some random noice