piel.models.physical.photonic
=============================

.. py:module:: piel.models.physical.photonic


Submodules
----------

.. toctree::
   :maxdepth: 1

   /autoapi/piel/models/physical/photonic/component_lattice_generic/index
   /autoapi/piel/models/physical/photonic/mzi/index
   /autoapi/piel/models/physical/photonic/straight_heater_metal/index
   /autoapi/piel/models/physical/photonic/taper/index
   /autoapi/piel/models/physical/photonic/via_stack/index


Attributes
----------

.. autoapisummary::

   piel.models.physical.photonic.mzi2x2_2x2_phase_shifter
   piel.models.physical.photonic.mzi2x2_2x2


Functions
---------

.. autoapisummary::

   piel.models.physical.photonic.component_lattice_generic
   piel.models.physical.photonic.straight_heater_metal_undercut
   piel.models.physical.photonic.straight_heater_metal_simple


Package Contents
----------------

.. py:function:: component_lattice_generic(network: list[list] | None = None, **kwargs) -> gdsfactory.component.Component

   The shape of the `network` matrix determines the physical interconnection.
   Note that there should be at least S+1=N modes
   based on this formalism of interconnection,
   and the position of the component implements a connectivity in between the modes,
   and assumes a 2x2 network encoding.
   One nice functionality by this component is that it can generate a
   component lattice for generic variable components with different x and y pitches.
   Initially this will maximise the surface area required
   but different placement algorithms can compact the size.

   :param network: A list of lists of components that are to be placed in the lattice.

   :returns: A component lattice that implements the physical network.
   :rtype: Component

   The placement matrix is in this form:
   .. math::

       M = X & 0 & X
           0 & P & 0
           X & 0 & X


   :include-source:
       import gdsfactory as gf
       from gdsfactory.components.mzi import mzi2x2_2x2

       example_component_lattice = [
           [mzi2x2_2x2(), 0, mzi2x2_2x2()],
           [0, mzi2x2_2x2(delta_length=30.0), 0],
           [mzi2x2_2x2(), 0, mzi2x2_2x2()],
       ]
       c = gf.components.component_lattice_generic(example_component_lattice)


   Another example that demonstrates the generic-nature of this component lattice
   algorithm can be with an mixed set of actively driven and passiver interferometers.
   The placement matrix is in this form:

   .. math::

       M = Y & 0 & A
           0 & B & 0
           C & 0 & Y

   :include-source:
       import gdsfactory as gf
       from gdsfactory.components import mzi2x2_2x2_phase_shifter, mzi2x2_2x2

       example_mixed_component_lattice = [
           [mzi2x2_2x2_phase_shifter(), 0, mzi2x2_2x2(delta_length=20.0)],
           [0, mzi2x2_2x2(delta_length=30.0), 0],
           [mzi2x2_2x2(delta_length=15.0), 0, mzi2x2_2x2_phase_shifter()],
       ]
       c = gf.components.component_lattice_generic(
           network=example_mixed_component_lattice
       )

   # TODO implement balanced waveguide paths function per stage
   # TODO automatic electrical fanout?
   # TODO multiple placement optimization algorithms.


.. py:data:: mzi2x2_2x2_phase_shifter

.. py:data:: mzi2x2_2x2

.. py:function:: straight_heater_metal_undercut(length: float = 320.0, length_undercut_spacing: float = 6.0, length_undercut: float = 30.0, length_straight: float = 0.1, length_straight_input: float = 15.0, cross_section: gdsfactory.typings.CrossSectionSpec = 'xs_sc', cross_section_heater: gdsfactory.typings.CrossSectionSpec = 'xs_heater_metal', cross_section_waveguide_heater: gdsfactory.typings.CrossSectionSpec = 'xs_sc_heater_metal', cross_section_heater_undercut: gdsfactory.typings.CrossSectionSpec = 'xs_sc_heater_metal_undercut', with_undercut: bool = True, via_stack: gdsfactory.typings.ComponentSpec | None = 'via_stack_heater_mtop', port_orientation1: int | None = None, port_orientation2: int | None = None, heater_taper_length: float | None = 5.0, ohms_per_square: float | None = None, straight: gdsfactory.typings.ComponentSpec = straight_function) -> gdsfactory.component.Component

   Returns a thermal phase shifter.

   dimensions from https://doi.org/10.1364/OE.27.010456

   :param length: of the waveguide.
   :param length_undercut_spacing: from undercut regions.
   :param length_undercut: length of each undercut section.
   :param length_straight: from where the trenches start to the via_stack.
   :param length_straight_input: from input port to where trenches start.
   :param cross_section: for waveguide connection.
   :param cross_section_heater: for heated sections. heater metal only.
   :param cross_section_waveguide_heater: for heated sections.
   :param cross_section_heater_undercut: for heated sections with undercut.
   :param with_undercut: isolation trenches for higher efficiency.
   :param via_stack: via stack.
   :param port_orientation1: left via stack port orientation.
   :param port_orientation2: right via stack port orientation.
   :param heater_taper_length: minimizes current concentrations from heater to via_stack.
   :param ohms_per_square: to calculate resistance.
   :param straight: straight component.


.. py:function:: straight_heater_metal_simple(length: float = 320.0, cross_section_heater: gdsfactory.typings.CrossSectionSpec = 'xs_heater_metal', cross_section_waveguide_heater: gdsfactory.typings.CrossSectionSpec = 'xs_sc_heater_metal', via_stack: gdsfactory.typings.ComponentSpec | None = 'via_stack_heater_mtop', port_orientation1: int | None = None, port_orientation2: int | None = None, heater_taper_length: float | None = 5.0, ohms_per_square: float | None = None, straight: gdsfactory.typings.ComponentSpec = straight_function) -> gdsfactory.component.Component

   Returns a thermal phase shifter that has properly fixed electrical connectivity to extract a suitable electrical netlist and measurement.
   dimensions from https://doi.org/10.1364/OE.27.010456

   :param length: of the waveguide.
   :param cross_section_heater: for heated sections. heater metal only.
   :param cross_section_waveguide_heater: for heated sections.
   :param via_stack: via stack.
   :param port_orientation1: left via stack port orientation.
   :param port_orientation2: right via stack port orientation.
   :param heater_taper_length: minimizes current concentrations from heater to via_stack.
   :param ohms_per_square: to calculate resistance.
   :param straight: straight component.


