示例#1
0
    def test_n_dimensional_mean_molecular_weights(self):
        """
        Test :func:`colour.phenomena.rayleigh.mean_molecular_weights`
        definition n-dimensional arrays support.
        """

        CO2_c = 300
        m_a = mean_molecular_weights(CO2_c)

        CO2_c = np.tile(CO2_c, 6)
        m_a = np.tile(m_a, 6)
        np.testing.assert_almost_equal(mean_molecular_weights(CO2_c),
                                       m_a,
                                       decimal=7)

        CO2_c = np.reshape(CO2_c, (2, 3))
        m_a = np.reshape(m_a, (2, 3))
        np.testing.assert_almost_equal(mean_molecular_weights(CO2_c),
                                       m_a,
                                       decimal=7)

        CO2_c = np.reshape(CO2_c, (2, 3, 1))
        m_a = np.reshape(m_a, (2, 3, 1))
        np.testing.assert_almost_equal(mean_molecular_weights(CO2_c),
                                       m_a,
                                       decimal=7)
示例#2
0
    def test_nan_mean_molecular_weights(self):
        """
        Test :func:`colour.phenomena.rayleigh.mean_molecular_weights`
        definition nan support.
        """

        mean_molecular_weights(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
示例#3
0
    def test_nan_mean_molecular_weights(self):
        """
        Tests :func:`colour.phenomena.rayleigh.mean_molecular_weights`
        definition nan support.
        """

        mean_molecular_weights(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
示例#4
0
    def test_mean_molecular_weights(self):
        """
        Tests :func:`colour.phenomena.rayleigh.mean_molecular_weights`
        definition.
        """

        self.assertAlmostEqual(mean_molecular_weights(0), 28.9595, places=7)

        self.assertAlmostEqual(
            mean_molecular_weights(360), 28.964920015999997, places=7)

        self.assertAlmostEqual(
            mean_molecular_weights(620), 28.968834471999998, places=7)
示例#5
0
    def test_mean_molecular_weights(self):
        """
        Test :func:`colour.phenomena.rayleigh.mean_molecular_weights`
        definition.
        """

        self.assertAlmostEqual(mean_molecular_weights(0), 28.9595, places=7)

        self.assertAlmostEqual(mean_molecular_weights(360),
                               28.964920015999997,
                               places=7)

        self.assertAlmostEqual(mean_molecular_weights(620),
                               28.968834471999998,
                               places=7)
示例#6
0
    def test_n_dimensional_mean_molecular_weights(self):
        """
        Tests :func:`colour.phenomena.rayleigh.mean_molecular_weights`
        definition n-dimensional arrays support.
        """

        CO2_c = 300
        m_a = mean_molecular_weights(CO2_c)

        CO2_c = np.tile(CO2_c, 6)
        m_a = np.tile(m_a, 6)
        np.testing.assert_almost_equal(
            mean_molecular_weights(CO2_c), m_a, decimal=7)

        CO2_c = np.reshape(CO2_c, (2, 3))
        m_a = np.reshape(m_a, (2, 3))
        np.testing.assert_almost_equal(
            mean_molecular_weights(CO2_c), m_a, decimal=7)

        CO2_c = np.reshape(CO2_c, (2, 3, 1))
        m_a = np.reshape(m_a, (2, 3, 1))
        np.testing.assert_almost_equal(
            mean_molecular_weights(CO2_c), m_a, decimal=7)