Skip to content

Commit f89364f

Browse files
Jammy2211Jammy2211
authored andcommitted
all unit tests pass
1 parent 408c8dd commit f89364f

4 files changed

Lines changed: 13 additions & 52 deletions

File tree

test_autoarray/inversion/pixelization/mappers/test_abstract.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ def test__mapped_to_source_from(grid_2d_7x7):
174174
)
175175

176176
mesh_grid = aa.Mesh2DDelaunay(
177-
values=mesh_grid,
178-
source_plane_data_grid_over_sampled=grid_2d_7x7.over_sampled
177+
values=mesh_grid, source_plane_data_grid_over_sampled=grid_2d_7x7.over_sampled
179178
)
180179

181180
mapper_grids = aa.MapperGrids(

test_autoarray/inversion/pixelization/mappers/test_delaunay.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test__pix_indexes_for_sub_slim_index__matches_util(grid_2d_sub_1_7x7):
2020
mesh_grid = aa.Mesh2DDelaunay(
2121
values=mesh_grid,
2222
source_plane_data_grid_over_sampled=grid_2d_sub_1_7x7.over_sampled,
23-
_xp=np
23+
_xp=np,
2424
)
2525

2626
mapper_grids = aa.MapperGrids(
@@ -44,7 +44,11 @@ def test__pix_indexes_for_sub_slim_index__matches_util(grid_2d_sub_1_7x7):
4444
pix_indexes_for_simplex_index=pix_indexes_for_simplex_index,
4545
delaunay_points=mapper.delaunay.points,
4646
)
47-
sizes = np.sum(pix_indexes_for_sub_slim_index_util >= 0, axis=1).astype(np.int32).astype("int")
47+
sizes = (
48+
np.sum(pix_indexes_for_sub_slim_index_util >= 0, axis=1)
49+
.astype(np.int32)
50+
.astype("int")
51+
)
4852

4953
assert (
5054
mapper.pix_indexes_for_sub_slim_index == pix_indexes_for_sub_slim_index_util

test_autoarray/structures/mesh/test_delaunay.py

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,6 @@
44
import autoarray as aa
55

66

7-
def test__edge_pixel_list():
8-
9-
grid = np.array(
10-
[
11-
[1.0, -1.0],
12-
[1.0, 0.0],
13-
[1.0, 1.0],
14-
[0.0, -1.0],
15-
[0.0, 0.0],
16-
[0.0, 1.0],
17-
[-1.0, -1.0],
18-
[-1.0, 0.0],
19-
[-1.0, 1.0],
20-
]
21-
)
22-
23-
mesh = aa.Mesh2DDelaunay(values=grid)
24-
25-
assert mesh.edge_pixel_list == [0, 1, 2, 3, 5, 6, 7, 8]
26-
27-
287
def test__interpolated_array_from():
298
grid = aa.Grid2D.no_mask(
309
values=[[0.0, 0.0], [1.1, 0.6], [2.1, 0.1], [0.4, 1.1], [1.1, 7.1], [2.1, 1.1]],
@@ -63,7 +42,6 @@ def test__interpolated_array_from():
6342

6443
def test__neighbors(grid_2d_sub_1_7x7):
6544

66-
6745
mesh_grid = aa.Grid2D.no_mask(
6846
values=[[0.1, 0.1], [1.1, 0.6], [2.1, 0.1], [0.4, 1.1], [1.1, 7.1], [2.1, 1.1]],
6947
shape_native=(3, 2),
@@ -75,7 +53,6 @@ def test__neighbors(grid_2d_sub_1_7x7):
7553
values=mesh_grid, source_plane_data_grid_over_sampled=grid_2d_sub_1_7x7
7654
)
7755

78-
7956
neighbors = mesh_grid.neighbors
8057

8158
expected = np.array(
@@ -95,15 +72,18 @@ def test__neighbors(grid_2d_sub_1_7x7):
9572
)
9673

9774

98-
def test__voronoi_areas_via_delaunay_from():
75+
def test__voronoi_areas_via_delaunay_from(grid_2d_sub_1_7x7):
9976

10077
mesh_grid = np.array(
10178
[[0.0, 0.0], [1.1, 0.6], [2.1, 0.1], [0.4, 1.1], [1.1, 7.1], [2.1, 1.1]]
10279
)
10380

104-
mesh = aa.Mesh2DDelaunay(mesh_grid)
81+
mesh = aa.Mesh2DDelaunay(
82+
values=mesh_grid,
83+
source_plane_data_grid_over_sampled=grid_2d_sub_1_7x7.over_sampled,
84+
)
10585

106-
voronoi_areas = mesh.delaunay.voronoi_areas
86+
voronoi_areas = mesh.voronoi_areas
10787

10888
assert voronoi_areas[1] == pytest.approx(1.39137102, 1.0e-4)
10989
assert voronoi_areas[3] == pytest.approx(29.836324, 1.0e-4)

test_autoarray/structures/mesh/test_rectangular.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,6 @@ def test__neighbors__compare_to_mesh_util():
2424
assert (mesh.neighbors.sizes == neighbors_sizes_util).all()
2525

2626

27-
def test__edge_pixel_list():
28-
grid = aa.Grid2DIrregular(
29-
[
30-
[-1.0, -1.0],
31-
[-1.0, 0.0],
32-
[-1.0, 1.0],
33-
[0.0, -1.0],
34-
[0.0, 0.0],
35-
[0.0, 1.0],
36-
[1.0, -1.0],
37-
[1.0, 0.0],
38-
[1.0, 1.0],
39-
]
40-
)
41-
42-
mesh = aa.Mesh2DRectangularUniform.overlay_grid(
43-
shape_native=(3, 3), grid=grid, buffer=1e-8
44-
)
45-
46-
assert mesh.edge_pixel_list == [0, 1, 2, 3, 5, 6, 7, 8]
47-
48-
4927
def test__shape_native_and_pixel_scales():
5028
grid = aa.Grid2DIrregular(
5129
[

0 commit comments

Comments
 (0)