Skip to content

Commit 7ac5ee7

Browse files
committed
Updated landmark_comparison regression. All tests should pass
1 parent f6f06a1 commit 7ac5ee7

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

src/landmark_tools/landmark_util/landmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ bool Write_LMK(const char *filename, const LMK *lmk)
165165

166166
size_t version_size = 32;
167167
char version[version_size];
168-
strncpy(version, "#! LVS Map v3.0", version_size);
168+
strncpy(version, "#! LVS Map v3.0", 16);
169169
if(fwrite(version, sizeof(uint8_t), version_size, fp) != version_size) return false;
170170

171171
if(fwrite(&lmk->lmk_id, sizeof(uint8_t), LMK_ID_SIZE, fp) != LMK_ID_SIZE) return false;
@@ -235,7 +235,7 @@ bool Read_LMK(const char *filename, LMK *lmk)
235235
size_t char_array_size = 32;
236236
char char_array[char_array_size];
237237
if(fread(char_array, sizeof(char), char_array_size, fp) != char_array_size) return false;
238-
SAFE_PRINTF(64, "%s\n", char_array);
238+
SAFE_PRINTF(char_array_size, "%s\n", char_array);
239239

240240
if(fread(lmk->lmk_id, sizeof(char), LMK_ID_SIZE, fp) != LMK_ID_SIZE) return false;
241241

tests/gold_standard_data/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ The polar stereo DEM is a crop from Site 01 from [High-Resolution LOLA Topograph
1313
The landmark files were created from polar stereo DEMs using commit 7ff339f07fbc0e7599d24590a7f81c3a060ad30d due to inconsistancy with how polar stereo projection was handled in
1414
6828ae2084eeace3a21210e195c91de76c194923
1515

16+
The comparison raw files were created using f6f06a1c5f2710689f38cf30f74021475006421e.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:5c8e0cf02800389e5cc26e418682dc9acf460a334a5cecdfbda67868279855be
2+
oid sha256:a190c0f470dd8bbc3672c6339fdce5922744c89862b13b75813a22ff11eab561
33
size 1000000
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:60cb70e1ba55504a30023f9ccd2d717ccf7e2ec93b21bd49a56bac024aa88af6
2+
oid sha256:317ff0c5e0e3012319c0d17c4e49ec8274c71a557ed2daa2c1ced2b34129f4cc
33
size 1000000
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:659f7eb88a255d68ed0dd6483aeb774edc3d6b1ba241a30130f2a14ab5f3af5f
2+
oid sha256:b9da08a8ca723b14f09aade75456a10aac57659b9ed381fd542b23efa4d14698
33
size 1000000
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:a28ec5a69a37657f4aa9b0362b2f2e9e24d692555116157810df06143736003e
2+
oid sha256:05ac06c12e247fb25a540db57500340c66835279dce0c9d5ab09e700d1496587
33
size 1000000

tests/test_landmark_comparison.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ def test_landmark_comparison_regression(tmp_path):
3535
for key,I1 in displacement_maps1.items():
3636
I2 = displacement_maps2[key]
3737
mask = np.logical_not(np.logical_or(np.isnan(I1), np.isnan(I2)))
38-
np.testing.assert_allclose(I1[mask], I2[mask], rtol=0, atol=1)
38+
if(key != "correlation"):
39+
np.testing.assert_allclose(I1[mask], I2[mask], rtol=0, atol=1)
40+
else:
41+
np.testing.assert_allclose(I1[mask], I2[mask])
3942

4043

4144
def test_landmark_comparison_self(tmp_path):
4245
"""A landmark compared to itself should have zero disparity
46+
47+
The resolution of the map is 5m/px. The test tolerance is < 5m maximum, so sub-pixel disparity.
4348
"""
4449
output_prefix = tmp_path / "comparison"
4550

@@ -60,7 +65,7 @@ def test_landmark_comparison_self(tmp_path):
6065
for key,I1 in displacement_maps1.items():
6166
if(key != "correlation"):
6267
# Displacement should be low
63-
np.testing.assert_allclose(I1[np.logical_not(np.isnan(I1))], 0, rtol=0, atol=1)
68+
np.testing.assert_allclose(I1[np.logical_not(np.isnan(I1))], 0, rtol=0, atol=5)
6469
else:
6570
# Correlation should be high
6671
assert np.all(I1[np.logical_not(np.isnan(I1))] > 0.7), "Not all elements are greater than 0.7"

0 commit comments

Comments
 (0)