Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add models for lattice #107

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

add models for lattice #107

wants to merge 1 commit into from

Conversation

joamatab
Copy link
Contributor

@joamatab joamatab commented Mar 19, 2025

Summary by Sourcery

Adds a new mzi_lattice_sc cell and a corresponding example script for circuit simulation. Updates coupler models.

New Features:

  • Introduces a mzi_lattice_sc cell, a Mach-Zehnder interferometer lattice structure, to the cspdk.si220.cells.primitives module.
  • Adds a new example script, circuit_lattice.py, to demonstrate circuit simulation of the mzi_lattice_sc cell.

@joamatab joamatab marked this pull request as draft March 19, 2025 03:30
Copy link

sourcery-ai bot commented Mar 19, 2025

Reviewer's Guide by Sourcery

This pull request introduces a new mzi_lattice_sc cell for creating MZI lattices, updates the coupler models to use sm.coupler, and provides a sample script for simulating the MZI lattice. The mzi_lattice_sc cell simplifies the creation of MZI lattices by pre-configuring an MZI with lattice-specific settings. The update to coupler models ensures the use of the correct simulation model. The circuit_lattice.py script demonstrates how to simulate the new cell.

Sequence diagram for simulating the MZI lattice

sequenceDiagram
    participant circuit_lattice.py
    participant cells.mzi_lattice
    participant PDK.models
    participant sax.circuit
    participant circuit

    circuit_lattice.py->>cells.mzi_lattice: cells.mzi_lattice(delta_length=10)
    circuit_lattice.py->>PDK.models: models = PDK.models
    circuit_lattice.py->>sax.circuit: circuit, _ = sax.circuit(netlist, models=models)
    circuit_lattice.py->>circuit: S = circuit(wl=wl)
Loading

Class diagram for the new mzi_lattice_sc cell

classDiagram
    class mzi_lattice_sc{
        +delta_length: float
        +bend: str
        +straight: str
        +splitter: str
        +combiner: str
        +cross_section: CrossSectionSpec
        +gf.Component mzi_lattice_sc()
    }
    note for mzi_lattice_sc "New cell for creating MZI lattices"
Loading

File-Level Changes

Change Details Files
Added a new cell mzi_lattice_sc for creating a Mach-Zehnder interferometer (MZI) lattice.
  • Defined a new mzi_lattice_sc cell that instantiates an MZI with specific parameters.
  • The cell takes parameters such as delta_length, bend, straight, splitter, combiner, and cross_section to customize the MZI.
  • It uses the existing gf.c.mzi component as a building block, pre-configuring it with specific port names and other settings suitable for lattice applications.
cspdk/si220/cells/primitives.py
Updated the coupler_sc, coupler_rc, coupler_so, and coupler_ro models to use sm.coupler instead of sm.mmi2x2.
  • Replaced sm.mmi2x2 with sm.coupler in the definitions of coupler_sc, coupler_rc, coupler_so, and coupler_ro models.
  • This change likely reflects a correction or update in the preferred model for couplers within the PDK.
cspdk/si220/models.py
Added a new sample script circuit_lattice.py to demonstrate circuit simulation of the MZI lattice.
  • Created a new file circuit_lattice.py.
  • The script instantiates the mzi_lattice cell.
  • It performs a circuit simulation using sax and plots the transmission spectrum.
  • The script showcases how to use the new mzi_lattice cell in a circuit simulation workflow.
cspdk/si220/samples/circuit_lattice.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the enhancement New feature or request label Mar 19, 2025
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant