Ejemplo n.º 1
0
# temporary new system `s1` holding only the dc electrodes. Since these dc
# electrode instances also appear in our primary system `s`, changes in
# voltages are automatically synchronized between the two systems.
# 
# We then can calculate the shim voltage vectors that result in unit
# changes of each of the partial derivatives `y, z, xx, xy, xz, yy` at
# `x0` and plot the voltage distributions.

# <codecell>

s1 = System([e for e in s if not e.rf])
derivs = "y z xx xy xz yy".split()
u = s1.shims([(x0, None, deriv) for deriv in derivs])
fig, ax = plt.subplots(2, len(derivs)/2, figsize=(12, 10))
for d, ui, axi in zip(derivs, u, ax.flat):
    with s1.with_voltages(dcs=ui):
        s.plot_voltages(axi)
        axi.set_aspect("equal")
        axi.set_xlim(-r, r)
        axi.set_ylim(-r, r)
        um = ui[np.argmax(np.fabs(ui))]
        axi.set_title("%s, max=%g" % (d, um))

# <markdowncell>

# Rf/dc pattern optimization
# --------------------------
# 
# Define a function that generates the pixels and electrode. Here 
# we return pixel electrodes with `n` pixels per unit
# length in a hexagonal pattern.