Skip to content

Commit ba1417c

Browse files
committed
generate new expected test data and fix tolerances
1 parent 8afb86a commit ba1417c

13 files changed

Lines changed: 10 additions & 19 deletions

artist/core/heliostat_ray_tracer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,6 @@ def sample_bitmaps(
825825
index_3[~intersection_indices_on_target] = 0
826826
index_4[~intersection_indices_on_target] = 0
827827

828-
# index_1 = index_1[torch.where(index_1 < 0 | index_1 > )]
829-
830828
intensities_pixel_1 = intensities_pixel_1 * intersection_indices_on_target
831829
intensities_pixel_2 = intensities_pixel_2 * intersection_indices_on_target
832830
intensities_pixel_3 = intensities_pixel_3 * intersection_indices_on_target

tests/core/test_blocking.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,6 @@ def test_blocking_integration(device: torch.device) -> None:
413413
device=device,
414414
)
415415

416-
# Scale bitmap for testing precision.
417-
bitmaps_per_heliostat = (
418-
bitmaps_per_heliostat
419-
/ (bitmaps_per_heliostat.sum(dim=(1, 2), keepdim=True) + 1e-8)
420-
) * 100
421-
422416
expected_path = (
423417
pathlib.Path(ARTIST_ROOT)
424418
/ "tests/data/expected_bitmaps_blocking"
@@ -427,7 +421,12 @@ def test_blocking_integration(device: torch.device) -> None:
427421

428422
expected = torch.load(expected_path, map_location=device, weights_only=True)
429423

430-
torch.testing.assert_close(bitmaps_per_heliostat, expected, atol=5e-4, rtol=5e-4)
424+
torch.testing.assert_close(
425+
bitmaps_per_heliostat,
426+
expected,
427+
atol=bitmaps_per_heliostat.mean() * 0.01,
428+
rtol=0.01,
429+
)
431430

432431

433432
def test_ray_extinction(device: torch.device) -> None:
@@ -510,9 +509,6 @@ def test_ray_extinction(device: torch.device) -> None:
510509
(bitmaps_per_heliostat_no_extinction, bitmaps_per_heliostat_extinction)
511510
)
512511

513-
# Scale bitmap for testing precision.
514-
bitmaps = (bitmaps / (bitmaps.sum(dim=(1, 2), keepdim=True) + 1e-8)) * 100
515-
516512
expected_path = (
517513
pathlib.Path(ARTIST_ROOT)
518514
/ "tests/data/expected_bitmaps_ray_extinction"
@@ -521,7 +517,7 @@ def test_ray_extinction(device: torch.device) -> None:
521517

522518
expected = torch.load(expected_path, map_location=device, weights_only=True)
523519

524-
torch.testing.assert_close(bitmaps, expected, atol=5e-4, rtol=5e-4)
520+
torch.testing.assert_close(bitmaps, expected, atol=bitmaps.mean() * 0.01, rtol=0.01)
525521
torch.testing.assert_close(
526522
bitmaps_per_heliostat_no_extinction[0].sum() * (1 - ray_extinction_factor),
527523
bitmaps_per_heliostat_extinction[0].sum(),
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)