def test_linear_map_cleans_slices(self): '''Tests whether the slice_sets are deleted when the track() method of the LinearMap is called ''' circumference = 1. Q_s = 0.012 linear_map = LinearMap(self.alpha_array, circumference, Q_s, printer=AccumulatorPrinter()) beam = self.create_all1_bunch() sliceset_mock = {'mock': 42} beam._slice_sets = sliceset_mock linear_map.track(beam) self.assertFalse(beam._slice_sets, 'slice_sets not deleted after ' + 'calling LinearMap.track() [changing the ' + 'z-coordinates of the beam]')
def test_linear_map_track(self): '''Tests whether only the dp and z coordinates are modified when applying the track() method of LinearMap ''' circumference = 1. Q_s = 0.012 linear_map = LinearMap(self.alpha_array, circumference, Q_s) beam = self.create_all1_bunch() beam2 = self.create_all1_bunch() linear_map.track(beam) self.assertTrue(np.allclose(beam.x, beam2.x), 'x coord of beam has changed in LinearMap.track()') self.assertTrue(np.allclose(beam.y, beam2.y), 'y coord of beam has changed in LinearMap.track()') self.assertTrue(np.allclose(beam.xp, beam2.xp), 'xp coord of beam has changed in LinearMap.track()') self.assertTrue(np.allclose(beam.yp, beam2.yp), 'yp coord of beam has changed in LinearMap.track()')