Defining a custom parametric curve

Define a parametric curve that implements an Euler spiral, using scipy’s fresnel function. Define a waveguide along this curve.

  • Parametric Euler spiral [0.0-2.5]
  • plot parametric curve
import si_fab.all as pdk
import ipkiss3.all as i3
import pylab as plt
from scipy.special import fresnel


# fresnel(2) is the first full loop, calculate the scaling to have the first loop pass at a given x coordinate
distance_x = 5.0
scaling = distance_x / fresnel(2)[0]


def curve(t: float) -> (float, float):
    x, y = fresnel(t)
    return scaling * x, scaling * y


shape = i3.ParametricShape(curve=curve, t_max=2.5)

fig, ax = plt.subplots()
ax.plot(shape.x_coords(), shape.y_coords(), "o-")
ax.set_title("Parametric Euler spiral [0.0-2.5]")
ax.set_xlabel("x [um]")
ax.set_ylabel("y [um]")
ax.set_aspect("equal")
plt.show()

wg_layout = i3.Waveguide(trace_template=pdk.SWG450()).Layout(shape=shape)
wg_layout.visualize(annotate=True)