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

Use optika.materials.snells_law_scalar() where appropriate. #49

Merged
merged 1 commit into from
Jun 10, 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
10 changes: 6 additions & 4 deletions optika/materials/_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
from typing import Sequence
import abc
import dataclasses
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import astropy.units as u
import named_arrays as na
import optika
from . import matrices
from . import matrices, snells_law_scalar

__all__ = [
"AbstractLayer",
Expand Down Expand Up @@ -201,8 +200,11 @@ def transfer(

n_internal = self.n(wavelength)

angle_internal = np.arcsin(n * np.sin(np.arccos(direction)) / n_internal)
direction_internal = np.cos(angle_internal)
direction_internal = snells_law_scalar(
cos_incidence=direction,
index_refraction=n,
index_refraction_new=n_internal,
)

refraction = matrices.refraction(
wavelength=wavelength,
Expand Down
10 changes: 7 additions & 3 deletions optika/materials/_multilayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import named_arrays as na
import optika
from . import (
snells_law_scalar,
AbstractMaterial,
AbstractMirror,
AbstractLayer,
Expand Down Expand Up @@ -39,7 +40,7 @@ def multilayer_coefficients(
]:
r"""
Calculate the reflection and transmission coefficients of a multilayer
stack using the method described in :cite:t:`Yeh1998`.
stack using the method described in :cite:t:`Yeh1988`.

Parameters
----------
Expand Down Expand Up @@ -494,8 +495,11 @@ def multilayer_efficiency(
)

n_substrate = substrate.n(wavelength)
angle_substrate = np.arcsin(n * np.sin(np.arccos(direction_ambient)) / n_ambient)
direction_substrate = np.cos(angle_substrate)
direction_substrate = snells_law_scalar(
cos_incidence=direction_ambient,
index_refraction=n_ambient,
index_refraction_new=n_substrate,
)

impedance_ambient = optika.vectors.PolarizationVectorArray(
s=n_ambient,
Expand Down
Loading