Esempio n. 1
0
    def test_convert_from_half_not_covered(self):
        rreg = get_register()

        data = np.array([3])
        converted = rreg.convert(data, 'single_half_square', 'rect')
        expected = np.array([3])
        np.testing.assert_equal(converted, expected)
Esempio n. 2
0
    def test_convert_to_half(self):
        rreg = get_register()

        data = np.ones(1)
        converted = rreg.convert(data, 'rect', 'half_squares')
        expected = np.array([0.5, 0.5])
        np.testing.assert_equal(converted, expected)
Esempio n. 3
0
 def get_model(self):
     """Get a model with region register as setup in conftest
     """
     rreg = get_register()
     model = EmptySectorModel('region_test')
     model.regions = rreg
     return model
Esempio n. 4
0
    def test_convert_triangle_to_square(self):
        rreg = get_register()

        data = np.array([1, 1])
        converted = rreg.convert(data, 'half_triangles', 'half_squares')
        expected = np.array([1, 1])
        np.testing.assert_equal(converted, expected)

        data = np.array([0.25, 0.75])
        converted = rreg.convert(data, 'half_triangles', 'half_squares')
        expected = np.array([0.375, 0.625])
        np.testing.assert_equal(converted, expected)
Esempio n. 5
0
    def test_convert_from_half(self):
        rreg = get_register()

        data = np.ones(2) / 2
        converted = rreg.convert(data, 'half_squares', 'rect')
        expected = np.ones(1)
        np.testing.assert_equal(converted, expected)

        data = np.array([2, 3])
        converted = rreg.convert(data, 'half_squares', 'rect')
        expected = np.array([5])
        np.testing.assert_equal(converted, expected)
Esempio n. 6
0
    def test_convert_equal(self):
        rreg = get_register()

        data = np.ones(1)
        converted = rreg.convert(data, 'rect', 'rect_alt')
        np.testing.assert_equal(data, converted)