SCEE Optimization

These are various functions to perform and aid in using SCEE as an inverse design optimizer.

Do to how fast SCEE is, inverse design of power splitting directional couplers can be achieved via an optimizer. This has been implemented and can be used via the SiPANN.scee_opt module, speficially the make_coupler function. It implements a global optimization, then a local optimization to best find the ideal coupler.

This is done by defining the length of the coupler and various control points along the coupler as parameters that our optimizer can choose that result in a $kappa$ closest to $kappa_{goal}$. The coupler is then defined using the control points plugged into a Bezier Curve. Note that the Bezier curve defined by the control points is the gap between waveguides, not the geometry of the waveguides themselves. However, since each of these directional couplers is symmetric the inner boundary of the waveguides are just half of the gap.

Further, for our objective function, we compute $kappa$ for a sweep of wavelength points using SCEE, and then calculate the MSE by comparing it to $kappa_{goal}$. Various constraints are also put on the coupler, like ensuring the edges of the coupler are far enough apart and making sure there’s no bends that are too sharp. To learn more about the process, see [INSERT PAPER WHEN PUBLISHED].

Optimizer and Utilities

Inverse Design Optimizer

SiPANN.scee_opt.make_coupler(goalK=0.4, arrayK=None, waveSweep=array([1500., 1533.33333333, 1566.66666667, 1600. ]), gapN=16, algo=35, edgeN=8, plot=False, collectData=False, width=500, thickness=220, radius=5000, maxiter=None, verbose=0)

Optimizes output from a directional coupler defined by a bezier curve to a specified output magnitude.

Parameters:
  • goalK (float) – [0-1] mandatory, unless using arrayK. Desired |kappa|^2 magnitude
  • arrayK (ndarray, optional) – Has to have size (2,). [0-1] can specify a |kappa|^2 magnitude at start and end of wavelength sweep. Defaults to None
  • waveSweep (ndarray, optional) – Sweep of wavelengths to evaluate objective function at. Defaults to np.linspace(1500,1600,4)
  • gapN (int, optional) – Number of control points that can vary. Defaults to 16.
  • algo (int, optional) – Optimization algorithm that nlopt uses. Defaults to 35
  • edgeN (int, optional) – Number of control points on each edge that are fixed at gap of 1500 nm. Defaults to 8.
  • plot (bool, optional) – If True then optimization will plot the current coupler at each iteration with the control points. Defaults to False.
  • collectData (bool, optional) – Whether to collect data for couplers of each iteration (could be useful for machine learning and even faster design). Defaults to False.
  • width (float, optional) – Width of waveguides in nm. Defaults to 500.
  • thickness (float, optional) – Thickness of waveguides in nm. Defaults to 220.
  • radius (float, optional) – Radius of allowable curve in directional coupler in nm. Defaults to 5000.
  • maxiter (int, optional) – The number of max iterations to run each of the gloabl and local optimization for. If None, doesn’t apply. Defaults to None.
  • verbose (int, optional) – Amount of logging to output. If 0, none. If 1, tqdm bar. If 2, prints all information (can be cumbersome). Defaults to 0.
Returns:

  • coupler (GapFuncSymmetric) – The final coupler object from SCEE
  • control_pts (ndarray) – The control points defining bezier curve for gap function (nm)
  • length (ndarray) – The length of the coupler (nm)

Saving Couplers

SiPANN.scee_opt.save_coupler(width, thickness, control_pts, length, filename)

Used to save optimized couplers efficiently.

When used only saves gap points and coupling length into a .npz file. This allows for easy reloading via the functions below.

Parameters:
  • width (float) – Width of the waveguide in nm
  • thickness (float) – Thickness of the waveguide in nm
  • control_pts (ndarray) – Gap points defining gap function via bernstein polynomials. Second parameter returned by make_coupler.
  • length (float) – Length of corresponding coupler. Third parameter returned by make_coupler
  • filename (string) – Name of file to write to.

Loading Couplers

SiPANN.scee_opt.load_coupler(filename)

Used to load optimized couplers efficiently.

Any coupler saved using the save_coupler function can be reloaded using this one. It will return an instance of SiPANN.scee.GapFuncSymmetric.

Parameters:filename (string) – Location where file is stored.
Returns:
  • coupler (GapFuncSymmetric) – Saved coupler
  • length (float) – Length of coupler

Premade Couplers

SiPANN.scee_opt.premade_coupler(split)

Loads premade couplers.

Various splitting ratio couplers have been made and saved. This function reloads them. Note that each of their lengths are different and are also returned for the users info. These have all been designed with waveguide geometry 500nm x 220nm.

Parameters:split (int) – Percent of light coming out cross port. Valid numbers are 10, 20, 30, 40, 50, 100. 100 is a full crossover.
Returns:
  • coupler (GapFuncSymmetric) – Designed Coupler
  • length (float) – Length of coupler

Helper Functions

Bernstein Transformation

SiPANN.scee_opt.bernstein_quick()

Quickly computes the jth bernstein polynomial for the basis of n+1 polynomials.

Parameters:
  • n (int) – The number of elements minus one in the basis of berstein polynomials
  • j (int) – The index of bernstein polynomial that needs to be computed
  • t (float) – [0-1] the value at which to compute the polynomial
Returns:

test – Result of computing the jth berstein polynomial at t

Return type:

float

Bezier Function

SiPANN.scee_opt.bezier_quick(g, length)

Computes the bezier curve for the evenly spaced control points with gaps g.

Parameters:
  • g (ndarray) – Numpy array of size (n,) of gap values at each of the control points
  • length (float) – length of the coupler
Returns:

result – {‘g’: original control points, ‘w’: length of coupler, ‘f’: bezier curve function defining gap function, ‘df’: derivative of gap function, ‘d2f’: 2nd derivative of gap functions}

Return type:

dict