Skip to content

Commit

Permalink
Create range before loop
Browse files Browse the repository at this point in the history
  • Loading branch information
teutoburg committed Dec 6, 2023
1 parent 8682882 commit 26f1660
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scopesim/optics/optical_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ def get_z_order_effects(self, z_level: int, z_max: int = None):
f"{z_max=} < {z_level=}.")
else:
z_max = z_min + 100 # range doesn't include final element -> 100
z_range = range(z_min, z_max)

for eff in self.effects:
if not eff.include or "z_order" not in eff.meta:
continue

if z_order_in_range(eff.meta["z_order"], range(z_min, z_max)):
if z_order_in_range(eff.meta["z_order"], z_range):
yield eff

@property
Expand Down

0 comments on commit 26f1660

Please sign in to comment.