colour.phenomena.matrix_transfer_tmm#
- colour.phenomena.matrix_transfer_tmm(n: ArrayLike, t: ArrayLike, theta: ArrayLike, wavelength: ArrayLike) TransferMatrixResult[source]#
Calculate transfer matrices for multilayer thin film structures using the Transfer Matrix Method.
This function constructs the transfer matrices for s-polarised and p-polarised light propagating through a multilayer structure. The transfer matrices encode the optical properties of the structure and are used to calculate reflectance and transmittance.
- Parameters:
n (ArrayLike) – Complete refractive index stack \(n_j\) including incident medium, layers, and substrate. Shape: (media_count,) or (media_count, wavelengths_count). Can be complex for absorbing materials. The array should contain [n_incident, n_layer_1, …, n_layer_n, n_substrate].
t (ArrayLike) –
Thicknesses of each layer \(t_j\) in nanometers (excluding incident and substrate). Shape: (layers_count,) or (thickness_count, layers_count).
1D array
[t1, t2, ...]: One thickness per layer for a single multilayer configuration. Shape:(layers_count,)2D array
[[t1, t2, ...], [t1', t2', ...]]: Multiple thickness configurations for outer product broadcasting. Shape:(thickness_count, layers_count)
Most users should use
thin_film_tmm()ormultilayer_tmm()instead, which provide simpler interfaces.theta (ArrayLike) – Incident angle \(\theta\) in degrees. Scalar or array of shape (angles_count,) for angle broadcasting.
wavelength (ArrayLike) – Vacuum wavelength values \(\lambda\) in nanometers.
- Returns:
Transfer matrix calculation results containing M_s, M_p, theta, and n arrays.
- Return type:
colour.TransferMatrixResult
Examples
Single layer at one wavelength:
>>> result = matrix_transfer_tmm( ... n=[1.0, 1.5, 1.0], ... t=[250], ... theta=0, ... wavelength=550, ... ) >>> result.M_s.shape (1, 1, 1, 2, 2) >>> result.theta.shape (1, 3)
Multiple wavelengths:
>>> result = matrix_transfer_tmm( ... n=[1.0, 1.5, 1.0], ... t=[250], ... theta=0, ... wavelength=[400, 500, 600], ... ) >>> result.M_s.shape (3, 1, 1, 2, 2)
Multiple angles (angle broadcasting):
>>> result = matrix_transfer_tmm( ... n=[1.0, 1.5, 1.0], ... t=[250], ... theta=[0, 30, 45, 60], ... wavelength=[400, 500, 600], ... ) >>> result.M_s.shape (3, 4, 1, 2, 2) >>> result.theta.shape (4, 3)
Notes
The Transfer Matrix Method relates the field amplitudes across the entire multilayer structure (Equations 10-15 from [Byr16]):
\[\begin{split}\begin{pmatrix} v_n \\ w_n \end{pmatrix} = M_n \begin{pmatrix} v_{n+1} \\ w_{n+1} \end{pmatrix}\end{split}\]Where \(M_n\) combines the layer propagation and interface matrices:
\[\begin{split}M_n = L_n \cdot I_{n,n+1} = \begin{pmatrix} e^{-i\delta_n} & 0 \\ 0 & e^{i\delta_n} \end{pmatrix} \frac{1}{t_{n,n+1}} \begin{pmatrix} 1 & r_{n,n+1} \\ r_{n,n+1} & 1 \end{pmatrix}\end{split}\]The overall transfer matrix \(\tilde{M}\) for the complete structure is:
\[\begin{split}\tilde{M} = \frac{1}{t_{0,1}} \begin{pmatrix} 1 & r_{0,1} \\ r_{0,1} & 1 \end{pmatrix} M_1 M_2 \cdots M_{N-2}\end{split}\]From which the overall reflection and transmission coefficients are extracted:
\[\begin{split}\begin{pmatrix} 1 \\ r \end{pmatrix} = \tilde{M} \begin{pmatrix} t \\ 0 \end{pmatrix}\end{split}\]\[t = \frac{1}{\tilde{M}_{00}}, \quad r = \frac{\tilde{M}_{10}}{\tilde{M}_{00}}\]Where:
\(v_n, w_n\): Forward and backward field amplitudes in layer \(n\)
\(M_n\): Transfer matrix for layer \(n\)
\(L_n\): Layer propagation matrix
\(I_{n,n+1}\): Interface matrix between layers \(n\) and \(n+1\)
\(\tilde{M}\): Overall transfer matrix
\(r, t\): Overall reflection and transmission amplitude coefficients
Supports complex refractive indices for absorbing materials.
Angle broadcasting: All computations are vectorized across angles. The output always includes the angle dimension.
The transfer matrices always have shape (angles_count, wavelengths_count, 2, 2), even for scalar theta (angles_count=1).
References
[Byr16]