API Reference

Base Cells

Fundamental building blocks of palgds.

class base_cells.PCell(*args: Any, **kwargs: Any)

Bases: Cell

Parametric Cell, a Cell that allows customization with parameters.

The fundamental building block in palgds. PCell is subclassing from gdstk.Cell and it extends the functionality of gdstk.Cell to be used as a parametric cell.

Parameters
  • name (str) – Name of the cell. Should be unique for each cell.

  • ports (dict) – Inputs and outputs of the cell. it is a dict of Port objects.

_create_elements(*args, **kwargs)

Method where elements (polygons, paths, references) of PCell are created.

Parameters
  • args

  • kwargs

Returns

_create_ports(*args, **kwargs)

Method where ports of the PCell are created.

Parameters
  • args

  • kwargs

Returns

class base_cells.Trace(*args: Any, **kwargs: Any)

Bases: PCell

Trace class for optical/electrical routes

To-Do: Directional fix is required for ports.

Parameters
  • name

  • points

  • width

  • offset

  • bend_radius

  • layer

  • datatype

  • port_type

class base_cells.TextCell(*args: Any, **kwargs: Any)

Bases: PCell

Create polygonal text cell

Parameters
  • name

  • text

  • size

  • position

  • vertical

  • layer

  • datatype

class base_cells.GDSCell(*args: Any, **kwargs: Any)

Bases: PCell

Create PCell from GDSII file.

Parameters
  • name

  • filename

  • rename

  • prefix_subcells

  • ports

  • ports_filename

Circuit

class circuit.Circuit(*args: Any, **kwargs: Any)

Bases: PCell

Generates automated layouts of photonic integrated circuits.

Parameters
  • name – Unique name of the cell.

  • pcells – Dict of cells that composes circuit.

  • translations – Dict of translations of each cell.

  • rotations – Dict of rotations of each cell.

  • reflections – Dict of reflections of each cell.

  • links – List of connections, represents the logical connections between the ports. They will be used for creating physical routes in the layout of the circuit.

  • op_trace – Trace template for routes between optical ports.

  • op_bend_radius – Bend radius of optical routes.

  • el_trace – Trace template for routes between electrical ports.

  • el_bend_radius – Bend radius of electrical routes.

Utils

General-purpose utility functions.

utils.apply_transformation(_port, translation=(0, 0), rotation=0, x_reflection=False)

Transforms a port in this order: reflection, rotation and finally translation.

Parameters
  • _port – (x, y, angle)

  • translation – (x, y)

  • rotation – in radians

  • x_reflection – boolean

Returns

transformed raw port

utils.calculate_path_between_two_ports(_port0, _port1, bend_radius)

Calculates the points of path between two port depending on angles of ports and bend radius.

Parameters
  • _port0 – (x, y, angle)

  • _port1 – (x, y, angle)

  • bend_radius

Returns

list of points

utils.read_raw_ports_from_txt_file(filename)

Reads the parameters of ports from txt file.

Note:

Ports in the txt file should be in this format:

(name, xpos, ypos, orientation, port_type)

orientation will be converted to the angle in radians (R:0, L:pi, U:pi, D: 3/2pi) port_type is either ‘op’ for optical ports, or ‘el’ for electrical ports. All ports should be in the first line of txt file. example txt file for ports:

(in,-10,0,L,op) (out1,10,2.5,R,op) (el_in,5,5,U,el)

Parameters

filename – path and file name.

Returns

dict of raw ports.

Technology

class technology.Technology

Class that contains technology data

class technology.WaveguideTrace(*args: Any, **kwargs: Any)

Trace template for optical routes

class technology.WireTrace(*args: Any, **kwargs: Any)

Trace template for electrical routes

PCell Library

PCell library for common photonic components.

class pcell_library.DirectionalCoupler(*args: Any, **kwargs: Any)

Directional coupler cell.

Parameters
  • name

  • Lc

  • gap

  • width

  • Ls

  • y_span

  • layer

  • datatype

  • tolerance

class pcell_library.RingResonator(*args: Any, **kwargs: Any)

Ring resonator cell.

Parameters
  • name

  • radius

  • gap

  • width

  • layer

  • datatype