# -*- coding: utf-8 -*-
"""
Created on Tue Aug 31 09:28:25 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')


x = np.linspace(-10, 10, 3001)
z = np.linspace(-10, 10, 3001)

HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 6, windings = 4, wire_height = 1, wire_width = 1,windings_spacing=0.25, layers_spacing = 0.25)
I = 5

"""
percentage = 0.05
absolut = 5
diff = percentage*0.01*5+ absolut *1e-3
print(diff)



Bz2, Bx = HH_Coil.B_field(I+ diff, x, z)
print(Bz2[1500]-Bz1[1500])
print(" ")
"""
percentage = 0 #.02
absolut = 0.125
diff = percentage*0.01*5+ absolut *1e-3
print(diff)

Bz1, Bx = HH_Coil.B_field(I, x, z)
Bz2, Bx = HH_Coil.B_field(I + diff, x, z)
print(Bz2[1500]-Bz1[1500])
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
#print(100e-6/10)
#Power = cs.rho_copper_20 *wire_length* I_current**2 /(self.get_wire_area())

