Spaces:
Paused
Paused
Download apps/renderer/test_wall_mural_top.py from modventures/prevision: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/modventures/prevision/resolve/main/apps/renderer/test_wall_mural_top.py
- Command line
-
hf download hf://spaces/modventures/prevision/apps/renderer/test_wall_mural_top.py
-
curl -L -o test_wall_mural_top.py https://huggingface.co/spaces/modventures/prevision/resolve/main/apps/renderer/test_wall_mural_top.py
1.3 kB
| """Murals hang from the wall's top edge: wall_top finds it in plane-v (no models). | |
| python -m unittest test_wall_mural_top | |
| """ | |
| import os | |
| import unittest | |
| import numpy as np | |
| # Same profile as the other wall tests: the first import fixes the config. | |
| os.environ.setdefault("VISUALIZER_CONFIG", "visualizer.gpu.toml") | |
| from services.wall.pipeline import wall_top | |
| class WallTopTest(unittest.TestCase): | |
| def test_v_pointing_up(self): | |
| rows = np.repeat(np.arange(100), 50) | |
| v = 2.4 - rows * 0.02 # higher in the image (smaller row) = larger v | |
| top, sign = wall_top(v, rows) | |
| self.assertEqual(sign, 1) | |
| self.assertAlmostEqual(top, 2.4, delta=0.03) | |
| def test_v_pointing_down(self): | |
| rows = np.repeat(np.arange(100), 50) | |
| v = -1.0 + rows * 0.02 | |
| top, sign = wall_top(v, rows) | |
| self.assertEqual(sign, -1) | |
| self.assertAlmostEqual(top, -1.0, delta=0.03) | |
| def test_ignores_misses_and_stray_pixels(self): | |
| rows = np.repeat(np.arange(100), 50).astype(float) | |
| v = 2.0 - rows * 0.02 | |
| v[::97] = np.nan | |
| v[5] = 50.0 # one stray pixel far above | |
| top, sign = wall_top(v, rows) | |
| self.assertEqual(sign, 1) | |
| self.assertLess(top, 2.1) | |
| if __name__ == "__main__": | |
| unittest.main() | |