def test_generate_grid(): r"""Test generate grid function.""" x = list(range(10)) y = list(range(10)) bbox = get_boundary_coords(x, y) gx, gy = generate_grid(3, bbox) truth_x = np.array([[0.0, 4.5, 9.0], [0.0, 4.5, 9.0], [0.0, 4.5, 9.0]]) truth_y = np.array([[0.0, 0.0, 0.0], [4.5, 4.5, 4.5], [9.0, 9.0, 9.0]]) assert_array_almost_equal(gx, truth_x) assert_array_almost_equal(gy, truth_y)
def test_generate_grid_coords(): r"""Test generate grid coordinates function.""" x = list(range(10)) y = list(range(10)) bbox = get_boundary_coords(x, y) gx, gy = generate_grid(3, bbox) truth = [[0.0, 0.0], [4.5, 0.0], [9.0, 0.0], [0.0, 4.5], [4.5, 4.5], [9.0, 4.5], [0.0, 9.0], [4.5, 9.0], [9.0, 9.0]] pts = generate_grid_coords(gx, gy) assert_array_almost_equal(truth, pts)
def test_generate_grid_coords(): r"""Test generate grid coordinates function.""" x = list(range(10)) y = list(range(10)) bbox = get_boundary_coords(x, y) gx, gy = generate_grid(3, bbox) truth = [[0.0, 0.0], [4.5, 0.0], [9.0, 0.0], [0.0, 4.5], [4.5, 4.5], [9.0, 4.5], [0.0, 9.0], [4.5, 9.0], [9.0, 9.0]] pts = generate_grid_coords(gx, gy) assert_array_almost_equal(truth, pts) assert pts.flags['C_CONTIGUOUS'] # need output to be C-contiguous
def test_generate_grid(): r"""Test generate grid function.""" x = list(range(10)) y = list(range(10)) bbox = get_boundary_coords(x, y) gx, gy = generate_grid(3, bbox) truth_x = np.array([[0.0, 4.5, 9.0], [0.0, 4.5, 9.0], [0.0, 4.5, 9.0]]) truth_y = np.array([[0.0, 0.0, 0.0], [4.5, 4.5, 4.5], [9.0, 9.0, 9.0]]) assert_array_almost_equal(gx, truth_x) assert_array_almost_equal(gy, truth_y)
def test_generate_grid_coords(): r"""Test generate grid coordinates function.""" x = list(range(10)) y = list(range(10)) bbox = get_boundary_coords(x, y) gx, gy = generate_grid(3, bbox) truth = [[0.0, 0.0], [4.5, 0.0], [9.0, 0.0], [0.0, 4.5], [4.5, 4.5], [9.0, 4.5], [0.0, 9.0], [4.5, 9.0], [9.0, 9.0]] pts = generate_grid_coords(gx, gy) assert_array_almost_equal(truth, pts)