def test_beam_statistic(self):

        sigma_dt = 1.
        sigma_dE = 1.
        self.beam.dt = sigma_dt*numpy.random.randn(self.beam.n_macroparticles)
        self.beam.dE = sigma_dE*numpy.random.randn(self.beam.n_macroparticles)

        self.beam.statistics()

        self.assertAlmostEqual(self.beam.sigma_dt, sigma_dt, delta=1e-2,
                               msg='Beam: Failed statistic sigma_dt')
        self.assertAlmostEqual(self.beam.sigma_dE, sigma_dE, delta=1e-2,
                               msg='Beam: Failed statistic sigma_dE')
        self.assertAlmostEqual(self.beam.mean_dt, 0., delta=1e-2,
                               msg='Beam: Failed statistic mean_dt')
        self.assertAlmostEqual(self.beam.mean_dE, 0., delta=1e-2,
                               msg='Beam: Failed statistic mean_dE')