solprop.modes.capillary#

Marcatili modes of a gas-filled hollow capillary, with analytic derivatives.

MarcatiliMode is Marcatili and Schmeltzer’s asymptotic mode of a hollow dielectric tube much wider than the wavelength (Bell Syst. Tech. J. 43, 1783-1809, 1964), in the "full" and "reduced" models (MarcatiliModel) and the HE, TE and TM families (ModeKind). It forms n_eff - 1 directly rather than through unity, and differentiates both models in closed form in frequency and along z. Position reaches the index only through the core radius a(z) and the number density rho(z), so everything frequency-dependent is a MarcatiliTerms, sampled once (sampled_terms) and evaluated per position (neff_from_terms); shared_sampling() lets a translation reading the same modes at many z share that sampling. bessel_zero(), cladding_term_and_derivative() and core_susceptibility_at() are the model’s ingredients.

A positive imaginary part of n_eff is loss (docs/dev/conventions.md section 5), so the reduced model’s loss term enters with a plus sign; one arithmetic kernel serves every path. The model, the rationalised refractivity, the derivatives and the factorisation are in docs/guide/waveguides/capillary-model.md; the coherent wall operator that couples these modes is solprop.modes.wall.

Module Attributes

ModeKind

Which family a capillary mode belongs to: hybrid, transverse electric or magnetic.

MarcatiliModel

Whether to use the square-root expression or its leading-order expansion.

Functions

bessel_zero(order, index)

Return the index-th positive zero of the Bessel function of the first kind.

cladding_term_and_derivative(permittivity, ...)

Return the Marcatili cladding term and its frequency derivative.

core_susceptibility_at(terms, density)

Return the core susceptibility of a fill at one position.

shared_sampling()

Sample each mode's frequency-only terms once per frequency vector in a scope.

Classes

MarcatiliMode(radius[, gas, pressure, kind, ...])

A Marcatili mode of a gas-filled hollow capillary.

MarcatiliTerms(omega, u_nm, ...)

Everything in a Marcatili effective index that depends only on frequency.

class solprop.modes.capillary.MarcatiliMode(radius, gas=None, pressure=None, *, kind='HE', n=1, m=1, phi=0.0, model='full', alpha=None, loss_scale=1.0, cladding=None, temperature=None, susceptibility=None, mixture=None)[source]#

Bases: GasFillMixin

A Marcatili mode of a gas-filled hollow capillary.

Like every Mode, it takes strictly positive frequencies: a hollow capillary has no mode at zero frequency – the waveguide term (u c / (omega a))^2 diverges – so a zero raises. The linear operator evaluates modes on the active band, which excludes the DC bin.

Both radius and pressure accept a number or a ZProfile, which is what makes a taper and a pressure gradient ordinary cases rather than special ones.

Attributes:
radiusfloat or ZProfile

Core radius in m, > 0. A number becomes a Constant.

gasGas or str or None

The fill species, or None for an evacuated capillary.

pressurefloat or ZProfile

Absolute pressure in bar, >= 0 (docs/dev/conventions.md section 1). Required beside gas: a gas without it is refused. Without a gas it is omitted, and holds 0 once the mode is built.

kindstr

"HE" (hybrid), "TE" or "TM". The transverse families require n == 0; hybrids require n != 0.

nint

Azimuthal index. May be negative for a hybrid mode.

mint

Radial index, >= 1: which zero of the Bessel function.

phifloat

Rotation of the mode about the axis in rad, positive from x towards y. It turns the whole transverse pattern: the Cartesian components of a hybrid mode are (cos((n - 1) theta - n phi), -sin((n - 1) theta - n phi)) times J_{n-1}(u r / a). For HE_1m the pattern is uniform, so phi is the polarisation angle measured from the x axis: phi = 0 is x-polarised and phi = pi / 2 is y-polarised. For n >= 2 an oblique phi is a rotated pattern and not a polarisation angle – the field points in different directions at different theta – and the degenerate partner of phi = 0 is the quarter turn phi = pi / (2 n), which orthogonal_polarisation returns.

modelstr

"full" for the square root, "reduced" for its leading-order expansion.

alphafloat or callable or None

An absolute power attenuation coefficient in 1/m that replaces the model’s loss: a finite non-negative number, or a callable alpha(omega) taking and returning arrays of shape (n_omega,) – measured fibre loss, say. Only Im n_eff = c alpha / (2 omega) is replaced; the real part, and with it beta and beta_1, stays the model’s. A callable that carries a derivative attribute gets an analytic d(Im n_eff)/d(omega); otherwise that one term is differenced, and the constructor says so. alpha is the caller’s and is not clamped. None (the default) keeps the model’s loss.

loss_scalefloat

Multiplies the model’s own loss: 1.0 (the default) is the model, 0.0 lossless, anything else a fitting knob on the model. Finite and non-negative; refused beside an alpha, which replaces the loss it would scale. The model’s own loss is never negative: where the square root lands on the branch that reads as gain – a cladding index below unity, outside Marcatili’s regime – it is clamped at zero and the mode logs the fact once.

claddingGlassIndex or complex or None

The cladding index. None uses fused_silica(); a plain complex number is a constant index, which is what a comparison against a published or symbolic result needs.

temperaturefloat, ZProfile or None

Temperature of the fill in K, > 0, or a path of it along z in m, which the density follows (DensityPath); a constant path is stored as its number. None (the default) is 293.15 K for a gas and the mixture’s own beside mixture, which carries its temperature: a different one given beside it is refused by name. Resolved at construction, so the field is never None afterwards.

susceptibilityGasSusceptibility or None

The gas susceptibility per unit number density. None takes the built-in gas’s, optmat’s, which is what a run normally wants. Passing one is the gas-side counterpart of a constant or tabulated cladding: it replaces the refractive data while leaving the equation of state alone, so gas is still what sets the density along z. A comparison against a published result or another code whose gas model differs can give the mode the other model’s susceptibility and isolate what it is actually comparing.

mixtureMixture or None

Labelled populations with their own density paths. Supplies temperature and optical data; do not also pass gas, pressure or susceptibility.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0, model="reduced")
>>> omega = np.array([2.356e15])
>>> f"{complex(mode.neff(omega)[0]):.9f}"
'1.000028936+0.000000009j'
>>> f"{float(mode.aeff()):.4e}"
'2.3393e-08'
aeff(z=0.0)[source]#

Return the effective area of the mode.

Parameters:
zfloat, optional

Position along the waveguide, m.

Returns:
float

A_eff = (int |e|^2 dA)^2 / int |e|^4 dA in m^2, in closed form: the transverse profile is a Bessel function of r / a, so the whole radius dependence is the prefactor a^2.

Examples

>>> from solprop.modes import MarcatiliMode
>>> f"{MarcatiliMode(75e-6, 'He', 1.0).aeff():.6e}"
'8.421575e-09'
alpha: float | Callable[[Float[ndarray, 'n_omega']], Float[ndarray, 'n_omega']] | None = None#
at_parameters(values)[source]#

Return the same mode with the named paths frozen at the given values.

The effective index reaches z only through the two paths, so replacing the two paths by constants gives a mode that is exactly this one at every position where the paths take those values. That is what lets solprop.linear.dispersion_operator() be evaluated at parameter values, and so what lets the cumulative operator be expanded in the parameters rather than tabulated along z (docs/guide/numerics/linear-operator.md).

The copy shares the parent’s derived frequency-only quantities – the Bessel zero, the cladding index, the effective-area factor – so freezing costs nothing per evaluation. Its radius field follows core_radius; its pressure field still records the parent’s declaration, because the density is given directly here and the equation of state is not inverted. Nothing reads pressure after construction; density is the path that is evaluated.

Parameters:
valuescollections.abc.Mapping

Any subset of {"core_radius": a in m, "density": rho in m^-3}. A name left out keeps its path.

Returns:
MarcatiliMode

A copy reporting z_constant.

Raises:
ModeError

If a name is not a declared path, the core radius is not positive, or the density is negative.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.profiles import PressureGradient
>>> fill = PressureGradient.two_point(1.0, 5.0, 1.0)
>>> mode = MarcatiliMode(125e-6, "He", fill)
>>> frozen = mode.at_parameters(
...     {
...         name: float(path(np.array([0.3]))[0])
...         for name, path in mode.parameter_paths.items()
...     }
... )
>>> frozen.z_constant
True
>>> omega = np.array([2.356e15])
>>> bool(np.array_equal(frozen.neff(omega), mode.neff(omega, 0.3)))
True
property azimuthal_order: int[source]#

Highest azimuthal harmonic in the Cartesian field components.

|n - 1| for a hybrid mode and 1 for a transverse one. The signed n - 1 would be negative for HE_{-1,m} and would then understate the theta rule a cubic product needs.

property channel_label: ChannelLabel[source]#

Family, the two indices and which polarisation partner this is.

parity is None for a transverse family, which has no degenerate polarisation partner. For a hybrid mode it follows the one definition in ChannelLabel: the even member is the cos((n - 1) theta) pattern about the x axis, which here is the unrotated mode phi = 0 – at that angle the transverse components are (cos((n - 1) theta), -sin((n - 1) theta)), the same pattern the exact step-index even member carries, and for HE_1m it is the x-polarised state. The quarter turn phi = pi / (2 n) is therefore the odd member, y-polarised for HE_1m. Any other rotation is a gauge rather than a parity: its parity is None and its display label carries the angle, so that two rotated copies of one mode are still told apart.

A negative azimuthal index is the EH family, and the label says so: the label’s own azimuthal_order is the non-negative total azimuthal order |n| and the family is "EH", which is how an exact StepIndexMode of the same physical channel labels itself, so an EH capillary mode can be put in a ModeCollection.

Examples

>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> mode.channel_label.display_label, mode.principal_component()
('HE1,1:even', 'x')
>>> partner = mode.orthogonal_polarisation
>>> partner.channel_label.display_label, partner.principal_component()
('HE1,1:odd', 'y')
>>> MarcatiliMode(125e-6, "He", 1.0, n=-1).channel_label.display_label
'EH1,1:even'
cladding: GlassIndex | complex | None = None#
cladding_index: GlassIndex | complex#
core_index_minus_one(omega, z=0.0)[source]#

Return the filled core’s n_core - 1 formed without cancellation.

n_core = sqrt(1 + chi) with chi the fill’s susceptibility at the position’s density, and n_core - 1 is formed as chi / (sqrt(1 + chi) + 1), whose denominator is near two, so it carries the relative rounding of chi itself rather than the absolute rounding of unity. Its difference with neff_minus_one() is n_core - n_eff to the rounding of two numbers of order chi, where forming k - beta from the two wavenumbers would carry the rounding of k.

Parameters:
omeganumpy.ndarray

Angular frequencies, rad/s, shape (n_omega,), strictly positive.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

n_core - 1, complex, shape (n_omega,); zero for an evacuated core.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> omega = np.array([2.356e15])
>>> core = mode.core_index_minus_one(omega)
>>> bool(core.real[0] > mode.neff_minus_one(omega).real[0] > 0.0)
True
core_radius: ZProfile#
density: ZProfile#
dimlimits(z=0.0)[source]#

Return the cross-section parametrisation and the integration limits.

Parameters:
zfloat, optional

Position along the waveguide, m.

Returns:
tuple

("polar", (0, 0), (a(z), 2 pi)) in m and rad.

Examples

>>> from solprop.modes import MarcatiliMode
>>> MarcatiliMode(125e-6, 'He', 1.0).dimlimits()[0]
'polar'
dneff_domega(omega, z=0.0)[source]#

Return the analytic frequency derivative of the effective index.

Both models are differentiated in closed form, chaining through the analytic derivative of the gas susceptibility and of the cladding index (ADR-006). The only term that may be differenced is the imaginary part when the loss is given as a callable without its own derivative.

Parameters:
omeganumpy.ndarray

Angular frequencies, rad/s, shape (n_omega,), strictly positive.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

dn_eff/domega in s/rad, complex, shape (n_omega,).

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{mode.dneff_domega(np.array([2.356e15]))[0].real:.4e}"
'2.6423e-21'
dneff_domega_from_terms(terms, radius, density)[source]#

Return the analytic dn_eff/domega from pre-sampled terms.

Parameters:
termsMarcatiliTerms

The sampled frequency-dependent quantities.

radiusfloat

Core radius in m, > 0.

densityfloat

Number density of the fill in m^-3, >= 0.

Returns:
numpy.ndarray

dn_eff/domega in s/rad, complex.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0, model="reduced")
>>> terms = mode.sampled_terms(np.array([2.356e15]))
>>> f"{mode.dneff_domega_from_terms(terms, 125e-6, 2.46e25).real[0]:.4e}"
'2.6420e-21'
dneff_dz(omega, z=0.0)[source]#

Return the analytic derivative of the effective index along the capillary.

z reaches the index through exactly two scalars, the core radius and the fill’s number density, so dn/dz = (dn/da) a' + sum_s (dn/drho_s) rho_s' with the declared profiles’ own analytic slopes. For the full model n^2 = 1 + chi - W with chi = sum_s gamma_s rho_s and W = (u s)^2 (1 - i v s)^2, s = c/(omega a), so that dW/da = -(2 u^2 s^2/a)(1 - i v s)(1 - 2 i v s) and dn/dz = (sum_s gamma_s rho_s' - (dW/da) a')/(2 n); the reduced model differentiates its own polynomial. The loss declaration acts on the imaginary part exactly as it does on the index: loss_scale scales it (0 drops it), and an alpha replaces it and, having no z, contributes nothing; where the no-gain clamp binds the imaginary part’s slope is zero, and where the evanescent floor binds the whole slope is zero, as dneff_domega()’s is. What the coherent wall route reads is the real part, the slope of the power weight w = Re n_eff.

Parameters:
omeganumpy.ndarray

Angular frequencies, rad/s, shape (n_omega,), strictly positive.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

dn_eff/dz in 1/m, complex, shape (n_omega,).

Raises:
ModeError

If the mode is a subclass that computes its index another way – a structured cladding or a tabulated index, whose z derivative is not this one – or a declared profile reports no analytic derivative.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> from solprop.profiles import Linear
>>> mode = MarcatiliMode(Linear(50e-6, 40e-6, 1e-3), "He", 1.0)
>>> bool(mode.dneff_dz(np.array([2.356e15]), 5e-4)[0].real < 0.0)
True
field(points, z=0.0)[source]#

Return the transverse field components at points of the cross-section.

Parameters:
pointsnumpy.ndarray

Shape (n_points, 2): (r, theta) in m and rad.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

(E_x, E_y) of the unnormalised profile, shape (n_points, 2), real. A hybrid mode has magnitude J_{n-1}(u r/a) independent of theta and azimuthal order |n - 1| in its Cartesian components; at phi = 0 those components are (cos((n-1) theta), -sin((n-1) theta)), the even pattern of every family, so HE_{11} is uniformly polarised along x there.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, 'He', 1.0)
>>> mode.field(np.array([[0.0, 0.0]])).round(6)
array([[1., 0.]])
gas: Gas | str | None = None#
kind: Literal['HE', 'TE', 'TM'] = 'HE'#
loss_scale: float = 1.0#
m: int = 1#
mixture: Mixture | None = None#
model: Literal['full', 'reduced'] = 'full'#
n: int = 1#
neff(omega, z=0.0)[source]#

Return the complex effective index.

Parameters:
omeganumpy.ndarray

Angular frequencies, rad/s, shape (n_omega,), strictly positive.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

n_eff(omega, z), complex, shape (n_omega,); Im n_eff > 0 is loss.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> bool(mode.neff(np.array([2.356e15]))[0].imag > 0.0)
True
neff_from_terms(terms, radius, density)[source]#

Return the effective index from pre-sampled terms and two scalars.

Parameters:
termsMarcatiliTerms

The sampled frequency-dependent quantities, from sampled_terms().

radiusfloat

Core radius in m at the position of interest, > 0.

densityfloat

Number density of the fill in m^-3, >= 0.

Returns:
numpy.ndarray

n_eff, complex, shape (n_omega,); Im n_eff > 0 is loss.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> terms = mode.sampled_terms(np.array([2.356e15]))
>>> value = mode.neff_from_terms(terms, 125e-6, 2.46e25)
>>> bool(value.imag[0] > 0.0)
True
neff_minus_one(omega, z=0.0)[source]#

Return n_eff - 1 formed without cancellation.

Parameters:
omeganumpy.ndarray

Angular frequencies, rad/s, shape (n_omega,), strictly positive.

zfloat, optional

Position along the waveguide, m.

Returns:
numpy.ndarray

n_eff - 1, complex, exact to rounding for a gas-filled capillary.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> f"{mode.neff_minus_one(np.array([2.356e15]))[0].real:.4e}"
'2.8935e-05'
normalisation(z=0.0)[source]#

Return the power carried by the unnormalised transverse profile.

Parameters:
zfloat, optional

Position along the waveguide, m.

Returns:
float

N = (1/2) sqrt(eps_0/mu_0) int |e|^2 dA in W, in closed form (pi/2) a^2 J_{n'}(u)^2 sqrt(eps_0/mu_0) with n' = n for a hybrid mode and 2 for a transverse one. The vacuum-normalised basis gives monochromatic power Re(n_eff) * abs(a)**2 for internal amplitude a (docs/dev/conventions.md section 4).

Examples

>>> from solprop.modes import MarcatiliMode
>>> f"{MarcatiliMode(125e-6, 'He', 1.0).normalisation():.6e}"
'1.755864e-11'
property orthogonal_polarisation: MarcatiliMode | None[source]#

Degenerate partner of a hybrid mode, or None.

The same mode turned by pi / (2 n), which turns the pattern a further quarter turn from x towards y and so exchanges the two Cartesian components: for HE_11 that is the y-polarised partner of the x-polarised default, and so the odd member of the pair (channel_label). None for a transverse family, whose members are not degenerate in polarisation – TE_0m and TM_0m are different modes, not two states of one.

Examples

>>> from solprop.modes import MarcatiliMode
>>> partner = MarcatiliMode(125e-6, "He", 1.0).orthogonal_polarisation
>>> f"{partner.phi:.6f}"
'1.570796'
>>> MarcatiliMode(125e-6, kind="TE", n=0).orthogonal_polarisation is None
True
property parameter_paths: Mapping[str, ZProfile][source]#

Scalar paths that carry the whole z dependence.

Radius and the material paths, including constant ones. One component retains density; a shared fill uses total pressure in bar; independent populations use density:<label> in m^-3. See solprop.modes.protocol.ParameterisedMode.

Examples

>>> from solprop.modes import MarcatiliMode
>>> sorted(MarcatiliMode(125e-6, "He", 1.0).parameter_paths)
['core_radius', 'density']
phi: float = 0.0#
pressure: float | ZProfile | None = None#
principal_component(z=0.0)[source]#

Return the sole nonzero Cartesian component, or None for a vector profile.

Parameters:
zfloat, optional

Position along the waveguide, m; the polarisation is independent of it.

Returns:
{‘x’, ‘y’} or None

An axis-aligned HE_1m component, or None when both components are nonzero. phi = 0 is x (ADR-031) and the quarter turn is y. Angles are classified exactly modulo pi, without a tolerance that would erase a small physical component.

radius: float | ZProfile#
property radius_is_constant: bool[source]#

Whether the transverse profile is the same at every z.

True when the core radius does not vary, so the synthesis and projection matrices of the multimode transform may be built once. A pressure gradient changes the effective index but not the field profile.

refractivity_from_terms(terms, radius, density)[source]#

Return n_eff - 1 from pre-sampled terms and two scalars.

Parameters:
termsMarcatiliTerms

The sampled frequency-dependent quantities.

radiusfloat

Core radius in m, > 0.

densityfloat

Number density of the fill in m^-3, >= 0.

Returns:
numpy.ndarray

n_eff - 1, complex, formed without cancellation.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> mode = MarcatiliMode(125e-6, "He", 1.0, model="reduced")
>>> terms = mode.sampled_terms(np.array([2.356e15]))
>>> f"{complex(mode.refractivity_from_terms(terms, 125e-6, 2.46e25)[0]):.3e}"
'2.881e-05+9.000e-09j'
rotated(phi)[source]#

Return the same mode turned about the axis.

Parameters:
phifloat

The new rotation angle in rad, in the sense of phi: positive from x towards y, so for HE_1m it is the polarisation angle measured from the x axis.

Returns:
MarcatiliMode

A copy with the new angle; everything else is unchanged.

Examples

>>> import math
>>> from solprop.modes import MarcatiliMode
>>> MarcatiliMode(125e-6, "He", 1.0).rotated(math.pi / 2).phi
1.5707963267948966
sampled_terms(omega)[source]#

Sample everything in the effective index that does not depend on z.

Parameters:
omeganumpy.ndarray

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

Returns:
MarcatiliTerms

The gas susceptibility, the cladding term and their derivatives, ready to be combined with a radius and a density at any position.

Raises:
ModeError

If any frequency is not strictly positive or not finite.

Examples

>>> import numpy as np
>>> from solprop.modes import MarcatiliMode
>>> terms = MarcatiliMode(125e-6, "He", 1.0).sampled_terms(np.array([2.4e15]))
>>> terms.cladding_term.shape
(1,)
property scale_invariant: bool[source]#

Whether the profile scales exactly with the core radius.

Always True: the field depends on r only through r / a and the normalisation goes as a^2, so a taper rescales the transform matrices by two scalars.

susceptibility: GasSusceptibility | None = None#
temperature: float | ZProfile | None = None#
u_nm: float#
property z_constant: bool[source]#

Whether nothing about the mode varies along z.

True when neither the core radius nor the density varies. The multimode transform cares only about the radius, which radius_is_constant reports separately.

solprop.modes.capillary.MarcatiliModel#

Whether to use the square-root expression or its leading-order expansion.

alias of Literal[‘full’, ‘reduced’]

class solprop.modes.capillary.MarcatiliTerms(omega, u_nm, core_susceptibility, dcore_susceptibility_domega, cladding_term, dcladding_term_domega)[source]#

Bases: object

Everything in a Marcatili effective index that depends only on frequency.

z enters a capillary mode through exactly two scalars, the core radius and the number density, so the frequency-dependent pieces can be sampled once and reused at every position (docs/dev/architecture.md section 6.5). Building this is the expensive part: it calls the gas model and the cladding model.

The frequency is typed as inexact rather than real on purpose. The effective index is a holomorphic function of omega – powers, a square root and a rational cladding term – so sampling these terms at a complex frequency lets the analytic derivative be checked against Cauchy’s integral formula, which is free of the subtractive cancellation that limits any finite difference. Nothing in the public API does that; MarcatiliMode.sampled_terms() requires a real, positive frequency.

Attributes:
omeganumpy.ndarray

Angular frequencies in rad/s, shape (n_omega,), > 0 in every use except the contour check described above.

u_nmfloat

The Bessel zero of the mode, dimensionless.

core_susceptibilitynumpy.ndarray

Per-particle susceptibility gamma(omega) in m^3, so that chi = gamma * rho. Mixtures carry shape (n_species, n_omega); a single gas carries shape (n_omega,). Values are real for transparent built-in gases and complex for absorbing custom species.

dcore_susceptibility_domeganumpy.ndarray

Its analytic frequency derivative in m^3 s/rad.

cladding_termnumpy.ndarray

The complex v_n(omega) of the mode’s family.

dcladding_term_domeganumpy.ndarray

Its analytic frequency derivative in s/rad.

cladding_term: Complex[ndarray, 'n_clad']#
core_susceptibility: Inexact[ndarray, '*species n_terms']#
dcladding_term_domega: Complex[ndarray, 'n_clad']#
dcore_susceptibility_domega: Inexact[ndarray, '*species n_terms']#
omega: Inexact[ndarray, 'n_omega']#
u_nm: float#
solprop.modes.capillary.ModeKind#

Which family a capillary mode belongs to: hybrid, transverse electric or magnetic.

alias of Literal[‘HE’, ‘TE’, ‘TM’]

solprop.modes.capillary.bessel_zero(order, index)[source]#

Return the index-th positive zero of the Bessel function of the first kind.

Parameters:
orderint

Order of the Bessel function. Negative orders are folded onto positive ones, since J_-p = (-1)^p J_p for integer p and the zeros coincide.

indexint

Which zero, counting from 1.

Returns:
float

The zero j_{order, index}, dimensionless.

Raises:
ModeError

If index is not a positive integer.

Examples

>>> from solprop.modes.capillary import bessel_zero
>>> f"{bessel_zero(0, 1):.10f}"
'2.4048255577'
>>> bessel_zero(-2, 1) == bessel_zero(2, 1)
True
solprop.modes.capillary.cladding_term_and_derivative(permittivity, dpermittivity, kind)[source]#

Return the Marcatili cladding term and its frequency derivative.

With e the cladding permittivity the three families give v_HE = (e + 1) / (2 sqrt(e - 1)), v_TE = 1 / sqrt(e - 1) and v_TM = e / sqrt(e - 1). The root is taken in the complex plane, so a cladding with Re e < 1 – a metal, or silica in the extreme ultraviolet – is handled rather than producing a NaN.

Parameters:
permittivitynumpy.ndarray

The cladding’s relative permittivity, complex, shape (n_omega,).

dpermittivitynumpy.ndarray

Its analytic frequency derivative in s/rad, same shape.

kind{“HE”, “TE”, “TM”}

The mode family.

Returns:
tuple of numpy.ndarray

v_n(omega), dimensionless, and dv_n/domega in s/rad.

Examples

>>> import numpy as np
>>> from solprop.modes.capillary import cladding_term_and_derivative
>>> term, _ = cladding_term_and_derivative(
...     np.array([5.0 + 0j]), np.array([0j]), "TE"
... )
>>> term.tolist()
[(0.5+0j)]
solprop.modes.capillary.core_susceptibility_at(terms, density)[source]#

Return the core susceptibility of a fill at one position.

Parameters:
termsMarcatiliTerms

A mode’s frequency-only terms, whose per-particle susceptibility is one row or one row per sampled species.

densityfloat or numpy.ndarray

Number density in m^-3, scalar or one entry per sampled species.

Returns:
numpy.ndarray

The dimensionless susceptibility, complex, shape (n_omega,).

solprop.modes.capillary.shared_sampling()[source]#

Sample each mode’s frequency-only terms once per frequency vector in a scope.

MarcatiliTerms do not depend on z, yet a varying coherent wall reads neff, dneff_dz and the block at about a hundred positions for each channel, and each read samples the gas and the cladding models again, which dominates the translation cost. Inside this scope MarcatiliMode.sampled_terms() returns the terms it already built for the same mode and the same frequencies: the same function of the same inputs, so every array built from them is bitwise the unshared one. The shared arrays are made read-only, so a caller that wrote into one would fail loudly rather than change what the next caller reads.

A scope opened inside another is the enclosing one.

Yields:
None

Nothing; the scope ends when the block exits.

Examples

>>> import numpy as np
>>> from solprop.modes.capillary import MarcatiliMode, shared_sampling
>>> mode = MarcatiliMode(125e-6, "He", 1.0)
>>> omega = np.array([2.0e15, 2.5e15])
>>> with shared_sampling():
...     same = mode.sampled_terms(omega) is mode.sampled_terms(omega)
>>> same
True