""" Example -- magnetics Tools for Coils ==================================== This script shows hwo to use the magnetics module to display, fit, and feed forward 3D coil currents. These shots where taken from J. King's 2013-23-01 experiment validating 3D Magnetics responses. """ # standard modules import numpy as np # local modules import magnetics ############################################## Variables il = magnetics.coil_arrays['IL'] shot = 153482 # vacuum I-Coils at 10kHz xlim = (3e3,5e3) # coils are rotating, 2 amplitudes ############################################## Find Amplitude and Phase of Applied Coils il.set_data(shot) il.fit.update(ns=[1],ms=[0],xlim=xlim) fdata = il.fit.plot() ############################################## Feed Forward a desired mode n,m = 1,0 time = np.linspace(xlim[0],xlim[1],2e3) amp = 1 phase = 10*2*np.pi*(time-time.min())/1000 # 10Hz # set the mode, and plot sample coils il.set_mode(amp,phase,n,m,time=time) f1 = il.plotdata(search='30') # will find IL30 and IL330 f1.axes[0].set_ylabel('kA') # remind ourself these are not sensors # add a jump to the amplitude and plot a sample coil amp = np.ones_like(time) amp[time>np.mean(xlim)]*=2 il.set_mode(amp,phase,n,m,time=time) f2 = il.plotdata(search='30') f2.axes[0].set_ylabel('kA') magnetics.plt.show()