Ejemplo n.º 1
0
 def test_operator_not_equal(self):
     candidate1 = np.asarray([[
         0.3259811941363535, 0.47517601596586845, 0.55188250265952130,
         0.30969758976770600
     ],
                              [
                                  0.9302512754240655, 0.31523109368760793,
                                  0.14892732688907617, 0.67942926971439030
                              ],
                              [
                                  0.4445952221208559, 0.36451278145926280,
                                  0.16830367235626830, 0.67269380390882630
                              ],
                              [
                                  0.5613952867979658, 0.10671512922801230,
                                  0.48878441635267090, 0.27447059819338904
                              ]])
     candidate1 = MuellerMatrix(candidate1)
     candidate2 = np.asarray(
         [[-6.17688112, 5.02032824, 6.23225893, -0.32032499],
          [7.27366317, 1.43011512, 1.81816476, 9.62888406],
          [5.27430283, -1.37894077, -0.99747857, 8.80405558],
          [1.89547814, -1.17966381, -7.85411672, -7.73368115]])
     candidate2 = MuellerMatrix(candidate2)
     self.assertFalse(
         self.mueller_matrix != self.mueller_matrix)  # identity
     self.assertFalse(candidate1 != self.mueller_matrix)
     self.assertTrue(candidate2 != self.mueller_matrix)
Ejemplo n.º 2
0
 def test_mueller_times_mueller(self):
     mueller_matrix1 = self.mueller_matrix
     matrix2 = np.asarray(
         [[-6.17688112, 5.02032824, 6.23225893, -0.32032499],
          [7.27366317, 1.43011512, 1.81816476, 9.62888406],
          [5.27430283, -1.37894077, -0.99747857, 8.80405558],
          [1.89547814, -1.17966381, -7.85411672, -7.73368115]])
     product1 = mueller_matrix1.mueller_times_mueller(matrix2, mod=False)
     product2 = mueller_matrix1.mueller_times_mueller(matrix2, mod=True)
     self.assertIsInstance(product1, MuellerMatrix)
     self.assertIsInstance(product2, MuellerMatrix)
     # once I have checked the products are MuellerMatrix objects, I use the __eq__ method.
     self.assertTrue(
         product1 == MuellerMatrix(np.dot(matrix2, mueller_matrix1.matrix)))
     self.assertTrue(
         product2 == MuellerMatrix(np.dot(mueller_matrix1.matrix, matrix2)))
Ejemplo n.º 3
0
 def test_matrix_by_scalar(self):
     matrix = self.mueller_matrix.matrix
     scalar1 = 2.2562276967724735
     scalar2 = scalar1 * 1e-8
     scalar3 = -5.010632784090829
     self.assertIsInstance(self.mueller_matrix.matrix_by_scalar(scalar1),
                           MuellerMatrix)
     # once I have checked the products are MuellerMatrix objects, I use the __eq__ method.
     self.assertTrue(
         self.mueller_matrix.matrix_by_scalar(scalar1) == MuellerMatrix(
             matrix * scalar1))
     self.assertIsInstance(self.mueller_matrix.matrix_by_scalar(scalar2),
                           MuellerMatrix)
     self.assertTrue(
         self.mueller_matrix.matrix_by_scalar(scalar2) == MuellerMatrix(
             matrix * scalar2))
     self.assertIsInstance(self.mueller_matrix.matrix_by_scalar(scalar3),
                           MuellerMatrix)
     self.assertTrue(
         self.mueller_matrix.matrix_by_scalar(scalar3) == MuellerMatrix(
             matrix * scalar3))
Ejemplo n.º 4
0
 def setUp(self):
     self.matrix = _generate_matrix()
     self.mueller_matrix = MuellerMatrix(self.matrix)