Fibers and layers#

Unit-checked public fiber model backed by numerical SI solvers.

class Layer(fiber, layer)[source]#

Bases: object

Unit-aware view of a numerical step-index layer.

Radius and index assignments update the owning fiber and invalidate caches.

property name#

Name assigned when the layer was added to the fiber.

property position#

Zero-based radial order of this layer.

property radius_in: Length#

Inner radius as a length quantity.

property radius_out: Length#

Outer radius as a length quantity.

property refractive_index: RefractiveIndex#

Dimensionless refractive index.

property wavelength: Length#

Wavelength shared with the owning fiber.

property is_first_layer#

Whether this is the innermost layer.

property is_last_layer#

Whether this is the unbounded outer layer.

class Fiber(wavelength)[source]#

Bases: object

Multilayer fiber with explicit quantities for all physical parameters.

Parameters:

wavelength (TypedUnit.Length) – Positive finite vacuum wavelength, for example 1550 * ureg.nanometer.

property analysis#

Return modal analysis with unit-aware results and solver settings.

property fields#

Return a unit-aware field-construction service.

property geometry_signature#

Return an immutable numerical signature used for cache diagnostics.

property wavelength: Length#

Vacuum wavelength in meters.

update_wavelength(wavelength)[source]#

Validate and update the wavelength, clearing numerical caches.

Parameters:

wavelength (Length)

Return type:

None

add_layer(name, radius, index)[source]#

Add a layer with a length radius and a dimensionless index quantity.

Parameters:
  • name (str)

  • radius (Length)

  • index (RefractiveIndex)

Return type:

None

initialize_layers()[source]#

Mark inner and outer layers and finalize solver geometry.

Return type:

None

clear_caches()[source]#

Invalidate cached numerical solutions.

Return type:

None

property layers#

Ordered unit-aware views of the step-index layers.

property first_layer#

Innermost fiber layer.

property last_layer#

Unbounded outermost fiber layer.

property penultimate_layer#

Layer immediately inside the outermost layer.

property n_layer#

Number of layers.

property n_interface#

Number of interfaces.

property layer_names#

Names of the fiber layers.

property layer_radius#

Layer radii as a length array.

property index_list#

Layer refractive indices as a dimensionless array.

property radius: Length#

Largest finite interface radius.

property maximum_index: RefractiveIndex#

Largest material refractive index.

property minimum_index: RefractiveIndex#

Smallest material refractive index.

property V_number#

Dimensionless normalized frequency.

property M_number#

Dimensionless approximate guided-mode count.

get_NA()[source]#

Return the dimensionless numerical aperture.

scale(factor)[source]#

Return an independent fiber scaled by a dimensionless factor.

Parameters:

factor (float)

iterate_interfaces()[source]#

Yield adjacent unit-aware layer pairs.

get_layer_at_radius(radius)[source]#

Find the layer containing a length-valued radial position.

Parameters:

radius (Length)

get_index_at_radius(radius)[source]#

Return the dimensionless refractive index at a radial position.

Parameters:

radius (Length)

get_index_profile(radius)[source]#

Evaluate a dimensionless index profile at length-valued positions.

Parameters:

radius (Length)

solve_effective_index(mode)[source]#

Return solver diagnostics with a quantity-valued effective index.

get_mode_field(mode, limit=None, n_point=101)[source]#

Sample a field on a grid with an optional length-valued half-width.

Parameters:
  • limit (Length)

  • n_point (int)

get_radial_field(mode, radius)[source]#

Return electric (V/m) and magnetic (A/m) cylindrical components.

Parameters:

radius (Length)

get_radial_fields(mode, radius)[source]#

Return electric and magnetic components over a length-valued array.

Parameters:

radius (Length)

get_radial_field_norm(mode, radius)[source]#

Return the electric-field norm in volts per meter.

Parameters:

radius (Length)

does_mode_exist(*mode_list)[source]#

Return existence flags for the supplied modes.

find_modes(families=('LP',), max_nu=6, max_m=6)[source]#

Discover guided modes within the requested search bounds.

print_data(data_type_list, mode_list)[source]#

Print modal quantities including their output units.

Parameters:
  • data_type_list (list[str])

  • mode_list (list)

sweep(parameters, **kwargs)[source]#

Sweep length-valued wavelengths or a custom quantity parameter.

get_S_parameter(mode)#

Compute the S-parameter (third-order dispersion).

The S-parameter is defined as:

\[S = 10^{-3} \cdot \left( \frac{2 \pi c}{\lambda^2} \right)^2 \cdot \frac{\partial^3 \beta}{\partial \omega^3}\]
Parameters:

mode (Mode) – The optical mode to consider.

Returns:

  • pint.Quantity – The S-parameter in appropriate units.

  • Output unit (picosecond / nanometer * 2 / kilometer.*)

Return type:

Quantity

get_dispersion(mode)#

Compute the modal dispersion in the fiber.

Dispersion is defined as:

\[D = - \frac{2 \pi c}{\lambda^2} \cdot \frac{\partial^2 \beta}{\partial \omega^2}\]
where:
  • \(c\) is the speed of light.

  • \(\lambda\) is the wavelength.

  • \(\beta\) is the propagation constant.

Parameters:

mode (Mode) – The optical mode to consider.

Returns:

The dispersion in units of ps/nm/km.

Return type:

pint.Quantity

Notes

Dispersion affects pulse broadening in fiber optics, particularly for long-haul transmission.

Output unit: picosecond / nanometer / kilometer.

get_effective_index(mode)#

Gets the effective index.

Parameters:

mode (Mode) – The mode to consider

Returns:

  • pint.Quantity – The effective index.

  • Output unit (dimensionless.)

Return type:

Quantity

get_group_index(mode)#

Gets the group index.

Parameters:

mode (Mode) – The mode to consider

Returns:

  • pint.Quantity – The group index.

  • Output unit (dimensionless.)

Return type:

Quantity

get_group_velocity(mode)#

Compute the correctly named modal group velocity.

Parameters:

mode (Mode) – Mode to evaluate.

Returns:

  • pint.Quantity – Group velocity in meters per second.

  • Output unit (meter / second.)

Return type:

Quantity

get_group_velocity_dispersion(mode)#

Gets the fiber group velocity dispersion defined as:

\[\frac{\partial^2 \beta}{\partial \omega^2}\]
Parameters:

mode (Mode) – The mode to consider

Returns:

  • pint.Quantity – The group_velocity dispersion

  • Output unit (second * 2 / meter.*)

Return type:

Quantity

get_mode_cutoff_v0(mode)#

Gets the cutoff wavelength of the fiber.

Parameters:

mode (Mode) – The mode to consider

Returns:

  • pint.Quantity – The cutoff wavelength.

  • Output unit (dimensionless.)

Return type:

Quantity

get_mode_cutoff_wavelength(mode)#

Compute the cutoff wavelength for a given mode.

Parameters:

mode (Mode) – The optical mode for which to calculate the cutoff wavelength.

Returns:

The cutoff wavelength of the specified mode.

Return type:

pint.Quantity

Notes

A mode is no longer guided when the wavelength exceeds the cutoff.

Output unit: meter.

get_normalized_beta(mode)#

Gets the normalized propagation constant [beta].

Parameters:

mode (Mode) – The mode to consider

Returns:

  • pint.Quantity – The normalized propagation constant.

  • Output unit (dimensionless.)

Return type:

Quantity

get_phase_velocity(mode)#

Compute the phase velocity of a mode in the fiber.

Parameters:

mode (Mode) – The optical mode for which to compute the phase velocity.

Returns:

The phase velocity of the mode, in meters per second.

Return type:

pint.Quantity

Notes

Phase velocity is given by:

\[v_p = \frac{c}{n_{eff}}\]

where \(n_{eff}\) is the effective refractive index.

Output unit: meter / second.

get_propagation_constant(mode)#

Gets the propagation constant [\(beta\)].

Parameters:

mode (Mode) – The mode to consider

Returns:

  • pint.Quantity – The propagation constant [\(beta\)].

  • Output unit (1 / meter.)

Return type:

Quantity

load_fiber(fiber_name, wavelength, add_air_layer=False, materials=MaterialRegistry(models={'fused_silica': FusedSilica(), 'silica': FusedSilica()}))[source]#

Load YAML geometry (stored in SI) at a length-valued vacuum wavelength.

Parameters:
  • fiber_name (str)

  • wavelength (Length)

  • add_air_layer (bool)

  • materials (MaterialRegistry)

Return type:

Fiber

get_fiber_from_delta_and_V0(delta, V0, wavelength)[source]#

Construct a fiber from dimensionless contrast, V-number and wavelength.

Parameters:

wavelength (Length)

Return type:

Fiber

class ModalAnalysis(fiber)[source]#

Bases: object

Unit-aware view of a fiber’s cached numerical modal-analysis service.

property settings#

Numerical solver settings.

property cache_size#

Number of cached modal results.

clear()[source]#

Discard cached modal results.

effective_index(mode)[source]#

Return a dimensionless effective-index quantity.

effective_index_result(mode)[source]#

Return unit-bearing effective-index solver diagnostics.

cutoff_result(mode)[source]#

Return unit-bearing normalized-cutoff solver diagnostics.

class FieldAnalysis(fiber)[source]#

Bases: object

Unit-aware field-construction service.

mode_field(mode, limit=None, n_point=101)[source]#

Construct a field with a length-valued sampling limit.

Parameters:
  • limit (Length)

  • n_point (int)

Factories for constructing parameterized multilayer fibers.

class ProxyLayer(name, radius=<factory>, index=<factory>)[source]#

Bases: object

Represents a layer configuration in a fiber, with name, radius, and refractive index.

Parameters:
  • name (str) – Name of the layer.

  • radius (pint.Quantity) – Radius values for the layer (in meters).

  • index (pint.Quantity) – Refractive index values for the layer.

name: str#
radius: list#
index: list#
get_generator()[source]#

Create a generator for all combinations of name, radius, and index.

Returns:

generator – Generator yielding tuples of (name, radius, index).

Return type:

itertools.product

class FiberFactory(wavelength)[source]#

Bases: object

Factory to create and manage multiple Fiber instances with various configurations.

Parameters:

wavelength (TypedUnit.Length) – Wavelength (in meters) used for fiber simulations.

Variables:
  • layers_list (list[ProxyLayer]) – List of ProxyLayer objects representing the layers of the fiber.

  • wavelength (TypedUnit.Length) – Wavelength used in simulations.

add_layer(index, name='', radius=<Quantity(inf, 'meter')>)[source]#

Add a new layer to the fiber factory.

Parameters:
  • index (TypedUnit.RefractiveIndex) – Refractive index of the layer.

  • name (str, optional) – Name of the layer (default is an empty string).

  • radius (TypedUnit.Length, optional) – Radius of the layer (defaults to an unbounded outer layer).

get_overall_generator()[source]#

Generate all possible combinations of layer configurations.

Returns:

overall_generator – Generator yielding all possible layer configurations.

Return type:

itertools.product

Step-index layer model and radial electromagnetic field coefficients.

class Geometry(radius_in, radius_out, index_list)[source]#

Bases: object

Represents a geometric structure with refractive indices and radii.

Parameters:
  • radius_in (float) – Minimum radius of the structure.

  • radius_out (float) – Maximum radius of the structure.

  • index_list (list) – List of refractive indices for the structure.

radius_in: float#
radius_out: float#
index_list: list#
class StepIndex(radius_in, radius_out, index_list)[source]#

Bases: Geometry

Represent one annular step-index layer.

Parameters:
  • radius_in (float) – Inner layer radius in meters.

  • radius_out (float) – Outer layer radius in meters.

  • index_list (list of float) – Refractive-index values associated with the layer.

get_index_at_radius(radius)[source]#

Get the refractive index at a specific radius.

Parameters:

radius (float) – Radius for evaluation.

Returns:

Refractive index at the given radius if within bounds, else None.

Return type:

float or None

get_U_W_parameter(radius, neff)[source]#

Calculate the U or W parameter for waveguides.

The U and W parameters are defined as:

\[ \begin{align}\begin{aligned}U = k_0 \rho \sqrt{n_{\text{core}}^2 - n_{\text{eff}}^2}\\W = k_0 \rho \sqrt{n_{\text{eff}}^2 - n_{\text{clad}}^2}\end{aligned}\end{align} \]

where: - (k_0) is the free-space wave number ((2 pi / lambda)). - (n_{text{core}}), (n_{text{clad}}) are the refractive indices. - (n_{text{eff}}) is the effective refractive index.

Parameters:
  • radius (float) – Radius for evaluation.

  • neff (float) – Effective refractive index.

Returns:

U or W parameter value.

Return type:

float

get_psi(radius, neff, nu, C)[source]#

Compute the \(\psi\) function and its derivative.

The function \(\psi\) is computed using Bessel functions for core layers and modified Bessel functions for cladding layers. The equations used are:

Core Layer:

\[ \begin{align}\begin{aligned}\psi = C_0 J_\nu(U) + C_1 Y_\nu(U)\\\dot{\psi} = C_0 U J'_\nu(U) + C_1 U Y'_\nu(U)\end{aligned}\end{align} \]

Cladding Layer:

\[ \begin{align}\begin{aligned}\psi = C_0 I_\nu(U) + C_1 K_\nu(U)\\\dot{\psi} = C_0 U I'_\nu(U) + C_1 U K'_\nu(U)\end{aligned}\end{align} \]
where:
  • J$_nu$, Y$_nu$: Bessel functions of the first and second kind.

  • I$_nu$, K$_nu$: Modified Bessel functions of the first and second kind.

  • C$_0$, C$_1$: Coefficients.

  • U: Parameter related to radius and refractive indices.

Parameters:
  • radius (float) – The radius at which the field is evaluated.

  • neff (float) – The effective refractive index.

  • nu (int) – The order of the Bessel function (mode number).

  • C (list) – Coefficients for the Bessel functions. Must have at least one value, with the second value optional (defaults to 0).

Returns:

A tuple containing \(\psi\): The field value and \(\dot{\psi}\): The derivative of the field value.

Return type:

tuple

get_LP_constants(radius, neff, nu, A)[source]#

Calculate the LP mode constants.

The constants are derived from Bessel or modified Bessel functions for specific mode conditions.

Parameters:
  • radius (float) – Radius for evaluation.

  • neff (float) – Effective refractive index.

  • nu (int) – Mode number.

  • A (list) – Coefficients for Bessel functions.

Returns:

LP mode constants.

Return type:

tuple

EH_fields(radius_in, radius_out, nu, neff, EH, TM=True)[source]#

Compute the EH field components.

The EH field components are derived based on the mode parameters and the coefficients (C_i).

Parameters:
  • radius_in (float) – Inner radius of the structure.

  • radius_out (float) – Outer radius of the structure.

  • nu (int) – Mode number.

  • neff (float) – Effective refractive index.

  • EH (list) – List of field components.

  • TM (bool, optional) – Indicates if TM mode (default is True).

Returns:

Updated EH field components.

Return type:

list

get_V_constant(radius_in, radius_out, neff, nu, EH)[source]#

Compute the V constants for the mode.

This method calculates the constants using Bessel or modified Bessel functions based on the refractive index regime.

Parameters:
  • radius_in (float) – Inner radius of the structure.

  • radius_out (float) – Outer radius of the structure.

  • neff (float) – Effective refractive index.

  • nu (int) – Mode number.

  • EH (np.ndarray) – Electric and magnetic field components.

Returns:

Solution to the linear system representing the V constants.

Return type:

np.ndarray

get_TE_TM_constants(radius_in, radius_out, neff, EH, c, idx)[source]#

Compute the TE/TM constants for the waveguide.

This method calculates the constants using standard or modified Bessel functions depending on the refractive index regime.

Parameters:
  • radius_in (float) – Inner radius of the structure.

  • radius_out (float) – Outer radius of the structure.

  • neff (float) – Effective refractive index.

  • EH (np.ndarray) – Electric and magnetic field components.

  • c (float) – Scaling constant for the calculation.

  • idx (tuple) – Indices for selecting specific components of the EH array.

Returns:

Solution to the linear system representing the TE/TM constants.

Return type:

np.ndarray