{{ message }}
Repository navigation
feat(fileio): import and export Zemax rectangular and elliptical apertures - #954
Merged
HarrisonKramer merged 1 commit intoOct 24, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Collaborator
|
Hi @jaruiz6363, Thanks for splitting this out. #953 is merged, so could you rebase this onto master? The OBSC commit should drop out of the diff and leave only the rectangular/elliptical change. Happy to review it as soon as it is updated. Best, |
Read SQAP and ELAP as RectangularAperture and EllipticalAperture, and their obscuration counterparts SQOB and ELOB as an unbounded aperture minus the shape, so rays inside it are blocked and everything else passes. OBDC decentres all four, in either order. The writer emits the same records, plus OBDC, instead of approximating a rectangle as a circular CLAP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jaruiz6363
force-pushed
the
feat/zemax-rect-ellip-apertures
branch
from
October 20, 2026 16:29
48f9e8d to
4361c13
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Refs #931. Depends on #953: this branch sits on top of the OBSC commit (461da65), which will drop out of the diff once #953 merges. Only the last commit (48f9e8d) is new here.
Summary
The Zemax reader skipped rectangular and elliptical surface apertures; it only stopped them from leaving a fixed ("U") semi-diameter clip behind. The writer exported a
RectangularApertureas a circularCLAPof radiusx_max.OpticStudio writes the four types as:
SQAP x_half y_half pickupSQOB x_half y_half pickupELAP x_half y_half pickupELOB x_half y_half pickupAn
OBDCrecord decentres any of them. The last field names a pickup surface (0 for none); the file still carries the picked-up half-widths, so the reader uses the values on the line.Reader
SQAP→RectangularAperture(ox - xh, ox + xh, oy - yh, oy + yh)ELAP→EllipticalAperture(xh, yh, ox, oy)SQOB/ELOB→DifferenceAperture(RadialAperture(0, inf), shape): rays inside the shape are blocked, everything else passes with no outer limit, likeOBSC.OBDCapplies in either order relative to the shape record, as forCLAPandOBSC.Writer
Emits the matching
SQAP/SQOB/ELAP/ELOBrecord plusOBDCfor a non-zero centre, so these apertures round-trip. An asymmetricRectangularApertureis written as its half-widths and centre.Tests
tests/test_fileio/test_zemax_rect_ellip_apertures.py: aperture types built, which rays pass or are blocked for each type with a decentred 6 × 3 shape, replacement of the fixed semi-diameter clip,OBDCorder, the pickup field, and round trips (records written andto_dictequality).test_zemax_semi_diameter.py: SQAP and ELAP removed from the unsupported-aperture list (SPID and USAP remain).Aperture tests pass on numpy and torch.
🤖 Generated with Claude Code