Skip to content

fix: correct edge thickness calculation in LensOperand#528

Closed
lutzerb wants to merge 1 commit intooptiland:masterfrom
lutzerb:fix/edge-thickness-operand
Closed

fix: correct edge thickness calculation in LensOperand#528
lutzerb wants to merge 1 commit intooptiland:masterfrom
lutzerb:fix/edge-thickness-operand

Conversation

@lutzerb
Copy link
Copy Markdown
Contributor

@lutzerb lutzerb commented Mar 20, 2026

Two bugs in LensOperand.edge_thickness():

  1. TypeError crash when semi_aperture is None: the optimization loop does not call update_paraxial() before evaluating operands, so semi_aperture can still be None. Fix: call update_paraxial() internally when needed.

  2. Wrong aperture used for sag evaluation: edge thickness was computed at the minimum semi-aperture, but a lens blank is ground to a single diameter set by the maximum clear aperture. Using the minimum masked real producibility issues. Fix: replace be.minimum with be.maximum.

Fixes #519

Two bugs in LensOperand.edge_thickness():

1. TypeError crash when semi_aperture is None: the optimization loop does
   not call update_paraxial() before evaluating operands, so semi_aperture
   can still be None. Fix: call update_paraxial() internally when needed.

2. Wrong aperture used for sag evaluation: edge thickness was computed at
   the *minimum* semi-aperture, but a lens blank is ground to a single
   diameter set by the *maximum* clear aperture. Using the minimum masked
   real producibility issues. Fix: replace be.minimum with be.maximum.

Fixes optiland#519

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@manuelFragata
Copy link
Copy Markdown
Collaborator

manuelFragata commented Mar 20, 2026

Hi there @lutzerb ,

Regarding the call of update_paraxial() inside the operand, I think that is not the safest approach, and would introduce other issues later on. Operands are evaluators and should not trigger global system traces, even if paraxial. I will think about a better approach here. NOTE: this is also then related to the issue #318 where I state the problem happening in the current codebase. I could work again on that in the coming week. I think it is time.

The fix for the error in the computation of the edge_thickness makes sense, thank you for correcting that. I will come back to you on the first error your pointed out.

Best,
Manuel

@manuelFragata
Copy link
Copy Markdown
Collaborator

manuelFragata commented Apr 2, 2026

fixed in PR #548

if okay with you @lutzerb I will close this PR. But let me know if you cannot run the optimization. I tried with the most recent version in the master branch and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edge thickness not calculated correctly

2 participants