NV in Wild
Refath Bari
def B1(t):
w = 4
A = 4
phShift = 1
return A*math.sin(w*t+phShift)
def B2(t):
w = 4
A = 4
phShift = 0
return A*math.cos(w*t+phShift)
def B3(t):
A = 2
w = 4
phShift = 2.75
y_int = 1
return (A*math.sin(w*(t+phShift))+y_int)**2
def B4(t):
w = 4
A = 8
phShift = 0
return A*(math.sin(w*t-0.4))**3
def total_B(t):
return B1(t)+B2(t)+B3(t)+B4(t)
# REFACTORIZATION
Magnetic Fields
B_n
t
B_n(t)
\phi(B_1,x)
def B(t):
everything = [4*math.sin(4*t),
8*math.sin(4*t),
-4*math.sin(4*t),
7*math.sin(4*t)]
return everything
# REFACTORIZATION
Magnetic Fields
B_n
t
[B_1(t),B_2(t),B_3(t),B_4(t)]
\phi(B[3],x)
def B(t):
everything = [4*math.sin(4*t),
8*math.sin(4*t),
-4*math.sin(4*t),
7*math.sin(4*t)]
return everything
# REFACTORIZATION
Magnetic Fields
B_n
t
[B_1(t),B_2(t),B_3(t),B_4(t)]
\phi(B[3],x)
def B(t):
A = [4,4,6,8]
w = [4,4,4,4]
phShift = [0,0,0,0]
deg = [1,1,1,3]
fields = [A[0]*(math.sin(w[0]*t+phShift[0]))**deg[0],
A[1]*(math.cos(w[1]*t+phShift[1]))**deg[1],
A[2]*(math.cos(w[1]*t+phShift[2]))**deg[2],
A[3]*(math.cos(w[3]*t+phShift[3]))**deg[3]]
return fields
# REFACTORIZATION
Magnetic Fields
def B(t):
A = [4,4,6,8]
w = [4,4,4,4]
phShift = [0,0,0,0]
deg = [1,1,1,3]
fields = [A[0]*(math.sin(w[0]*t+phShift[0]))**deg[0],
A[1]*(math.cos(w[1]*t+phShift[1]))**deg[1],
A[2]*(math.cos(w[1]*t+phShift[2]))**deg[2],
A[3]*(math.cos(w[3]*t+phShift[3]))**deg[3]]
return fields
# REFACTORIZATION
Magnetic Fields
def B1(t, phaseShift=0):
w = 4
A = 4
phShift = phaseShift
return A*math.sin(w*t+phShift)
# REFACTORIZATION
Magnetic Fields
b_graph = []
y1 = []
y1_mod = []
y2 = []
y2_mod = []
y3 = []
y3_mod = []
y4 = []
y4_mod = []
total_y = []
total_y_mod = []
y1_free_coh = []
y2_free_coh = []
y3_free_coh = []
y4_free_coh = []
total_y_coh_free = []
# REFACTORIZATION
Magnetic Fields
plt.figure(0)
num_phShifts = 10
mag_graphs = [[] for i in range(num_phShifts)]
phase_graphs = [[] for i in range(num_phShifts)]
coherence_graphs = [[] for i in range(num_phShifts)]
# REFACTORIZATION
Magnetic Fields
plt.figure(0)
num_phShifts = 10
mag_graphs = [[] for i in range(num_phShifts)]
phase_graphs = [[] for i in range(num_phShifts)]
coherence_graphs = [[] for i in range(num_phShifts)]
# REFACTORIZATION
Magnetic Fields
for j in range(0,len(mag_graphs)):
for i in x:
mag_graphs[j].append(B1(i,j))
itemindex = np.where(x==i)
phase_graphs[j].append(phase_accumulation(mag_graphs[j],itemindex[0][0]))
coherence_graphs[j].append(math.cos(phase_accumulation(mag_graphs[j],itemindex[0][0])))
plt.title('Magnetic Field $B_n(t)=4\sin(4t+\phi_n)$')
plt.xlabel("t (s)")
plt.ylabel("$B(t)$")
plt.xlim([0,math.pi/2])
plt.plot(x, mag_graphs[j])
# REFACTORIZATION
Magnetic Fields
# REFACTORIZATION
Phase Accumulation
# REFACTORIZATION
Magnetic Fields
B
t
# REFACTORIZATION
Magnetic Fields
B
t
[B_1(t),B_2(t),B_3(t),B_4(t)]
\phi(B[3],x)
# REFACTORIZATION
Phase Shifts
def B1(t):
w = 4
A = 4
phShift = 1
return A*math.sin(w*t+phShift)
def B3(t):
A = 2
w = 4
phShift = 2.75
y_int = 1
return (A*math.sin(w*(t+phShift))+y_int)**2
def B4(t):
w = 4
A = 8
phShift = 0
return A*(math.sin(w*t-0.4))**3
def total_B(t):
return B1(t)+B2(t)+B3(t)+B4(t)
# REFACTORIZATION
Magnetic Fields
Code
By Refath Bari
Code
- 7