Distributed Bragg reflectors / transfer-matrix method¶
Characteristic-matrix (Macleod) stacks, absorbing and oblique variants. Docstrings are the source of truth, rendered with mkdocstrings (numpydoc style).
photonics_helper.dbr ¶
Distributed Bragg Reflector (DBR) design and transfer-matrix simulation.
Material ¶
Block ¶
Pattern ¶
A repeating DBR layer pattern.
Attributes:
| Name | Type | Description |
|---|---|---|
style |
layer sequence string, e.g. "ABAB" or "ABCABC".
|
|
mapping |
dict mapping style characters to Block instances.
|
|
central_wavelength |
design central wavelength.
|
|
length |
total physical length of the pattern.
|
|
out |
ordered list of Blocks composing the pattern.
|
|
TMM ¶
Transfer-matrix method for a DBR stack.
Computes reflection, transmission, and field profiles using the 2×2 transfer-matrix formalism for stratified media.
Attributes:
| Name | Type | Description |
|---|---|---|
pattern |
Pattern — the layer stack.
|
|
angle_of_incidence |
angle of incidence in radians.
|
|
polarisation |
"TE" or "TM".
|
|
n_incident |
complex — refractive index of the semi-infinite incident
|
medium (default air, |
n_substrate |
complex — refractive index of the semi-infinite exit
|
(substrate) medium (default air, |
transfer_matrix ¶
transfer_matrix(wavelength: Wavelength) -> NDArray
Compute the full 2×2 characteristic matrix for the stack.
Uses the optical admittance formalism so that absorbing layers (complex n) are handled correctly. The returned matrix M relates the tangential E and H fields at the back and front of the stack::
[E_front] [M11 M12] [E_back]
[H_front] = [M21 M22] [H_back]
Each layer's characteristic matrix maps the fields at its back
interface to its front interface, so the stack matrix is the
ordered product M_1 @ M_2 @ ... @ M_n with layer 1 at the
incident side (Macleod, Thin-Film Optical Filters, Eq. 2.55).
spectrum ¶
spectrum(wavelengths: WavelengthArray) -> tuple[NDArray, NDArray]
Compute reflection R(λ) and transmission T(λ) across a wavelength range.
field_profile ¶
field_profile(wavelength: Wavelength, return_positions: bool = False) -> NDArray | tuple[list[Length], NDArray]
Compute |E(z)| inside the stack at a single wavelength.
Returns one value per layer: the magnitude of the total electric field at the front of each layer (just after the interface).
Because the characteristic matrix maps fields at the back of a layer
to its front, forward propagation through a layer uses the inverse
relation solve(M_layer, [E, H]) — multiplying by M_layer would
propagate the wrong way.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength
|
Wavelength
|
Vacuum wavelength (m). |
required |
return_positions
|
bool
|
When True, also return the front-interface positions in metres. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
|E| : NDArray
|
Field magnitude at the front of each layer. |
|
positions |
(list[Length], optional)
|
Interface positions, only when |
field_profile_z ¶
field_profile_z(wavelength: Wavelength, n_points_per_layer: int = 20) -> tuple[NDArray, NDArray]
Continuous |E(z)| profile sampled across the whole stack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelength
|
Wavelength
|
Vacuum wavelength (m). |
required |
n_points_per_layer
|
int
|
Number of samples per layer (including both interfaces). Must be at least 2. Default 20. |
20
|
Returns:
| Name | Type | Description |
|---|---|---|
z |
NDArray
|
Positions in metres, strictly increasing from |
E |
NDArray
|
|
Notes
Within layer i the fields are obtained from the back interface via
the characteristic matrix of the remaining thickness: at depth x,
[E, H] = M(d_i − x) · [E_back, H_back]. At x = 0 this
reproduces the front field, so the sampled interface values match
:meth:field_profile. The same characteristic-matrix/admittance
formalism is used throughout (Macleod, Thin-Film Optical Filters,
§2.4).
plot_spectrum ¶
plot_spectrum(wavelengths: WavelengthArray, ax=None)
Plot reflectance R(λ), transmittance T(λ) and absorption A(λ).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavelengths
|
WavelengthArray — wavelength grid.
|
|
required |
ax
|
matplotlib Axes, optional — axis to draw on.
|
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
matplotlib Figure
|
|
plot_index ¶
plot_index(pattren: Pattern, wl: Wavelength) -> None
Plot refractive index n across the DBR pattern at wavelength wl.
plot_2d ¶
plot_2d(pattren: Pattern, height=1e-07, overlay_index: bool = False) -> None
Plot a 2-D bar chart of the DBR pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattren
|
Pattern — the DBR pattern.
|
|
required |
height
|
bar height in metres (default 100 nm).
|
|
1e-07
|
overlay_index
|
if True, overlay refractive index on the bar chart.
|
|
False
|