ITS: loosen test_zoom.py offset rel_tol for low offset values
bug: 233617951
Change-Id: I17634af8dfffa585e77c4287a12527160d855dc7
diff --git a/apps/CameraITS/tests/scene6/test_zoom.py b/apps/CameraITS/tests/scene6/test_zoom.py
index 89cdae5..c828ad5 100644
--- a/apps/CameraITS/tests/scene6/test_zoom.py
+++ b/apps/CameraITS/tests/scene6/test_zoom.py
@@ -38,7 +38,9 @@
MIN_FOCUS_DIST_TOL = 0.80 # allow charts a little closer than min
NAME = os.path.splitext(os.path.basename(__file__))[0]
NUM_STEPS = 10
+OFFSET_LOW_VAL = 10 # number of pixels
OFFSET_RTOL = 0.15
+OFFSET_RTOL_LOW_OFFSET = 0.20
OFFSET_RTOL_MIN_FD = 0.30
RADIUS_RTOL = 0.10
RADIUS_RTOL_MIN_FD = 0.15
@@ -323,9 +325,13 @@
offset_rel = (distance(offset_abs[0], offset_abs[1]) / z_ratio /
distance(offset_init[0], offset_init[1]))
logging.debug('offset_rel: %.3f', offset_rel)
- if not math.isclose(offset_rel, 1.0, rel_tol=data['o_tol']):
+ rel_tol = data['o_tol']
+ if (np.linalg.norm(offset_init) < OFFSET_LOW_VAL and
+ rel_tol == OFFSET_RTOL):
+ rel_tol = OFFSET_RTOL_LOW_OFFSET
+ if not math.isclose(offset_rel, 1.0, rel_tol=rel_tol):
raise AssertionError(f"zoom: {data['z']:.2f}, offset(rel to 1): "
- f"{offset_rel:.4f}, RTOL: {data['o_tol']}")
+ f'{offset_rel:.4f}, RTOL: {rel_tol}')
if __name__ == '__main__':
test_runner.main()