Skip to content

Commit

Permalink
Added esis.flights.f1.optics.primaries.materials.multilayer_fit().
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Feb 17, 2024
1 parent 7de0d4e commit e4d049e
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 1 deletion.
65 changes: 65 additions & 0 deletions esis/flights/f1/optics/primaries/materials/_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"multilayer_design",
"reflectivity_witness",
"multilayer_witness",
"multilayer_fit",
]


Expand Down Expand Up @@ -252,3 +253,67 @@ def _func(x: np.ndarray):
)

return _multilayer(*fit.x)


def multilayer_fit() -> optika.materials.MultilayerMirror:
"""
A multilayer coating determined by modifying :func:`multilayer_witness`
to have a glass substrate.
Examples
--------
Plot the reflectivity of this multilayer stack as a function of incidence angle.
.. jupyter-execute::
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import named_arrays as na
import optika
import esis
# Define a grid of wavelength samples
wavelength = na.geomspace(100, 1000, axis="wavelength", num=1001) * u.AA
# Define a grid of incidence angles
angle = na.linspace(0, 20, axis="angle", num=3) * u.deg
# Define the light rays incident on the multilayer stack
rays = optika.rays.RayVectorArray(
wavelength=wavelength,
direction=na.Cartesian3dVectorArray(
x=np.sin(angle),
y=0,
z=np.cos(angle),
),
)
# Initialize the multilayer stack
multilayer = esis.flights.f1.optics.primaries.materials.multilayer_fit()
# Compute the reflectivity of the multilayer for the given incident rays
reflectivity = multilayer.efficiency(
rays=rays,
normal=na.Cartesian3dVectorArray(0, 0, -1),
)
# Plot the reflectivity of the multilayer as a function of wavelength
fig, ax = plt.subplots(constrained_layout=True)
na.plt.plot(
wavelength,
reflectivity,
ax=ax,
axis="wavelength",
label=angle,
);
ax.set_xlabel(f"wavelength ({wavelength.unit:latex_inline})");
ax.set_ylabel("reflectivity");
ax.legend();
"""
design = multilayer_design()
result = multilayer_witness()
result.material_substrate = design.material_substrate
return result

7 changes: 6 additions & 1 deletion esis/flights/f1/optics/primaries/materials/_design_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ def test_reflectivity_witness():
assert isinstance(r, na.FunctionArray)
assert isinstance(r.inputs, na.SpectralDirectionalVectorArray)
assert isinstance(r.outputs, na.AbstractScalar)
assert np.all(r.outputs >=0)
assert np.all(r.outputs >= 0)


def test_multilayer_witness():
r = esis.flights.f1.optics.primaries.materials.multilayer_witness()
assert isinstance(r, optika.materials.MultilayerMirror)


def test_multilayer_fit():
r = esis.flights.f1.optics.primaries.materials.multilayer_fit()
assert isinstance(r, optika.materials.MultilayerMirror)

0 comments on commit e4d049e

Please sign in to comment.