DyLab_3D_MOT/Coil_geometry/12_Final_Plotting.py
2021-10-01 14:37:07 +02:00

90 lines
2.5 KiB
Python

# -*- coding: utf-8 -*-
"""
Created on Mon Aug 23 17:40:37 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
#from src import B_field_calculation as bf
from src import coil_class as BC
from IPython import get_ipython
get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline')
#set up axis
axis = 3001 #30001 for -15 to 15 = 1μm
x = np.linspace(-5, 5, axis)
z = np.linspace(-5, 5, axis)
#New coil
I_current = 10
HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 2, wire_height = 2, wire_width = 1, windings_spacing=0.25, layers_spacing = 0.25)
HH_Coil.set_R_inner(44.5)
HH_Coil.set_d_min(48.8)
print(HH_Coil.resistance(22))
print(HH_Coil.induct_perry())
HH_Coil.print_info()
#Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
Bz_curv = BC.BCoil.curv(B_tot_z, z)
Bx_curv = BC.BCoil.curv(B_tot_x, x)
B_0 = B_tot_z[axis//2]
plt.figure(300)
#Field plot
##########################
plt.subplot(2,1,1)
#plt.plot(z,B_totz,linestyle = "solid", label = r"$B_z along z-axis")
#plt.plot(x,Bx,label = "B_x along x")
plt.plot(z,B_tot_z, label = r"$B_{{tot}}$ along z-axis")
plt.plot(x,B_tot_x, label = r"$B_{{tot}}$ along x-axis")
#plt.plot(z,B_z_comp,linestyle = "solid", label = r"$B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A, 4 x 4")
#plt.plot(z,B_tot,linestyle = "solid", label = r"$B_{z,1} + B_{z,2}$")
#plt.xlim(-0.01,0.01)
plt.title("B-field" )
plt.ylabel(r"$B$ [G]")
plt.xlabel("z / x -axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
plt.subplot(2,1,2)
plt.plot(z,Bz_curv,linestyle = "solid", label = r"$B_{curvature}$ along z-axis")
plt.plot(x,Bx_curv,label = r"$B_{curvature}$ along x-axis")
#plt.plot(z,B_z_comp_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A")
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_{z,x}^2 B_tot [G/cm^2]$")
plt.xlabel("z / x -axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
#plt.savefig("output/first_compensation_idea.png")
plt.show()
"""
AHH ############################################################################
###############################################################################
###############################################################################
"""