Esempio n. 1
0
 def magtrap(self):
     s = system.System()
     rmax = 1e3
     a, b, c, d, e = -1.3, 1.3, .78, 2.5, 3.
     s.append(electrode.PolygonPixelElectrode(name="rf",
             rf=1., paths=[
                 [[rmax,0], [-rmax,0], [-rmax,a], [rmax,a]],
                 [[rmax,b+c], [-rmax,b+c], [-rmax,b], [rmax,b]],
             ]))
     for cx, cy, w, n in [
         (d/2+e/2, b+2*c, d, "c1"),
         (0, b+2*c, e, "c2"),
         (-d/2-e/2, b+2*c, d, "c3"),
         (d/2+e/2, a, d, "c6"),
         (0, a, e, "c5"),
         (-d/2-e/2, a, d, "c4")]:
             s.append(electrode.PolygonPixelElectrode(
                 name=n, paths=[[
                     [cx-w/2,cy], [cx-w/2,rmax*np.sign(cy)],
                     [cx+w/2,rmax*np.sign(cy)], [cx+w/2,cy],
                 ]]))
     for e in s:
         e.paths = [p[::1 if o > 0 else -1]
                 for p, o in zip(e.paths, e.orientations())]
     return s
 def setUp(self):
     p = np.array([[0, 0], [1, 0], [1, 2], [2, 2.]])
     a = electrode.PolygonPixelElectrode(paths=[p, p + [[3, 3.]]], dc=1.)
     b = electrode.PolygonPixelElectrode(paths=[p - [[3, 3]]], dc=2.)
     self.s = system.System([a, b])
     self.m = electrode.MeshPixelElectrode.from_polygon_system(self.s)
     self.x = np.array([[1, 2, 3.]])
Esempio n. 3
0
 def test_shims(self):
     x = self.x0
     eln = "c1 c2 c3 c4 c5 c6".split()
     s = system.System([self.s[n] for n in eln])
     derivs = "x y z xx yy yz".split()
     vectors = s.shims([(x, None, d) for d in derivs])
     self.assertEqual(vectors.shape, (len(derivs), len(eln)))
     return vectors, s, derivs
Esempio n. 4
0
 def ringtrap(self):
     s = system.System()
     n = 100
     p = np.exp(1j*np.linspace(0, 2*np.pi, 100))
     s.append(electrode.PolygonPixelElectrode(name="rf",
         rf=1, paths=[np.r_[
             3.38*np.array([p.real, p.imag]).T,
             .68*np.array([p.real, p.imag]).T[::-1]]]
         ))
     return s
Esempio n. 5
0
 def trap(self, tw=np.pi/4, t0=5*np.pi/8):
     s = system.System()
     rmax = 1e4
     # Janus H. Wesenberg, Phys Rev A 78, 063410 ͑2008͒
     def patches(n, tw, t0):
         for i in range(n):
             a = t0 + 2*np.pi/n*i
             ya, yb = np.tan((a-tw/2)/2), np.tan((a+tw/2)/2)
             yield np.array([[rmax, ya], [rmax, yb],
                  [-rmax, yb], [-rmax, ya]])
     s.append(electrode.PolygonPixelElectrode(name="rf",
         rf=1, paths=list(patches(n=2, tw=tw, t0=t0))))
     return s
 def test_pseudopotential_derivs(self):
     ns = range(1, 5)
     d = 1e-7
     xd = self.x + [[0, 0, 0], [d, 0, 0], [0, d, 0], [0, 0, d]]
     s = system.System([self.e])
     self.e.rf = 1.
     for n in ns:
         p = s.potential(self.x, n)[0]
         pd = s.potential(xd, n - 1)
         pd = (pd[1:] - pd[0]) / d
         for k, (i, j) in enumerate(zip(p.ravel(), pd.ravel())):
             nptest.assert_allclose(i,
                                    j,
                                    rtol=d,
                                    atol=d / 100,
                                    err_msg="n=%i, k=%i" % (n, k))
Esempio n. 7
0
    def get(self, n=12, h=1/8., d=1/4., H=25/8., nmax=1, points=True):
        s = system.System(electrodes=self.hextess(n, points))
        for ei in s:
            ei.cover_height = H
            ei.cover_nmax = nmax
        self.s = s

        ct = []
        ct.append(pattern_constraints.PatternRangeConstraint(min=0, max=1.))
        for p in 0, 4*np.pi/3, 2*np.pi/3:
            x = np.array([d/3**.5*np.cos(p), d/3**.5*np.sin(p), h])
            r = transformations.euler_matrix(p, np.pi/2, np.pi/4, "rzyz")[:3, :3]
            for i in "x y z xy xz yz".split():
                ct.append(pattern_constraints.PotentialObjective(derivative=i,
                    x=x, rotation=r, value=0))
            for i in "xx yy".split():
                ct.append(pattern_constraints.PotentialObjective(derivative=i,
                        x=x, rotation=r, value=2**(-1/3.)))
        s.rfs, self.c = s.optimize(ct, verbose=False)
        self.h = h
        
        self.x0 = np.array([d/3**.5, 0, h])
        self.r = transformations.euler_matrix(0, np.pi/2, np.pi/4, "rzyz")[:3, :3]