예제 #1
0
 def test_eloss_with_4he(self):
     en = 1.
     m = 4
     z = 2
     res = self.he.energy_loss(en, m, z)
     bth = pytpc.gases.bethe(rel.beta(en, m*p_mc2), z, self.he.electron_density_per_m3, self.he.mean_exc_pot)
     self.assertAlmostEqual(res, bth, delta=10)
예제 #2
0
 def test_eloss_with_4he(self):
     en = 1.
     m = 4
     z = 2
     res = self.he.energy_loss(en, m, z)
     bth = pytpc.gases.bethe(rel.beta(en, m * p_mc2), z,
                             self.he.electron_density_per_m3,
                             self.he.mean_exc_pot)
     self.assertAlmostEqual(res, bth, delta=10)
예제 #3
0
파일: gases.py 프로젝트: tarvos14/pytpc
    def energy_loss(self, en, proj_mass, proj_charge):
        """Finds the energy loss of a projectile in the gas.

        This default version uses the Bethe formula (defined by the function `bethe`) to calculate the energy loss.
        This function may be overridden with an empirical fit to give better results.

        Parameters
        ----------
        en : float
            The kinetic energy of the projectile, in MeV
        proj_mass : int
            The mass number of the projectile
        proj_charge : int
            The charge number of the projectile

        Returns
        -------
        dedx : float
            The stopping power in MeV/m
        """
        beta = rel.beta(en, proj_mass * p_mc2)
        return bethe(beta, proj_charge, self.electron_density_per_m3, self.mean_exc_pot)
예제 #4
0
파일: gases.py 프로젝트: chchen123/pytpc
    def energy_loss(self, en, proj_mass, proj_charge):
        """Finds the energy loss of a projectile in the gas.

        This default version uses the Bethe formula (defined by the function `bethe`) to calculate the energy loss.
        This function may be overridden with an empirical fit to give better results.

        Parameters
        ----------
        en : float
            The kinetic energy of the projectile, in MeV
        proj_mass : int
            The mass number of the projectile
        proj_charge : int
            The charge number of the projectile

        Returns
        -------
        dedx : float
            The stopping power in MeV/m
        """
        beta = rel.beta(en, proj_mass * p_mc2)
        return bethe(beta, proj_charge, self.electron_density_per_m3, self.mean_exc_pot)
예제 #5
0
 def test_value(self):
     for e in range(1, 40):
         for m in range(1, 40):
             exp = (sqrt(e) * sqrt(e + 2 * m)) / (e + m)
             self.assertAlmostEqual(rel.beta(en=e, mass=m), exp, places=5)
예제 #6
0
 def test_zero_energy(self):
     self.assertEqual(rel.beta(0.0, 4), 0)
예제 #7
0
 def test_zero_mass(self):
     self.assertEqual(rel.beta(4, 0), 1)
예제 #8
0
 def test_value(self):
     for e in range(1, 40):
         for m in range(1, 40):
             exp = (sqrt(e) * sqrt(e + 2*m)) / (e + m)
             self.assertAlmostEqual(rel.beta(en=e, mass=m), exp, places=5)
예제 #9
0
 def test_zero_energy(self):
     self.assertEqual(rel.beta(0.0, 4), 0)
예제 #10
0
 def test_zero_mass(self):
     self.assertEqual(rel.beta(4, 0), 1)
예제 #11
0
 def beta(self):
     """The particle's beta, or v/c"""
     en = self.energy
     m = self.mass
     return rel.beta(en, m)