Change wavefront map indices to range [-1, 1] for actual sampled pupil#222
Open
crnh wants to merge 3 commits into
Open
Change wavefront map indices to range [-1, 1] for actual sampled pupil#222crnh wants to merge 3 commits into
crnh wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR fixes Wavefront Map datagrid coordinate labeling and sizing so returned results align with OpticStudio’s actual sampled pupil points and span the intended [-1, 1] coordinate range.
Changes:
- Update Wavefront Map to return an N×N DataFrame (including the empty row/column as NaN) with corrected coordinate indices.
- Extend
unpack_datagridto allow overriding grid spacing (dx,dy) when generating labels. - Update tests and reference data to reflect the corrected Wavefront Map grid and indices.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| zospy/utils/zputils.py | Adds dx/dy overrides for datagrid label generation. |
| zospy/analyses/wavefront/wavefront_map.py | Returns full N×N grid and constructs corrected pupil coordinates via unpack_datagrid. |
| tests/utils/test_zputils.py | Refactors/expands tests for unpack_datagrid, including custom spacing. |
| tests/analyses/test_wavefront.py | Adds assertions for Wavefront Map index/step sizing and reference matching. |
| tests/data/reference/*.json | Updates stored reference outputs for new grid size/indices. |
| pyproject.toml | Adds ipykernel to dev dependency group. |
| CHANGELOG.md | Documents the Wavefront Map DataFrame size/index fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5 tasks
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.
Proposed change
For an N x N sampling, the Wavefront Map analysis returns an (N - 1) x (N - 1) DataFrame with incorrect row and column labels. This was caused by an incorrect interpretation of the ZOS-API output (cell coordinates were interpreted as corner coordinates but are in fact center coordinates) and a confusing step size returned by the ZOS-API (the API returns 2 / (N - 1), but this should be 2 / (N - 2) because OpticStudio uses an odd sampling).
Fixes in this PR:
Type of change
Additional information
Related issues
Closes #177.
Checklist
hatch test -a).If you updated an example:
hatch run all-examples).If you contributed an example: