Skip to content

anafibre.dispersion

Contains the dispersion relation solver and associated utility functions for step-index fibers. Implements normalised propagation constant (\(b\)), effective index (\(n_\mathrm{e}\)), and propagation constant (\(k_z\)).

Phi_alpha

Evaluate analytical function \(\Phi_\ell^\alpha(b,V)\).

Parameters:

Name Type Description Default
ell int

Azimuthal mode index.

required
b float | complex | array - like

Normalised propagation constant candidate(s).

required
V float | array - like

Normalised frequency.

required
alpha sequence

Length-2 sequence [alpha1, alpha2] defining core/cladding values. Each entry may be a scalar, array broadcastable with b/V, or a callable f(V).

None

Returns:

Type Description
ndarray | float | complex

Value(s) of \(\Phi_\ell^\alpha(b,V)\) with broadcasted input shape.

Notes

The implementation of the material-weighted logarithmic Bessel derivative follows the formulation:

\(\Phi_\ell^\alpha(b,V)=\left(\dfrac{uw}{V}\right)^2\left[\dfrac{\alpha_1}{u}\dfrac{\mathrm{J}_\ell'(u)}{\mathrm{J}_\ell(u)}+\dfrac{\alpha_2}{w}\dfrac{\mathrm{K}_\ell'(w)}{\mathrm{K}_\ell(w)}\right]\)

where \(u=V\sqrt{1-b}\) and \(w=V\sqrt{b}\).

F_dispersion

Evaluate analytical function \(F_\ell(b,V)\).

Parameters:

Name Type Description Default
fibre StepIndexFibre

Fibre model (material and geometry).

required
ell int

Azimuthal mode index.

required
b float | complex | array - like

Normalised propagation constant candidate(s).

required
V float | array - like

Normalised frequency. Provide either V or wl.

None
wl float | array - like

Wavelength in meters. Used when V is not provided.

None
mode_type (TE, TM, None)

For ell == 0, selects TE/TM branch. Ignored for ell != 0.

"TE"

Returns:

Type Description
ndarray | float | complex

Dispersion residual with the same broadcasted shape as the inputs.

Raises:

Type Description
ValueError

If neither V nor wl is provided, or mode_type is invalid for ell == 0.

Notes

The implementation follows the reduced dispersion formulation from the paper:

\(F_\ell(b,V)=\left[\Phi_\ell^\varepsilon\,\Phi_\ell^\mu-(\ell n_\mathrm{e})^2\right]\mathrm{J}_\ell^2(u)\)

where \(n_\mathrm{e}=\sqrt{b\,n_1^2+(1-b)\,n_2^2}\), \(u=V\sqrt{1-b}\), and \(w=V\sqrt{b}\).

For \(\ell=0\), TE/TM branches (\(\Phi_0^\mu=0\)/\(\Phi_0^\varepsilon=0\)) are selected by mode_type; for \(\ell\neq 0\) the hybrid-mode scalar dispersion residual is used.

find_b_of_V

Solve for the guided root b of a specific mode branch.

Parameters:

Name Type Description Default
fibre StepIndexFibre

Fibre model.

required
ell int

Azimuthal mode index.

required
m int

Radial mode index (1-based root ordering by descending real b).

required
V float | array - like

normalised frequency values. Provide either V or wl.

None
wl float | array - like

Wavelength values in meters.

None
mode_type (TE, TM, None)

TE/TM selection for ell == 0.

"TE"
N_b int

Number of samples used for bracketing/seeding roots on the real axis.

2000
tol float

Scalar root tolerance used by Brent's method.

np.nextafter(0, 1)
complex_tol float

Residual tolerance for complex root acceptance.

1e-8
maxiter int

Maximum function evaluations for complex solver iterations.

200
return_complex bool

If True, keeps complex-valued roots. If False, returns real values when roots are effectively real.

False

Returns:

Type Description
float | complex | ndarray

Mode root b for each input sample. Missing roots are returned as nan (or nan+0j when complex output is requested).

Raises:

Type Description
ValueError

If neither V nor wl is provided.

Notes

Root selection follows the reduced dispersion residual F_dispersion at each input sample. When the sampled residual on the real axis is effectively real, sign changes are bracketed and solved with Brent's method; otherwise complex roots are refined from minima of \(|F|\) using a 2D nonlinear solve.

Accepted roots are deduplicated, sorted by descending real part of \(b\), and the returned mode is the \(m\)-th entry in that ordering (high to low \(n_\mathrm{e}\) at fixed \(\ell\) and \(V\)). If fewer than \(m\) roots are found, the function returns nan (or nan+0j when complex output is requested).

b_to_neff

Convert normalised propagation constant b to effective index.

Parameters:

Name Type Description Default
fibre StepIndexFibre

Fibre model.

required
b float | array - like

normalised propagation constant.

required
wl float | array - like

Wavelength in meters.

required

Returns:

Type Description
float | ndarray

Effective refractive index n_eff.

Notes

Uses:

\(n_\mathrm{e}=\sqrt{b\,n_1^2+(1-b)\,n_2^2}\).

b_to_kz

Convert normalised propagation constant b to longitudinal wavevector.

Parameters:

Name Type Description Default
fibre StepIndexFibre

Fibre model.

required
b float | array - like

normalised propagation constant.

required
wl float | array - like

Wavelength in meters.

required

Returns:

Type Description
float | ndarray

Longitudinal propagation constant k_z in rad/m.

Notes

Uses:

\(k_z=\sqrt{b\,k_1^2+(1-b)\,k_2^2}\).