x + \phi_x)\cosh(k_yy + \phi_y)\cos(k_zz + \phi_z)                      $\
$B_z = -\frac{k_z}{k_y}\cosh(k_x x + \phi_x)\cosh(k_yy + \phi_y)\cos(k_zz + \phi_z)$\
with $k_y^2 = k_z^2 - k_x^2$\
\
Form 3\
$B_x = \frac{k_x}{k_y}\sinh(k_x x + \phi_x)\sin(k_yy + \phi_y)\cos(k_zz + \phi_z)$\
$B_y =\cosh(k_x x + \phi_x)\cos(k_yy + \phi_y)\cos(k_zz + \phi_z)$\
$B_z = -\frac{k_z}{k_y}\cosh(k_x x + \phi_x)\sin(k_yy + \phi_y)\sin(k_zz + \phi_z)$\
with $k_y^2 = k_x^2 - k_z^2$

We include the caveat that if $k_x$ and $k_z$ are both zero, then $\frac{k_x}{k_y}$ and $\frac{k_z}{k_y}$ should be replaced with $1$ so that our basis functions are continuous in parameter space. With this, we have obtained a basis which is suitable for modeling any magnetic field profile. This basis may be further simplified for different types of magnets. For example, given the symmetry of wiggler magnets, one may impose $\phi_x$ and $\phi_y$ to be zero, as is done in [@wiggler]. For modeling LGB’s we make the following simplifications. First, looking to Figures 1(b) and 2(b), it is typical for $B_x$ vs. $x$, $y$, and $z$ and $B_z$ vs. $x$, $y$, and $z$ to be centered on and symmetric about their horizontal axes. This is not the case for $B_y$. To capture this behavior, we require a constant offset 