Exemple #1
0
def test_wiggler(rin):
    period = 0.05
    periods = 23
    bmax = 1
    by = numpy.array([1, 1, 0, 1, 1, 0], dtype=numpy.float64)
    c = elements.Wiggler('wiggler', period * periods, period, bmax, 3e9, By=by)
    assert abs(c.Length - 1.15) < 1e-10
    # Expected value from Matlab AT.
    expected = numpy.array(rin, copy=True)
    expected[5] = 0.000000181809691064259
    element_pass(c, rin)
    numpy.testing.assert_allclose(rin, expected, atol=1e-12)
Exemple #2
0
def test_gwig_symplectic_pass(rin, passmethod):
    # Parameters copied from one of the Diamond wigglers.
    wiggler = elements.Wiggler('w', 1.15, 0.05, 0.8, 3e9)
    wiggler.PassMethod = passmethod
    l = Lattice([wiggler], name='lat', energy=3e9)
    atpass(l, rin, 1)