Skip to content

Spectra and models

optodraw computes the steady spectrum of a chip from closed forms of its parts, or from S-parameters that you import from a simulation. The drawn electronics compute their signals too. Each number says where it comes from: measured, literature, simulated or model.

Two rings on one chip. The group index and the loss come from papers. The coupling is a design value, so the notes call it a model.

Ring spectra from sourced numbers: an all-pass and an add-drop ring on one chipsaved output
# Ring spectra from sourced numbers: an all-pass and an add-drop ring on one chip
import math
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from optodraw import MicroringResonator, OnChipLaser, OnChipPhotodetector, Page, Scene, Source, Sourced
from optodraw.animation_engine import spectrum
# a 480 x 220 nm silicon strip: n_g from the paper's n_eff and its slope, n_g = n_eff - lambda dn_eff/dlambda
N_G = Sourced(2.411 + 1.55 * 1.078, Source(
"literature", "James et al., arXiv:2301.01689 (2023), sec. II-E: n_eff 2.411, dn_eff/dlambda -1.078 per um",
"n_g at 1.55 um; the paper does not state the wavelength of its reference fringe"))
LOSS_DB_PER_UM = 2.4e-4 # 2.4 dB/cm, photonic wires
BOGAERTS = "Bogaerts et al., J. Lightwave Technol. 23, 401 (2005): 2.4 dB/cm for photonic wires"
KAPPA = Sourced(0.05, Source("model", note="a design value: over-coupled, so the resonances are wide enough to see"))
def sourced_ring(**kwargs):
ring = MicroringResonator(**kwargs)
trip = 2 * math.pi * ring.ring_radius # the loop, um
ring.group_index = N_G
ring.round_trip_amplitude = Sourced(10 ** (-LOSS_DB_PER_UM * trip / 20), Source(
"literature", BOGAERTS, f"amplitude after one {trip:.1f} um round trip"))
ring.power_coupling = KAPPA
if ring.add_drop:
ring.drop_power_coupling = KAPPA
return ring
chip = Scene(title="Two rings", platform="on_chip")
laser_a = chip.add(OnChipLaser(center=(-90, 50), label="Laser"))
allpass = chip.add(sourced_ring(center=(0, 50), label="All-pass"))
through_a = chip.add(OnChipPhotodetector(center=(90, 50), label="Through"))
laser_b = chip.add(OnChipLaser(center=(-90, -50), label="Laser", label_side="bottom"))
adddrop = chip.add(sourced_ring(center=(0, -50), add_drop=True, label="Add-drop"))
through_b = chip.add(OnChipPhotodetector(center=(90, -50), label="Through"))
drop_b = chip.add(OnChipPhotodetector(center=(-90, -5), angle=180, label="Drop"))
for a, b in (((laser_a, "o1"), (allpass, "o1")), ((allpass, "o2"), (through_a, "o1")),
((laser_b, "o1"), (adddrop, "o1")), ((adddrop, "o2"), (through_b, "o1")),
((adddrop, "o3"), (drop_b, "o1"))):
chip.route(a, b, kind="waveguide", path_type="smooth")
chip.fit_frame(margin=6)
s = spectrum(chip, start_nm=1540, stop_nm=1560, points=2001)
plt.rcParams.update({"font.size": 6, "axes.linewidth": 0.6, "axes.spines.top": False, "axes.spines.right": False})
fig, ax = plt.subplots(figsize=(3.0, 1.9), layout="constrained")
for part, colour, name in ((through_a, "#0072B2", "all-pass, through"), (through_b, "#E69F00", "add-drop, through"),
(drop_b, "#009E73", "add-drop, drop")):
ax.plot(s.wavelengths_nm, s.of(part, "o1"), color=colour, lw=0.9, label=name)
ax.set(xlabel="Wavelength (nm)", ylabel="Power (norm.)", ylim=(0, 1.05), xticks=range(1540, 1561, 5))
ax.legend(frameon=False, fontsize=6, loc="center")
page = Page(width_mm=183)
page.row([chip, fig])
print("\n".join(s.notes))
page
Ring spectra from sourced numbers: an all-pass and an add-drop ring on one chip
the propagation phase uses the group index: the free spectral range is right, and the absolute resonance position is a model value
All-pass: power_coupling = 0.05 (model)
Add-drop: power_coupling = 0.05 (model)
Add-drop: drop_power_coupling = 0.05 (model)

The heater moves the add-drop resonance onto the laser line. Panel a reads the animation’s own numbers.

The heater moves the resonance onto the laser line: the animation's own numbers, plottedsaved output
# The heater moves the resonance onto the laser line: the animation's own numbers, plotted
from optodraw.animation_engine import Animation, Flow, Plot, Quantity, Sweep
heater = f"heater:{s.sids[id(adddrop)]}" # the add-drop ring's heater, in mW
light = Animation(chip, view="2d", mode="cw", strict=True)
light.play(Flow(mode="cw")).click()
light.play(Sweep(heater, 0, 30, seconds=4, samples=301), Plot(Quantity(drop_b), against=heater))
sweep = light.to_json()["assets"]["plot:1"] # what the editor plays, frame by frame
best = sweep["x"][max(range(len(sweep["y"])), key=sweep["y"].__getitem__)]
fig_a, ax = plt.subplots(figsize=(3.0, 1.9), layout="constrained")
ax.plot(sweep["x"], sweep["y"], color="#009E73", lw=0.9)
ax.set(xlabel="Heater power (mW)", ylabel="Drop power (norm.)", ylim=(0, 1.05))
fig_b, ax = plt.subplots(figsize=(3.0, 1.9), layout="constrained")
for mw, colour in ((0.0, "#BBBBBB"), (best, "#009E73")):
hot = spectrum(chip, start_nm=1540, stop_nm=1560, points=2001, params={heater: mw})
ax.plot(hot.wavelengths_nm, hot.of(drop_b, "o1"), color=colour, lw=0.9, label=f"{mw:.1f} mW")
ax.axvline(1550, color="black", lw=0.6, ls=":") # the laser line
ax.set(xlabel="Wavelength (nm)", ylabel="Drop power (norm.)", ylim=(0, 1.05), xticks=range(1540, 1561, 5))
ax.legend(frameon=False, fontsize=6, loc="lower center", bbox_to_anchor=(0.5, 1.0), ncol=2)
print(f"heater: a phase of pi per 20 mW (model: the engine's default); the drop peaks at {best:.1f} mW")
heated = Page(width_mm=183)
heated.row([fig_a, fig_b])
heated
The heater moves the resonance onto the laser line: the animation's own numbers, plotted
heater: a phase of pi per 20 mW (model: the engine's default); the drop peaks at 24.0 mW

An MZI of two couplers. Each coupler is a table from a 2D Meep simulation on fieldrt, and docs/examples/models/data/coupler_fieldrt.py makes the table again.

An MZI of two couplers simulated with fieldrt: imported S-parameters in a circuitsaved output
# An MZI of two couplers simulated with fieldrt: imported S-parameters in a circuit
from optodraw import DirectionalCoupler, OnChipLaser, OnChipPhotodetector, Page, Scene, Source
from optodraw.animation_engine import spectrum
from optodraw.sparameters import SParameters
# a 2D directional coupler (gap 0.2 um, 10 um long) run in Meep on fieldrt: data/coupler_fieldrt.py
TABLE = SParameters.load("docs/examples/models/data/coupler_fieldrt.npz", source=Source(
"simulated", "Meep on fieldrt, 2D effective index, 45 px/um, float64",
"largest singular value 1.0043 at 30 px/um, 1.0020 at 45: grid error, converging; the file's meta has the rest"))
mzi = Scene(title="MZI of imported couplers", platform="on_chip")
laser = mzi.add(OnChipLaser(center=(-120, 7), label="Laser"))
split = mzi.add(DirectionalCoupler(center=(0, 0), label="Coupler"))
join = mzi.add(DirectionalCoupler(center=(150, 0), label="Coupler"))
split.model = join.model = TABLE # the table replaces each coupler's closed form
bar = mzi.add(OnChipPhotodetector(center=(270, 30), label="Bar"))
cross = mzi.add(OnChipPhotodetector(center=(270, -30), label="Cross", label_side="bottom"))
mzi.route((laser, "o1"), (split, "o1"), kind="waveguide")
mzi.route((split, "o3"), (join, "o1"), kind="waveguide") # the short arm
mzi.route((split, "o4"), (join, "o2"), kind="waveguide", path_type="manhattan", # the long arm, 20 um longer
steps=[{"y": -17.0}])
mzi.route((join, "o3"), (bar, "o1"), kind="waveguide", path_type="smooth")
mzi.route((join, "o4"), (cross, "o1"), kind="waveguide", path_type="smooth")
mzi.fit_frame(margin=6)
m = spectrum(mzi, start_nm=1500, stop_nm=1600, points=1001)
fig, ax = plt.subplots(figsize=(3.0, 1.9), layout="constrained")
ax.plot(m.wavelengths_nm, m.of(bar, "o1"), color="#0072B2", lw=0.9, label="bar")
ax.plot(m.wavelengths_nm, m.of(cross, "o1"), color="#D55E00", lw=0.9, label="cross")
ax.set(xlabel="Wavelength (nm)", ylabel="Power (norm.)", ylim=(0, 1.05), xticks=range(1500, 1601, 25))
ax.legend(frameon=False, fontsize=6, loc="lower center", bbox_to_anchor=(0.5, 1.0), ncol=2)
print("\n".join(m.notes))
imported = Page(width_mm=183)
imported.row([mzi, fig], shares=[0.6, None])
imported
An MZI of two couplers simulated with fieldrt: imported S-parameters in a circuit
the propagation phase uses the group index: the free spectral range is right, and the absolute resonance position is a model value
Coupler: TE only (imported table)
Coupler: the imported table is not passive within 1e-6 (largest singular value 1.00199 at 1548.5 nm)

A receiver. The heater sweeps the ring, and the drop light runs through the photodiode, the TIA drawn as an op amp, and a 12-bit ADC to the scope.

A receiver that computes its signal: drop light, photodiode, the TIA drawn as an op amp, a 12-bit ADC, the scopesaved output
# A receiver that computes its signal: drop light, photodiode, the TIA drawn as an op amp, a 12-bit ADC, the scope
import numpy as np
from optodraw import ADCBlock, Capacitor, ElectricalPad, Ground, OpAmp, Oscilloscope, Resistor
from optodraw.animation_engine import Waveform, signal_chain
VIVIEN = Source("literature", "Vivien et al., Opt. Express 20, 1096 (2012): 0.8 A/W at 1550 nm, Ge waveguide diode")
rx = Scene(title="A receiver", platform="on_chip")
laser = rx.add(OnChipLaser(center=(-150, 12.2), label="Laser", power_mw=Sourced(0.1, Source(
"model", note="a design value: the drop peak fills most of the ADC range"))))
ring = rx.add(sourced_ring(center=(0, 0), add_drop=True, with_heater=True, label="Ring"))
ring.flip_vertical = True # in on the top bus, the drop on the lower left
pd = rx.add(OnChipPhotodetector(center=(-60, -60), angle=-90, label="PD", label_side="left", # o1 up, pads down
responsivity_a_per_w=Sourced(0.8, VIVIEN)))
bias = rx.add(ElectricalPad(center=(-95, -100), width=6, height=6, label="V_{bias}", label_side="bottom"))
amp = rx.add(OpAmp(center=(-10, -112), label="TIA", label_side="bottom"))
r_f = rx.add(Resistor(center=(-10, -99), length=26, label="R_f", value="10 kΩ")) # the TIA example's values
c_f = rx.add(Capacitor(center=(-10, -77), length=26, label="C_f", value="0.2 pF"))
ground = rx.add(Ground(center=(-19, -122)))
adc = rx.add(ADCBlock(center=(50, -112), bit_count=12, label="ADC", label_side="bottom",
sample_rate_hz=Sourced(1e6, Source("model", note="a design value")),
full_scale_v=Sourced(1.0, Source("model", note="a design value"))))
scope = rx.add(Oscilloscope(center=(118, -102), label="Scope"))
rx.route((laser, "o1"), (ring, "o1"), kind="waveguide")
rx.route((ring, "o3"), (pd, "o1"), kind="waveguide", path_type="smooth")
for a, b in (((pd, "e2"), (bias, "e1")), ((pd, "e1"), (amp, "in_n")), ((r_f, "e1"), (amp, "in_n")),
((c_f, "e1"), (r_f, "e1")), ((r_f, "e2"), (amp, "out")), ((c_f, "e2"), (r_f, "e2")),
((amp, "in_p"), (ground, "e1")), ((amp, "out"), (adc, "in")), ((adc, "dout"), (scope, "ch1"))):
rx.route(a, b, kind="electrical", width=0.25)
rx.fit_frame(margin=6)
t = np.linspace(0.0, 1e6, 2001) # 1 ms, in ns
ramp = Waveform(t, np.linspace(0.0, 30.0, t.size), "mW") # the heater, as in the sweep above
chain = signal_chain(rx, t_ns=t, inputs=[((ring, "heater"), ramp)])
chain.show(scope) # the codes on the scope's screen
codes = chain.at(adc, "dout")
fig, ax = plt.subplots(figsize=(3.0, 1.9), layout="constrained")
ax.plot(codes.t_ns / 1e3, codes.values, color="#009E73", lw=0.9, drawstyle="steps-post")
ax.set(xlabel="Time (µs)", ylabel="ADC code", ylim=(0, 4096), yticks=range(0, 4097, 1024))
print("\n".join(chain.notes))
print("heater: its thermal delay is not modelled; the ramp sets its power at each instant (model)")
print(f"peak: code {codes.values.max()} of 4095 at {codes.t_ns[codes.values.argmax()] / 1e3:.0f} µs")
received = Page(width_mm=183)
received.row([rx, fig], shares=[0.6, None])
received
A receiver that computes its signal: drop light, photodiode, the TIA drawn as an op amp, a 12-bit ADC, the scope
the propagation phase uses the group index: the free spectral range is right, and the absolute resonance position is a model value
Ring: power_coupling = 0.05 (model)
Ring: drop_power_coupling = 0.05 (model)
Laser: power_mw = 0.1 (model)
electrical: first-order poles, no noise (model)
PD: dark_current_a (default, model)
PD: bandwidth_hz (default, model)
ADC: bit_count = 12 (model)
ADC: sample_rate_hz = 1e+06 (model)
ADC: full_scale_v = 1 (model)
heater: its thermal delay is not modelled; the ramp sets its power at each instant (model)
peak: code 3064 of 4095 at 800 µs

A transmitter. DAC codes drive the modulator through a driver.

A transmitter that computes its signal: DAC codes, a driver, the modulator, a photodiode, the scopesaved output
# A transmitter that computes its signal: DAC codes, a driver, the modulator, a photodiode, the scope
from optodraw import DAC, MZM, Amplifier, TIABlock
DESIGN = Source("model", note="a design value")
tx = Scene(title="A transmitter", platform="on_chip")
source = tx.add(OnChipLaser(center=(-150, 0), label="Laser", power_mw=Sourced(1.0, DESIGN)))
mzm = tx.add(MZM(center=(0, 0), label="MZM"))
dac = tx.add(DAC(center=(-120, 50), bit_count=8, label="DAC", sample_rate_hz=Sourced(1e9, DESIGN)))
driver = tx.add(Amplifier(center=(-62, 54.2), label="Driver", gain=Sourced(2.0, DESIGN), # 1 V of DAC to V_pi
bandwidth_hz=Sourced(5e9, DESIGN)))
detector = tx.add(OnChipPhotodetector(center=(110, 0), label="PD", label_side="bottom",
responsivity_a_per_w=Sourced(0.8, VIVIEN)))
bias_tx = tx.add(ElectricalPad(center=(150, 30), width=6, height=6, label="V_{bias}"))
tia = tx.add(TIABlock(center=(170, -9), label="TIA", label_side="bottom", gain_ohm=Sourced(1e3, DESIGN),
bandwidth_hz=Sourced(10e9, DESIGN)))
scope_tx = tx.add(Oscilloscope(center=(225, 20), label="Scope"))
tx.route((source, "o1"), (mzm, "o1"), kind="waveguide")
tx.route((mzm, "o3"), (detector, "o1"), kind="waveguide")
for a, b in (((dac, "out"), (driver, "in")), ((driver, "out"), (mzm, "sig")), ((detector, "e1"), (bias_tx, "e1")),
((detector, "e2"), (tia, "in")), ((tia, "out"), (scope_tx, "ch1"))):
tx.route(a, b, kind="electrical", width=0.25)
tx.fit_frame(margin=6)
symbols = [0, 3, 1, 2, 3, 0, 2, 1, 1, 3, 0, 2, 2, 0, 3, 1] # four levels, one symbol per ns
codes = Waveform(np.arange(16) * 1.0, np.array(symbols) * 85, "code")
t = np.linspace(0.0, 16.0, 801) # ns
chain_tx = signal_chain(tx, t_ns=t, inputs=[((dac, "din"), codes)])
chain_tx.show(scope_tx)
drive, received_v = chain_tx.at(driver, "out"), chain_tx.at(tia, "out")
fig, ax = plt.subplots(figsize=(3.0, 1.9), layout="constrained")
ax.plot(t, drive.values, color="#0072B2", lw=0.9, label="drive")
ax.plot(t, received_v.values, color="#009E73", lw=0.9, label="received")
ax.set(xlabel="Time (ns)", ylabel="Voltage (V)", ylim=(0, 2.1), xticks=range(0, 17, 4))
ax.legend(frameon=False, fontsize=6, loc="lower center", bbox_to_anchor=(0.5, 1.0), ncol=2)
print("\n".join(chain_tx.notes))
sent = Page(width_mm=183)
sent.row([tx, fig], shares=[0.6, None])
sent
A transmitter that computes its signal: DAC codes, a driver, the modulator, a photodiode, the scope
the propagation phase uses the group index: the free spectral range is right, and the absolute resonance position is a model value
MZM: v_pi (default, model)
Laser: power_mw = 1 (model)
electrical: first-order poles, no noise (model)
DAC: bit_count = 8 (model)
DAC: sample_rate_hz = 1e+09 (model)
DAC: full_scale_v (default, model)
Driver: gain = 2 (model)
Driver: bandwidth_hz = 5e+09 (model)
PD: dark_current_a (default, model)
PD: bandwidth_hz (default, model)
TIA: gain_ohm = 1000 (model)
TIA: bandwidth_hz = 1e+10 (model)
  • spectrum(scene, start_nm=1540, stop_nm=1560, points=2001): the power at each port where light ends. s.of(part, "o1") gives one curve, and s.notes says what it rests on.
  • signal_chain(scene, t_ns=t, inputs=[((ring, "heater"), ramp)]): every drawn signal on the grid t. chain.at(adc, "dout") gives one, and chain.show(scope) draws it on the scope.
  • Sourced(4.08, Source("literature", "James et al. (2023)")): a number with its source.
  • SParameters.load("coupler.npz", source=...): a table from SAX .npz or Touchstone .sNp. part.model = table replaces the closed form.
  • to_sax(scene, wavelengths_nm=w) from optodraw.sax_export: the circuit as a SAX netlist.

Closed forms for each part that registered_types() lists. Tables carry TE only. optodraw warns when the largest singular value of a table is above 1 + 1e-6, and refuses it above 1.05 or outside its wavelengths. The chain models detectors, TIAs, amplifiers, ADCs, DACs, laser drivers, modulators and heaters, with first-order poles and no noise.

The engine adds complex fields in the exp(-iωt) convention of SAX, with the group index. The free spectral range is right, and the absolute resonance position is a model value. The chain solves the light once per time sample. SAX gives the same spectrum to 1e-9.