Example #1
0
 def test_value2(self):
     "Test a known solution"
     p = np.array([0, 0, 1])
     B2 = MagneticDipole(self.moment, self.p0).magnetic_field(p)
     B2_expected = np.array([0, 0, 2]) * 1e-7 * u.T
     assert np.all(np.isclose(B2.value, B2_expected.value))
     assert B2.unit == u.T
Example #2
0
 def test_value1(self):
     "Test a known solution"
     p = np.array([1, 0, 0])
     B1 = MagneticDipole(self.moment, self.p0).magnetic_field(p)
     B1_expected = np.array([0, 0, -1]) * 1e-7 * u.T
     assert np.all(np.isclose(B1.value, B1_expected.value))
     assert B1.unit == u.T
Example #3
0
 def test_repr(self):
     "Test __repr__ function"
     B1 = MagneticDipole(self.moment, self.p0)
     assert repr(
         B1) == r"MagneticDipole(moment=[0. 0. 1.]A m2, p0=[0. 0. 0.]m)"