예제 #1
0
파일: core_test.py 프로젝트: 4x/oq-engine
    def test_update_result_matrix_with_scalars(self):
        init = 0.0
        result = core.update_result_matrix(init, 0.2)
        # The first time we apply this formula on a 0.0 value,
        # result is equal to the first new value we apply.
        self.assertAlmostEqual(0.2, result)

        result = core.update_result_matrix(result, 0.3)
        self.assertAlmostEqual(0.44, result)
예제 #2
0
    def test_update_result_matrix_with_scalars(self):
        init = 0.0
        result = core.update_result_matrix(init, 0.2)
        # The first time we apply this formula on a 0.0 value,
        # result is equal to the first new value we apply.
        self.assertAlmostEqual(0.2, result)

        result = core.update_result_matrix(result, 0.3)
        self.assertAlmostEqual(0.44, result)
예제 #3
0
파일: core_test.py 프로젝트: 4x/oq-engine
    def test_update_result_matrix_numpy_arrays(self):
        init = numpy.zeros((4, 4))
        first = numpy.array([0.2] * 16).reshape((4, 4))

        result = core.update_result_matrix(init, first)
        numpy.testing.assert_allclose(first, result)

        second = numpy.array([0.3] * 16).reshape((4, 4))
        result = core.update_result_matrix(result, second)

        expected = numpy.array([0.44] * 16).reshape((4, 4))
        numpy.testing.assert_allclose(expected, result)
예제 #4
0
    def test_update_result_matrix_numpy_arrays(self):
        init = numpy.zeros((4, 4))
        first = numpy.array([0.2] * 16).reshape((4, 4))

        result = core.update_result_matrix(init, first)
        numpy.testing.assert_allclose(first, result)

        second = numpy.array([0.3] * 16).reshape((4, 4))
        result = core.update_result_matrix(result, second)

        expected = numpy.array([0.44] * 16).reshape((4, 4))
        numpy.testing.assert_allclose(expected, result)