fix: 将弱覆盖占比改为连续渐变

This commit is contained in:
RBP15P
2026-07-19 13:43:41 +08:00
parent 7233021b16
commit 28caf39e01
4 changed files with 60 additions and 41 deletions
+10 -11
View File
@@ -78,22 +78,21 @@ class ContinuousHeatmapTest(unittest.TestCase):
class WeakCoverRatioTest(unittest.TestCase):
def test_fixed_percentage_color_boundaries(self):
values = np.array([[0.0, 5.0, 5.01, 9.99, 10.0, 19.99, 20.0, 100.0]], dtype=np.float32)
def test_continuous_percentage_color_anchors(self):
values = np.array([[0.0, 2.5, 5.0, 7.5, 10.0, 15.0, 20.0, 100.0]], dtype=np.float32)
colors = main.weak_cover_ratio_rgb_for_values(values)
self.assertEqual(
colors.tolist(),
[[
list(main.WEAK_COVER_RATIO_GREEN),
self.assertEqual(colors[0, 0].tolist(), list(main.WEAK_COVER_RATIO_GREEN))
self.assertEqual(colors[0, 2].tolist(), list(main.WEAK_COVER_RATIO_BLUE))
self.assertEqual(colors[0, 4].tolist(), list(main.WEAK_COVER_RATIO_YELLOW))
self.assertEqual(colors[0, 6].tolist(), list(main.WEAK_COVER_RATIO_RED))
self.assertEqual(colors[0, 7].tolist(), list(main.WEAK_COVER_RATIO_RED))
for index in (1, 3, 5):
self.assertNotIn(colors[0, index].tolist(), [
list(main.WEAK_COVER_RATIO_GREEN),
list(main.WEAK_COVER_RATIO_BLUE),
list(main.WEAK_COVER_RATIO_BLUE),
list(main.WEAK_COVER_RATIO_YELLOW),
list(main.WEAK_COVER_RATIO_YELLOW),
list(main.WEAK_COVER_RATIO_RED),
list(main.WEAK_COVER_RATIO_RED),
]],
)
])
class SpatialNameIndexTest(unittest.TestCase):