Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refractive functionality, lots of physics validation to support #111

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ To get started with your first Rayfront model, check out `Intro to Poke: The Ray
notebooks/rayfrontattributes.ipynb
notebooks/using_ipython.ipynb
notebooks/introtopolarization.ipynb
notebooks/gaussian_beamlets.ipynb
notebooks/jonespupils.ipynb
notebooks/coating_types.ipynb
notebooks/material_data.ipynb
notebooks/thinfilm_optimization.ipynb
notebooks/aboutpoke.ipynb
Expand Down
447 changes: 447 additions & 0 deletions docs/notebooks/coating_types.ipynb

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/notebooks/gaussian_beamlets.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# PSF Simulation with Gaussian Beamlet Decomposition\n",
"_written by Jaren Ashcraft_\n",
"# Intro to Poke: Gaussian Beamlet Decomposition\n",
"\n",
"_written by Jaren N. Ashcraft_\n",
"\n",
"Traditional diffraction simulation is typically done by projecting some signal $U$ onto an infinite sum of some elementary wave (plane, parabolic, spherical waves). Gaussian Beamlet Decomposition is a different take on this, where $U$ is instead projected onto a finite sum of Gaussian Beams.\n",
"\n",
Expand Down
832 changes: 10 additions & 822 deletions docs/notebooks/introtopolarization.ipynb

Large diffs are not rendered by default.

390 changes: 390 additions & 0 deletions experiments/physics_validation/brewster.ipynb

Large diffs are not rendered by default.

Binary file added experiments/physics_validation/brewster.len
Binary file not shown.
Binary file not shown.
1,311 changes: 1,311 additions & 0 deletions experiments/physics_validation/introtopolarization_discrepancy.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion experiments/physics_validation/run_polgrid.seq
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ wri ^success
! Write output_array to text file
BUF DEL B1
^result == ARRAY_TO_BUFFER(^output_array,1,0)
BUF EXP B1 SEP "polgrid_output.txt"
BUF EXP B1 SEP "polgrid_output_singlet.txt"
Binary file added experiments/physics_validation/singlet.len
Binary file not shown.
Binary file modified experiments/physics_validation/singlet.zmx
Binary file not shown.
868 changes: 868 additions & 0 deletions experiments/physics_validation/singlet_prt.ipynb

Large diffs are not rendered by default.

28 changes: 15 additions & 13 deletions poke/poke_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ def compute_jones_pupil(
entrance_x=np.array([1.0, 0.0, 0.0]),
exit_x=np.array([1.0, 0.0, 0.0]),
proper_retardance=False,
):
coordinates="double",
collimated_object=True):
"""compute jones pupil from ray data using the double pole coordinate system

Parameters
Expand All @@ -357,12 +358,16 @@ def compute_jones_pupil(
output local x-axis in global coordinates, by default np.array([1.,0.,0.])
proper_retardance : bool, optional
whether to use the "proper" retardance calculation, by default False
coordinates : string
type of local coordinate transformation to use. Options are "double" for the double-pole
coordinate system, and "dipole" for the dipole coordinate system.
collimated_object : bool
If object space is collimated or not. If true, applies same basis vectors to all input rays,
otherwise, it computes them on a curved surface.
"""

if proper_retardance:
warnings.warn(
"The proper retardance calculation is prone to unphysical results and requires further testing"
)
warnings.warn("The proper retardance calculation is prone to unphysical results and requires further testing")

for rayset_ind, rayset in enumerate(self.raysets):

Expand All @@ -374,20 +379,17 @@ def compute_jones_pupil(
self.m2Data[rayset_ind],
self.n2Data[rayset_ind],
self._surfaces,
ambient_index=ambient_index
)

Psys, Jsys, Qsys = pol.system_prt_matrices(
aoi, kin, kout, norm, self._surfaces, self.wavelength, ambient_index
)
Psys, Jsys, Qsys = pol.system_prt_matrices(aoi, kin, kout, norm, self._surfaces, self.wavelength, ambient_index)
P, Q = pol.total_prt_matrix(Psys, Qsys)

if proper_retardance:
Jpupil = pol.global_to_local_coordinates(
P, kin[0], kout[-1], aloc, entrance_x, exit_x, Q=Q
)
Jpupil = pol.global_to_local_coordinates(P, kin[0], kout[-1], aloc, entrance_x, exit_x, Q=Q, coordinates=coordinates)

else:
Jpupil = pol.global_to_local_coordinates(
P, kin[0], kout[-1], aloc, entrance_x, exit_x
)
Jpupil = pol.global_to_local_coordinates(P, kin[0], kout[-1], aloc, entrance_x, exit_x, coordinates=coordinates)

self.jones_pupil.append(Jpupil)
self.P_total.append(P)
Expand Down
2 changes: 2 additions & 0 deletions poke/poke_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,11 @@ def rotation_3d(angle, axis):
],
]
)

if mat.ndim > 2:
for i in range(mat.ndim - 2):
mat = np.moveaxis(mat, -1, 0)

return mat


Expand Down
Loading
Loading