Skip to content
Edit this page

ictdesigntools.optical.filters

WDM filters: multiplexers, demultiplexers, OADMs and wavelength selective switches.

ITU-T G.671 (11/2025) lists the parameters of each of these (insertion loss, isolation, passband width, reflectance) but leaves most of their values to the application, so a Filter takes them from a data sheet. G.671 does set a few limits, and those are here:

  • an optical filter's reflectance is at most −40 dB (clause 6.10);
  • a 1 × X WWDM mux/demux (channels 50 nm or more apart) loses at most 1.5·log2 X dB per channel, with PDL at most 0.1·(1 + log2 X) dB and reflectance at most −40 dB (clause 6.19.3).

A signal crossing several filters (the mux, each ROADM it passes, the demux) sees the product of their passbands, which is narrower than any one of them. Each passband is modelled as a super-Gaussian of order n, whose loss at an offset f from the centre is 3.01·(2f / B)^(2n) dB for a 3 dB width B: order 1 is a Gaussian, and higher orders are flatter with steeper edges. This is a planning approximation, not a measured shape.

>>> wss = Filter("wss", 6.0, passband_ghz=40.0, order=3)
>>> round(cascade_passband_ghz([wss] * 8), 1)
28.3
>>> cascade_loss_db([Filter("mux", 5.0), wss, wss, Filter("demux", 5.5)])
22.5
>>> w = wwdm(2)
>>> w.insertion_loss_db, round(w.pdl_db, 2)
(1.5, 0.2)
>>> round(crosstalk_db(Filter("demux", 5.0, adjacent_isolation_db=25,
...                           nonadjacent_isolation_db=30), channels=40), 1)
-13.6

FilterError

Bases: ValueError

A filter, or a chain of them, that cannot be worked out.

Filter dataclass

Filter(
    kind: str,
    insertion_loss_db: float,
    passband_ghz: float | None = None,
    order: float = 2.0,
    adjacent_isolation_db: float | None = None,
    nonadjacent_isolation_db: float | None = None,
    reflectance_db: float = FILTER_REFLECTANCE_DB,
    pdl_db: float | None = None,
    name: str = "",
)

One pass through a WDM filter. insertion_loss_db is its loss per channel, at its worst over the passband; passband_ghz its 3 dB passband width; order the super-Gaussian order of its shape (1 to 10); isolations are to adjacent and non-adjacent channels, as a demux or drop port gives them.

loss_at_db

loss_at_db(offset_ghz: float) -> float

The extra loss, beyond the insertion loss, at offset_ghz from the centre.

Source code in src/ictdesigntools/optical/filters.py
def loss_at_db(self, offset_ghz: float) -> float:
    """The extra loss, beyond the insertion loss, at ``offset_ghz`` from the centre."""
    if self.passband_ghz is None:
        return 0.0
    return _DB_AT_EDGE * (2 * abs(offset_ghz) / self.passband_ghz) ** (2 * self.order)

cascade_loss_db

cascade_loss_db(filters) -> float

The insertion loss of a chain of filter passes, in dB.

Source code in src/ictdesigntools/optical/filters.py
def cascade_loss_db(filters) -> float:
    """The insertion loss of a chain of filter passes, in dB."""
    return round(sum(f.insertion_loss_db for f in filters), 6)

cascade_passband_ghz

cascade_passband_ghz(
    filters, drop_db: float = _DB_AT_EDGE
) -> float

The width over which a chain of filters together lose no more than drop_db beyond their insertion loss (by default 3 dB). Filters with no passband width are left out.

Source code in src/ictdesigntools/optical/filters.py
def cascade_passband_ghz(filters, drop_db: float = _DB_AT_EDGE) -> float:
    """The width over which a chain of filters together lose no more than ``drop_db`` beyond
    their insertion loss (by default 3 dB). Filters with no passband width are left out."""
    shaped = [f for f in filters if f.passband_ghz is not None]
    if not shaped:
        raise FilterError("None of these filters has a passband width.")
    if drop_db <= 0:
        raise FilterError("The drop must be positive.")

    def drop(half_ghz: float) -> float:
        return sum(f.loss_at_db(half_ghz) for f in shaped)

    lo, hi = 0.0, max(f.passband_ghz for f in shaped)
    while drop(hi) < drop_db:
        hi *= 2
    for _ in range(60):
        mid = (lo + hi) / 2
        lo, hi = (mid, hi) if drop(mid) < drop_db else (lo, mid)
    return 2 * lo

check_passband

check_passband(filters, signal_ghz: float) -> PassbandCheck

Whether a chain of filters leaves a 3 dB passband at least as wide as a signal (for a coherent signal, about its symbol rate in GBd times one plus its roll-off).

Source code in src/ictdesigntools/optical/filters.py
def check_passband(filters, signal_ghz: float) -> PassbandCheck:
    """Whether a chain of filters leaves a 3 dB passband at least as wide as a signal (for a
    coherent signal, about its symbol rate in GBd times one plus its roll-off)."""
    if signal_ghz <= 0:
        raise FilterError("A signal width must be positive.")
    width = cascade_passband_ghz(filters)
    return PassbandCheck(width, signal_ghz, width - signal_ghz)

crosstalk_db

crosstalk_db(
    demux: Filter, channels: int, adjacent: int = 2
) -> float

The total crosstalk into one dropped channel from all the others, relative to it, when all arrive at equal power: adjacent channels at the adjacent isolation and the rest at the non-adjacent isolation (the adjacent figure, when that is the only one given).

Source code in src/ictdesigntools/optical/filters.py
def crosstalk_db(demux: Filter, channels: int, adjacent: int = 2) -> float:
    """The total crosstalk into one dropped channel from all the others, relative to it, when
    all arrive at equal power: ``adjacent`` channels at the adjacent isolation and the rest at
    the non-adjacent isolation (the adjacent figure, when that is the only one given)."""
    if demux.adjacent_isolation_db is None:
        raise FilterError("This filter has no adjacent-channel isolation.")
    if channels < 1:
        raise FilterError("Give at least one channel.")
    others = channels - 1
    near = min(adjacent, others)
    far = others - near
    far_iso = demux.nonadjacent_isolation_db or demux.adjacent_isolation_db
    total = near * 10 ** (-demux.adjacent_isolation_db / 10) + far * 10 ** (-far_iso / 10)
    return -math.inf if total == 0 else 10 * math.log10(total)

wwdm

wwdm(outputs: int) -> Filter

The G.671 clause 6.19.3 limits for a 1 × outputs WWDM mux/demux (such as a 1310/1550 nm coupler): maximum insertion loss, PDL and reflectance.

Source code in src/ictdesigntools/optical/filters.py
def wwdm(outputs: int) -> Filter:
    """The G.671 clause 6.19.3 limits for a 1 × ``outputs`` WWDM mux/demux (such as a
    1310/1550 nm coupler): maximum insertion loss, PDL and reflectance."""
    if outputs < 2:
        raise FilterError("A WWDM mux/demux has at least two channels.")
    log2x = math.log2(outputs)
    return Filter("mux", round(1.5 * log2x, 6), pdl_db=0.1 * (1 + log2x),
                  name=f"WWDM 1x{outputs} (G.671 limits)")  # fmt: skip