solprop.modes.base#

Derived quantities of any mode: beta, alpha, group delay, dispersion, ZDW.

Everything here is a function of a Mode, not a method on one, so a new mode family gets them for nothing: the propagation constant and power loss (beta(), alpha(), loss_length(), db_per_m(), transmission()), the dispersion orders (beta1(), beta2(), beta3()), the zero-dispersion wavelength (zdw(), a sampled search of beta_2’s sign) and the effective area (aeff()). The conversions are the package’s (docs/dev/conventions.md section 2): \(\beta = (\omega/c)\,\mathrm{Re}\,n_{\rm eff}\) and \(\alpha = (2\omega/c)\,\mathrm{Im}\,n_{\rm eff}\), so a positive imaginary index is loss and alpha is a power loss coefficient per metre.

beta1() is analytic, straight from the mode’s dneff_domega, because the co-moving frame rides on it (docs/dev/stepper.md section 5); beta2() and beta3() are Richardson differences of that analytic beta1, with steps BETA2_RELATIVE_STEP and BETA3_RELATIVE_STEP. Their accuracy is in docs/guide/waveguides/capillary-model.md, section “The frequency derivative”.

Module Attributes

BETA2_RELATIVE_STEP

Relative frequency step of the Richardson difference behind beta2().

BETA3_RELATIVE_STEP

Relative frequency step of the Richardson second difference behind beta3().

Functions

aeff(mode[, z])

Return the effective area of a mode.

alpha(mode, omega[, z])

Return the power loss coefficient of a mode.

beta(mode, omega[, z])

Return the propagation constant of a mode.

beta1(mode, omega[, z])

Return the group delay per unit length, analytically.

beta2(mode, omega[, z])

Return the group-velocity dispersion, by differencing the analytic beta1.

beta3(mode, omega[, z])

Return the third-order dispersion, by differencing the analytic beta1 twice.

db_per_m(mode, omega[, z])

Return the loss of a mode in decibels per metre.

loss_length(mode, omega[, z])

Return the 1/e power loss length of a mode.

transmission(mode, omega, length[, start])

Return the power transmission of a length of waveguide.

zdw(mode[, z, wavelength_limits, near])

Return the zero-dispersion wavelength of a mode.

solprop.modes.base.BETA2_RELATIVE_STEP: Final = 0.003#

Relative frequency step of the Richardson difference behind beta2().

Larger than a finite difference usually wants, and deliberately so. beta_1 is of order 1/c while its variation over the step is beta_2 h, which for a capillary is nine orders smaller, so the rounding error of the difference is eps beta_1 / h – it falls as the step grows. Truncation, (h^2/6) beta_4, rises. Measured against the closed-form second derivative of an evacuated capillary (tests/modes/test_base.py), the two cross near a relative step of 3e-3, where the result is good to 5e-9; at 1e-4 it is 1.6e-7 and at 1e-5 it is 2.3e-6.

That is three orders better than differencing beta itself, and it is enough: nothing in the solver consumes beta_2. The co-moving frame uses beta_1, which is analytic. Making this analytic too needs the second derivative of the gas susceptibility, which is not part of the material interface.

solprop.modes.base.BETA3_RELATIVE_STEP: Final = 0.004#

Relative frequency step of the Richardson second difference behind beta3().

A second difference divides the rounding of beta_1 by the step squared, while the truncation grows with the structure the fill puts into beta_1, and the two pull the step opposite ways. Against the closed form of an evacuated capillary (tests/modes/test_base.py), which has little structure, the error is 3.8e-6 at a relative step of 3e-3, 1.5e-6 at 4e-3 and 4.8e-7 at 8e-3. A helium-filled capillary (125 um, one bar, 400 nm to 2 um) has more: there, steps of 3e-3 and 5e-3 agree with 4e-3 to 1.5e-5 of the largest value, while a step of 2e-2 is off by 4e-4.

solprop.modes.base.aeff(mode, z=0.0)[source]#

Return the effective area of a mode.

A uniform accessor beside beta() and alpha(), so that code working over a mode set never has to mix method calls with function calls.

Parameters:
modeMode

The mode.

zfloat, optional

Position along the waveguide, m.

Returns:
float

A_eff in m^2.

Examples

>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import aeff
>>> f"{aeff(MarcatiliMode(75e-6, 'He', 1.0)):.6e}"
'8.421575e-09'
solprop.modes.base.alpha(mode, omega, z=0.0)[source]#

Return the power loss coefficient of a mode.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,).

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

alpha = 2 omega Im(n_eff) / c in 1/m, shape (n_omega,). Positive is loss, because Im n_eff > 0 is.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import alpha
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{alpha(mode, np.array([2.356e15]))[0]:.6f}"
'0.141459'
solprop.modes.base.beta(mode, omega, z=0.0)[source]#

Return the propagation constant of a mode.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,).

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

beta = omega Re(n_eff) / c in 1/m, shape (n_omega,).

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import beta
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{beta(mode, np.array([2.356e15]))[0]:.6f}"
'7858997.479689'
solprop.modes.base.beta1(mode, omega, z=0.0)[source]#

Return the group delay per unit length, analytically.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,).

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

beta_1 = d(beta)/d(omega) = (Re n_eff + omega d(Re n_eff)/d(omega)) / c in s/m, shape (n_omega,), from the mode’s analytic derivative.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import beta1
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{beta1(mode, np.array([2.356e15]))[0]:.10e}"
'3.3357582351e-09'
solprop.modes.base.beta2(mode, omega, z=0.0)[source]#

Return the group-velocity dispersion, by differencing the analytic beta1.

Departs from the analytic derivatives elsewhere in this module, and says so: the second derivative of a gas susceptibility is not part of the material interface, so this is a Richardson-extrapolated central difference of beta1() at a relative step of BETA2_RELATIVE_STEP, whose documentation gives the measured accuracy. Only the co-moving frame needs better – which uses beta1, not this.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,), > 0.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

beta_2 = d^2(beta)/d(omega)^2 in s^2/m, shape (n_omega,).

Raises:
ModeError

If any frequency is not finite or not positive, since the step is relative.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import beta2
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{beta2(mode, np.array([2.356e15]))[0]:.6e}"
'-7.491419e-30'
solprop.modes.base.beta3(mode, omega, z=0.0)[source]#

Return the third-order dispersion, by differencing the analytic beta1 twice.

A Richardson-extrapolated second central difference of beta1() at a relative step of BETA3_RELATIVE_STEP, for the reason beta2() gives: the material interface has no higher derivative of a gas susceptibility.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,), > 0.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

beta_3 = d^3(beta)/d(omega)^3 in s^3/m, shape (n_omega,).

Raises:
ModeError

If any frequency is not finite or not positive, since the step is relative.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import beta3
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{beta3(mode, np.array([2.356e15]))[0]:.3e}"
'1.124e-44'
solprop.modes.base.db_per_m(mode, omega, z=0.0)[source]#

Return the loss of a mode in decibels per metre.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,).

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

10 alpha / ln(10) in dB/m, shape (n_omega,).

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import db_per_m
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{db_per_m(mode, np.array([2.356e15]))[0]:.6f}"
'0.614348'
solprop.modes.base.loss_length(mode, omega, z=0.0)[source]#

Return the 1/e power loss length of a mode.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,).

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

1 / alpha in m, shape (n_omega,); infinite where the mode is lossless.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import loss_length
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{loss_length(mode, np.array([2.356e15]))[0]:.4f}"
'7.0692'
solprop.modes.base.transmission(mode, omega, length, start=0.0)[source]#

Return the power transmission of a length of waveguide.

Parameters:
modeMode

The mode.

omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,).

lengthfloat

Length propagated in m, >= 0.

startfloat, optional

Position the length starts at, m.

Returns:
numpy.ndarray

exp(-int alpha dz) over [start, start + length], shape (n_omega,). The integral is taken numerically because a taper or a gradient makes alpha a function of position; for a uniform waveguide it is exactly exp(-alpha L).

Raises:
ModeError

If length is negative.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import transmission
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{transmission(mode, np.array([2.356e15]), 1.0)[0]:.6f}"
'0.868091'
solprop.modes.base.zdw(mode, z=0.0, *, wavelength_limits=(1.5e-07, 3e-06), near=None)[source]#

Return the zero-dispersion wavelength of a mode.

A sampled search (docs/guide/waveguides/mode-sets.md): beta_2 is read at 512 frequencies evenly spaced across the window and each sign change is refined. A change is a zero when the analytic group delay beta_1 has an extremum there that the difference behind beta_2 resolves (its rise grows quadratically across the difference’s stencil, BETA2_RELATIVE_STEP either side) and when beta_1 is monotone from it for 1.5 % in frequency on either side, so that beta_2 keeps each sign that far. A change that is not a zero is a line when beta_1 is not finite or not continuous across it – it diverges, or drops to the evanescent floor, by more than a tenth across the stencil – as at a gas resonance. Every other change is passed over, neither zero nor line: a change the stencil does not resolve, or one of the clustered zeros of a narrow feature that leaves beta_1 finite and continuous, such as fused silica’s OH absorption bands near 1.38 and 2.7 um or the inside of an antiresonant wall’s resonance. So the search resolves dispersion regimes 1.5 % wide and more, and its answer does not depend on the window, as long as the window holds the zero. Two limits remain: two genuine zeros closer than 1.5 % (or a zero within 1.5 % of another sign change) are passed over, and a zero and another sign change inside one sample interval restore the sign and are both missed.

Parameters:
modeMode

The mode.

zfloat, optional

Position along the waveguide, m.

wavelength_limitstuple of float, optional

Shortest and longest wavelength in m to search. Defaults to 150 nm to 3 um: above the vacuum-ultraviolet lines of the noble gases (the longest, xenon’s, at 147 nm) and the absorption edge of fused silica, where a lossless solve takes silica as transparent and finds zeros with no meaning. The window is probed silently; the zero found is evaluated again, so one that lies outside the validity range of a material model behind the mode warns.

nearfloat, optional

Reference wavelength in m, > 0, typically the pump’s. The zero nearest it in frequency is returned, among those no line separates from it: light at the reference cannot cross a line to reach a zero beyond. None (the default) takes every zero in the window, and refuses several.

Returns:
float

The wavelength in m where beta_2 vanishes.

Raises:
ModeError

If the range is not ordered and positive, if near is not a positive finite wavelength, or if the window holds several zeros and near is None: the message lists them.

NoZeroDispersionError

If the search finds no zero in the window (on the side of the lines that holds near, when it is given): a mode with no zero-dispersion point there is a fact the caller has to see, not a missing value to propagate.

Examples

>>> from solprop.modes import MarcatiliMode
>>> from solprop.modes.base import zdw
>>> mode = MarcatiliMode(125e-6, "He", 0.4, model="reduced", cladding=1.45)
>>> f"{zdw(mode, wavelength_limits=(150e-9, 900e-9)) * 1e9:.1f}"
'376.7'