MeasuredMirror#

class optika.materials.MeasuredMirror(efficiency_measured, substrate=None, serial_number=None)[source]#

Bases: AbstractMirror

A mirror where the reflectivity has been measured by an external source as a function of wavelength.

Examples

Create a mirror where the reflectivity is a Gaussian centered at 304 Angstroms.

import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import astropy.visualization
import named_arrays as na
import optika

# Define the mean and standard deviation of the reflectivity peak.
center = 304 * u.AA
width = 10 * u.AA

# Define a grid of wavelengths
wavelength_min = center - 3 * width
wavelength_max = center + 3 * width
wavelength = na.linspace(
    start=wavelength_min,
    stop=wavelength_max,
    axis="wavelength",
    num=11,
)

# Define an array of simulated reflectivity measurements
efficiency = na.FunctionArray(
    inputs=na.SpectralDirectionalVectorArray(
        wavelength=wavelength,
        direction=na.Cartesian3dVectorArray(0, 0, 1),
    ),
    outputs=np.exp(-np.square((wavelength - center) / width) / 2),
)

# Create an instance of a MeasuredMirror object
mirror = optika.materials.MeasuredMirror(efficiency)

# Define a new grid of wavelengths at which to evaluate the interpolated
# reflectivity
wavelength_interp = na.linspace(
    start=wavelength_min,
    stop=wavelength_max,
    axis="wavelength",
    num=1001,
)

# Evaluate the interpolated reflectivity
efficiency_interp = mirror.efficiency(
    rays=optika.rays.RayVectorArray(
        wavelength=wavelength_interp,
        direction=na.Cartesian3dVectorArray(0, 0, 1),
    ),
    normal=na.Cartesian3dVectorArray(0, 0, 1),
)

# Plot the interpolated reflectivity vs the measured reflectivity
with astropy.visualization.quantity_support():
    fig, ax = plt.subplots()
    na.plt.plot(wavelength_interp, efficiency_interp, label="interpolated");
    na.plt.scatter(efficiency.inputs.wavelength, efficiency.outputs, label="measured");
    ax.set_xlabel(f"wavelength ({ax.xaxis.get_label().get_text()})");
    ax.set_ylabel(f"reflectivity");
    ax.legend();
../_images/optika.materials.MeasuredMirror_0_0.png

Attributes

efficiency_measured

A function array that maps wavelengths and incidence angles to the measured reflectivity.

is_mirror

flag controlling whether this material reflects or transmits light

serial_number

A unique number associated with this material

shape

The array shape of this object.

substrate

A layer representing the substrate supporting the reflective surface.

transformation

the coordinate transformation between the global coordinate system and this object's local coordinate system

Methods

__init__(efficiency_measured[, substrate, ...])

attenuation(rays)

the attenuation coefficient of the given rays

efficiency(rays, normal)

The fraction of light that passes through the interface.

index_refraction(rays)

the index of refraction of this material for the given input rays

to_string([prefix])

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

Inheritance Diagram

Inheritance diagram of optika.materials.MeasuredMirror
Parameters:
attenuation(rays)#

the attenuation coefficient of the given rays

Parameters:

rays (RayVectorArray) – input rays to calculate the attenuation coefficient for

Return type:

int | float | complex | ndarray | Quantity | AbstractScalar

efficiency(rays, normal)[source]#

The fraction of light that passes through the interface.

Parameters:
Return type:

int | float | complex | ndarray | Quantity | AbstractScalar

index_refraction(rays)#

the index of refraction of this material for the given input rays

Parameters:

rays (RayVectorArray) – input rays used to evaluate the index of refraction

Return type:

int | float | complex | ndarray | Quantity | AbstractScalar

to_string(prefix=None)#

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

Parameters:

prefix (None | str) – an optional string, the length of which is used to calculate how much whitespace to add to the result.

Return type:

str

efficiency_measured: FunctionArray[SpectralDirectionalVectorArray, AbstractScalar] = <dataclasses._MISSING_TYPE object>#

A function array that maps wavelengths and incidence angles to the measured reflectivity.

property is_mirror: bool#

flag controlling whether this material reflects or transmits light

serial_number: None | str | AbstractArray = None#

A unique number associated with this material

property shape: dict[str, int]#

The array shape of this object.

substrate: None | Layer = None#

A layer representing the substrate supporting the reflective surface.

property transformation: None#

the coordinate transformation between the global coordinate system and this object’s local coordinate system