Export code (added same string lenghth for each number)
This commit is contained in:
parent
b69540b136
commit
08b0802d3f
@ -32,14 +32,14 @@ I = 64 / HH_Coil.get_N() * 1.25
|
||||
#HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width()*1e3)
|
||||
HH_Coil.set_R_inner(45.6)
|
||||
|
||||
HH_Coil.set_d_min(47.15+2*0.5)
|
||||
HH_Coil.set_d_min(45.8+2*0.8)
|
||||
|
||||
# HH_Coil.B_quick_plot(I)
|
||||
# HH_Coil.B_curv_quick_plot(I)
|
||||
# HH_Coil.plot_raster()
|
||||
HH_Coil.print_info()
|
||||
|
||||
D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 0.5) * np.tan(np.radians(41.11))
|
||||
D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 1) * np.tan(np.radians(41.11))
|
||||
print(D_max)
|
||||
|
||||
AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings,
|
||||
|
@ -28,7 +28,7 @@ def main():
|
||||
# - BC.BCoil._BCoil__B_z_loop(I_current=I, r_loop=1, z_loop=-1, r_pos=0, z_pos=-0.1))
|
||||
|
||||
|
||||
step = 0.05
|
||||
step = 0.3
|
||||
xlim_mm = 30
|
||||
xlim = int(xlim_mm/step) + 1
|
||||
ylim_mm = 30
|
||||
@ -68,7 +68,7 @@ def main():
|
||||
B_quarter[xx, yy, :, 0] += BC.BCoil._BCoil__B_r_loop(I_current, r_pos, z_pos, r, z) \
|
||||
+ BC.BCoil._BCoil__B_r_loop(AHH_Coil.HH * I_current, r_pos, -z_pos, r, z)
|
||||
|
||||
np.save('output/final/B_quarter_1Gcm.npy', B_quarter)
|
||||
np.save('output/final/B_quarter_step_300_1Gcm.npy', B_quarter)
|
||||
|
||||
#B_tot = np.zeros(((2 * xlim) - 1, (2 * ylim) - 1, (2 * zlim)-1, 2))
|
||||
|
||||
|
@ -13,7 +13,7 @@ import logging as log
|
||||
|
||||
|
||||
def main():
|
||||
step = 0.05
|
||||
step = 0.3
|
||||
xlim_mm = 30
|
||||
xlim = int(xlim_mm / step) + 1
|
||||
print(xlim)
|
||||
@ -26,7 +26,7 @@ def main():
|
||||
y = np.linspace(0, ylim_mm, ylim) * 1e-3
|
||||
z = np.linspace(0, zlim_mm, zlim) * 1e-3
|
||||
|
||||
b_qu_polar = np.load('output/final/B_quarter_1Gcm.npy')
|
||||
b_qu_polar = np.load('output/final/B_quarter_step_300_1Gcm.npy')
|
||||
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ def main():
|
||||
b_cart_1[xx, yy, :, 0] = b_qu_polar[xx, yy, :, 0] * np.cos(phi)
|
||||
b_cart_1[xx, yy, :, 1] = b_qu_polar[xx, yy, :, 0] * np.sin(phi)
|
||||
|
||||
np.save('output/final/b_cart_1Gcm.npy', b_cart_1)
|
||||
np.save('output/final/b_cart_step_300_1Gcm.npy', b_cart_1)
|
||||
del b_qu_polar
|
||||
del b_cart_1
|
||||
|
||||
|
@ -13,7 +13,7 @@ import logging as log
|
||||
|
||||
|
||||
def main():
|
||||
step = 0.05
|
||||
step = 0.3
|
||||
xlim_mm = 30
|
||||
xlim = int(xlim_mm / step) + 1
|
||||
print(xlim)
|
||||
@ -27,7 +27,7 @@ def main():
|
||||
z = np.linspace(0, zlim_mm, zlim) * 1e-3
|
||||
|
||||
|
||||
b_cart_1 = np.load('output/final/b_cart_1Gcm.npy')
|
||||
b_cart_1 = np.load('output/final/b_cart_step_300_1Gcm.npy')
|
||||
|
||||
new_shape = np.shape(b_cart_1)
|
||||
full_shape = (new_shape[0]*2 - 1, new_shape[1] * 2 - 1, new_shape[2] * 2 - 1, new_shape[3])
|
||||
@ -50,7 +50,7 @@ def main():
|
||||
b_full[:, :, :zlim-1, :] = b_full[:, :, :zlim-1 : -1, :]
|
||||
b_full[:, :, :zlim-1, 2] *= -1
|
||||
|
||||
np.save('output/final/b_full.npy', b_full)
|
||||
np.save('output/final/b_full_step_300_1Gcm.npy', b_full)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -3,6 +3,8 @@ Created on 15.11.21
|
||||
|
||||
@author: Joschka
|
||||
"""
|
||||
import logging
|
||||
|
||||
import numpy as np
|
||||
from scipy.io import savemat
|
||||
|
||||
@ -10,25 +12,104 @@ def main():
|
||||
step = 0.05
|
||||
xlim_mm = 30
|
||||
xlim = int(xlim_mm / step) + 1
|
||||
|
||||
print(xlim)
|
||||
ylim_mm = 30
|
||||
ylim = int(ylim_mm / step) + 1
|
||||
zlim_mm = 20
|
||||
zlim = int(zlim_mm / step) + 1
|
||||
|
||||
b_1qu = np.load('output/final/b_cart_1Gcm.npy')
|
||||
b_1qu = np.load('output/final/b_full.npy')
|
||||
#b_1qu = b_1qu.round(7)
|
||||
|
||||
#
|
||||
bx_txt = open("output/Bz.txt", "w+")
|
||||
xx = 50
|
||||
yy = 50
|
||||
|
||||
# xx = 50
|
||||
# yy = 50
|
||||
# str = np.array2string(b_1qu[xx, yy, :, 0])
|
||||
bx_txt = open("output/step_50μm/Bx_step_50.txt", "w+")
|
||||
|
||||
for xx in range(0,xlim):
|
||||
for yy in range(0,ylim):
|
||||
str_1 = ' '.join(map(str,b_1qu[xx, yy, :, 2]))
|
||||
bx_txt.writelines(str_1)
|
||||
str_line = ''
|
||||
for zz in range(0,zlim):
|
||||
str_el = str(b_1qu[xx, yy, zz, 0])
|
||||
if len(str_el) != 8:
|
||||
length_diff = len(str_el) - 8
|
||||
if length_diff > 0:
|
||||
for i in range(0,length_diff):
|
||||
str_el = str_el[:-1]
|
||||
if length_diff < 0:
|
||||
for i in range(0,-length_diff):
|
||||
str_el = str_el + '0'
|
||||
if len(str_el) != 8:
|
||||
raise ValueError
|
||||
|
||||
str_line = str_line + str_el + ' '
|
||||
bx_txt.writelines(str_line)
|
||||
bx_txt.close()
|
||||
|
||||
by_txt = open("output/step_50μm/By_step_50.txt", "w+")
|
||||
|
||||
for xx in range(0,xlim):
|
||||
for yy in range(0,ylim):
|
||||
str_line = ''
|
||||
for zz in range(0,zlim):
|
||||
str_el = str(b_1qu[xx, yy, zz, 1])
|
||||
if len(str_el) != 8:
|
||||
length_diff = len(str_el) - 8
|
||||
if length_diff > 0:
|
||||
for i in range(0,length_diff):
|
||||
str_el = str_el[:-1]
|
||||
if length_diff < 0:
|
||||
for i in range(0,-length_diff):
|
||||
str_el = str_el + '0'
|
||||
if len(str_el) != 8:
|
||||
raise ValueError
|
||||
|
||||
str_line = str_line + str_el + ' '
|
||||
|
||||
by_txt.writelines(str_line)
|
||||
by_txt.close()
|
||||
|
||||
bz_txt = open("output/step_50μm/Bz_step_50.txt", "w+")
|
||||
|
||||
for xx in range(0,xlim):
|
||||
for yy in range(0,ylim):
|
||||
str_line = ''
|
||||
for zz in range(0,zlim):
|
||||
str_el = str(b_1qu[xx, yy, zz, 2])
|
||||
if len(str_el) != 8:
|
||||
length_diff = len(str_el) - 8
|
||||
if length_diff > 0:
|
||||
for i in range(0,length_diff):
|
||||
str_el = str_el[:-1]
|
||||
if length_diff < 0:
|
||||
for i in range(0,-length_diff):
|
||||
str_el = str_el + '0'
|
||||
if len(str_el) != 8:
|
||||
raise ValueError
|
||||
|
||||
str_line = str_line + str_el + ' '
|
||||
|
||||
bz_txt.writelines(str_line)
|
||||
bz_txt.close()
|
||||
|
||||
"""
|
||||
by_txt = open("output/By_step_300.txt", "w+")
|
||||
for xx in range(0,xlim):
|
||||
for yy in range(0,ylim):
|
||||
str_1 = ' '.join(map(str,b_1qu[xx, yy, :, 1]))
|
||||
by_txt.writelines(str_1)
|
||||
by_txt.close()
|
||||
|
||||
bz_txt = open("output/Bz_step_300.txt", "w+")
|
||||
for xx in range(0, xlim):
|
||||
for yy in range(0, ylim):
|
||||
str_1 = ' '.join(map(str, b_1qu[xx, yy, :, 2]))
|
||||
bz_txt.writelines(str_1)
|
||||
bz_txt.close()
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user