Add example for phase extraction from Rayleigh coefficients#97
Open
jhpark94 wants to merge 2 commits intokc-ml2:mainfrom
Open
Add example for phase extraction from Rayleigh coefficients#97jhpark94 wants to merge 2 commits intokc-ml2:mainfrom
jhpark94 wants to merge 2 commits intokc-ml2:mainfrom
Conversation
conv_solve() returns complex Rayleigh coefficients (R_s, R_p, T_s, T_p) that carry phase information, but this is not shown in existing examples. This example demonstrates: - Accessing result.res.R_s for complex reflection amplitude - Extracting phase with np.angle() - Correct array indexing for 1D gratings: R_s[0, fto] - Phase variation with grating thickness Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Currently, accessing complex reflection/transmission amplitudes requires result.res.R_s. This adds top-level properties so users can write result.R_s directly, consistent with existing result.de_ri. Changes: - ResultNumpy, ResultTorch, ResultJax: add R_s, R_p, T_s, T_p properties - examples/phase_extraction.py: demonstrate usage with result.R_s Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
examples/phase_extraction.pydemonstrating how to extract reflection/transmission phase fromconv_solve()resultsresult.res.R_sfor complex Rayleigh coefficientsR_s[0, fto]Motivation
The tutorial (01-modeling-and-emsolver.ipynb) lists R_s, R_p, T_s, T_p as attributes but does not explain that these are complex-valued or show how to extract phase from them. Phase information is critical for metasurface design and wavefront engineering.
Test plan
🤖 Generated with Claude Code