Example #1
0
 def test_known1(self):
     """
     Test for known value.
     """
     with pytest.warns(exceptions.PhysicsWarning, match="strong coupling effects"):
         methodVal = collision_frequency(
             self.T,
             self.n,
             self.particles,
             z_mean=np.nan * u.dimensionless_unscaled,
             V=np.nan * u.m / u.s,
             method="classical",
         )
     testTrue = np.isclose(self.True1, methodVal.si.value, rtol=1e-1, atol=0.0)
     errStr = f"Collision frequency should be {self.True1} and " f"not {methodVal}."
     assert testTrue, errStr
Example #2
0
 def test_zmean(self):
     """
     Test collisional frequency function when given arbitrary z_mean.
     """
     with pytest.warns(exceptions.PhysicsWarning, match="strong coupling effects"):
         methodVal = collision_frequency(
             self.T,
             self.n,
             self.particles,
             z_mean=self.z_mean,
             V=np.nan * u.m / u.s,
             method="classical",
         )
     testTrue = np.isclose(self.True_zmean, methodVal.si.value, rtol=1e-1, atol=0.0)
     errStr = (
         f"Collision frequency should be {self.True_zmean} and " f"not {methodVal}."
     )
     assert testTrue, errStr
Example #3
0
 def test_fail1(self):
     """
     Tests if test_known1() would fail if we slightly adjusted the
     value comparison by some quantity close to numerical error.
     """
     fail1 = self.True1 * (1 + 1e-15)
     with pytest.warns(exceptions.PhysicsWarning, match="strong coupling effects"):
         methodVal = collision_frequency(
             self.T,
             self.n,
             self.particles,
             z_mean=np.nan * u.dimensionless_unscaled,
             V=np.nan * u.m / u.s,
             method="classical",
         )
     testTrue = not np.isclose(methodVal.si.value, fail1, rtol=1e-16, atol=0.0)
     errStr = (
         f"Collision frequency value test gives {methodVal} and "
         f"should not be equal to {fail1}."
     )
     assert testTrue, errStr
Example #4
0
 def test_symmetry(self):
     with pytest.warns(CouplingWarning):
         result = collision_frequency(self.T, self.n, self.particles)
         resultRev = collision_frequency(self.T, self.n, self.particles[::-1])
     assert result == resultRev