Skip to content

Commit 9db5cfc

Browse files
committed
further condense logic
1 parent e2873c7 commit 9db5cfc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

optiland/paraxial.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ def _focal_length(self, y, u) -> be.array:
6464
"""Determine the focal length and sign, reasoned from left to right (f2)"""
6565
focus = be.abs(y[0] / u[-1])[0]
6666

67-
if y[-1] == 0.0: # At a real focus
68-
return focus
69-
70-
# y[-1] < 0, u[-1] > 0 or v.v.: positive focus, -y[0]/u[-1] > 0
71-
if be.sign(y[-1] * u[-1]) < 0 or self._has_internal_focus_point(y):
67+
if (
68+
y[-1] == 0.0 # Real internal focus
69+
or be.sign(y[-1] * u[-1]) < 0 # Real external focus
70+
or self._has_internal_focus_point(y) # Real internal focus
71+
):
7272
return focus
7373
else:
7474
return -focus

0 commit comments

Comments
 (0)