Orbit Tuning

Import modules/packages


In [1]:
import phantasy
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

Model Machine


In [2]:
mp = phantasy.MachinePortal(machine='FRIB_FLAME', segment='LINAC')


WARNING: 2017-05-31 11:15:37,767: phantasy.library.operation.core: Load new machine: FRIB_FLAME segment: LINAC

Get BPMs


In [3]:
bpms = mp.get_elements(type='BPM')

Get BPM Readings


In [4]:
orbit_x = np.array([elem.X for elem in bpms])
orbit_y = np.array([elem.Y for elem in bpms])
s = np.array([elem.sb for elem in bpms])

Plot Orbit


In [5]:
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(s, orbit_x*1e3, '--o', ms=4, label='$x$')
ax.plot(s, orbit_y*1e3, '-o', ms=4, label='$y$')
ax.set_xlabel('$s [m]$')
ax.set_ylabel('$orbit [mm]$')
ax.legend()


Out[5]:
<matplotlib.legend.Legend at 0x7f43a555bf90>