def testDuplicate(self): ph1 = PolarizedPhoton(8000.0, Vector(2, 4, 5), StokesVector([1, 2, 3, 4])) ph2 = ph1.duplicate() assert_array_almost_equal(ph1.stokesVector().components(), ph2.stokesVector().components()) assert_array_almost_equal(ph1.unitDirectionVector().components(), ph2.unitDirectionVector().components())
def testConstructor(self): photon = PolarizedPhoton(energy_in_ev=8000, direction_vector=Vector(0.0, 1.0, 0.0), stokes_vector=StokesVector( [1.0, 0.0, 1.0, 0.0])) self.assertIsInstance(photon, PolarizedPhoton) self.assertTrue(photon.unitDirectionVector() == Vector(0.0, 1.0, 0.0)) self.assertTrue( photon.stokesVector() == StokesVector([1.0, 0.0, 1.0, 0.0]))