def test_orbit_maxiter_warnings(hmba_lattice): with pytest.warns(AtWarning): physics.find_orbit4(hmba_lattice, max_iterations=1) with pytest.warns(AtWarning): physics.find_sync_orbit(hmba_lattice, max_iterations=1) with pytest.warns(AtWarning): physics.find_orbit6(hmba_lattice, max_iterations=1)
def test_orbit_maxiter_warnings(hmba_lattice): hmba_lattice_rad = hmba_lattice.radiation_on(copy=True) with pytest.warns(AtWarning): physics.find_orbit4(hmba_lattice, max_iterations=1) with pytest.warns(AtWarning): physics.find_sync_orbit(hmba_lattice, max_iterations=1) with pytest.warns(AtWarning): physics.find_orbit6(hmba_lattice_rad, max_iterations=1)
def _find_orbit(ring, dp=None, refpts=None, orbit=None, ct=None, **kwargs): """""" if ring.radiation: if dp is not None: warn(AtWarning('In 6D, "dp" and "ct" are ignored')) if orbit is None: orbit, _ = find_orbit6(ring, **kwargs) else: if dp is None: dp = 0.0 if orbit is None: if ct is not None: orbit, _ = find_sync_orbit(ring, ct, **kwargs) else: orbit, _ = find_orbit4(ring, dp, **kwargs) if refpts is None: orbs = [] else: orbs = numpy.squeeze(lattice_pass(ring, orbit.copy(order='K'), refpts=refpts, keep_lattice=True), axis=(1, 3)).T return orbit, orbs
def test_find_sync_orbit(dba_lattice): expected = numpy.array([[1.030844e-5, 1.390795e-5, -2.439041e-30, 4.701621e-30, 1.265181e-5, 3.749859e-6], [3.86388e-8, 1.163782e-7, -9.671192e-30, 3.567819e-30, 1.265181e-5, 7.5e-6]]) _, all_points = physics.find_sync_orbit(dba_lattice, DP, [49, 99]) assert_close(all_points, expected, rtol=1e-5, atol=1e-7)
def test_find_sync_orbit_finds_zeros(dba_lattice): sync_orbit = physics.find_sync_orbit(dba_lattice)[0] numpy.testing.assert_equal(sync_orbit, numpy.zeros(6))