Skip to content

refactor: normalize material names to Si/SiO2/SiN/Ge/Al/TiN - #315

Draft
vvahidd wants to merge 1 commit into
mainfrom
normalize-material-names
Draft

refactor: normalize material names to Si/SiO2/SiN/Ge/Al/TiN#315
vvahidd wants to merge 1 commit into
mainfrom
normalize-material-names

Conversation

@vvahidd

@vvahidd vvahidd commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Normalizes material-name string literals across all cspdk sub-PDKs to consistent chemical/element casing: Si, SiO2, SiN, Ge, TiN, Al. This matches the forthcoming pdk-spec material-card library.

Scope of edits (string literals only):

  • material="..." in each sub-PDK tech.py (si220 c/o-band, si340, si500, si_sus, sin200, sin300, ge_on_si): si to Si, sin to SiN, ge to Ge, Aluminum to Al (TiN unchanged).
  • core_material/clad_material in the mode-solver samples: si to Si, sin to SiN, sio2 to SiO2.
  • Notebook sim.materials dict keys (meep_mmi, meep_dc): "si" to "Si".

Also adds a guarded pilot coverage test (tests/test_material_coverage.py) that asserts every sub-PDK LAYER_STACK resolves against pdk_spec.material_cards. It is wrapped in pytest.importorskip("pdk_spec"), so it skips cleanly wherever pdk-spec is not installed (including CI) and runs only once pdk-spec is installed editable into the venv. pdk-spec is intentionally not added to pyproject dependencies.

Summary by Sourcery

Normalize material name literals across sub-PDK layer stacks, samples, and notebooks to match standardized chemical notation and add a guarded material coverage test against pdk_spec.

New Features:

  • Add a pilot material coverage test that checks all sub-PDK LAYER_STACK definitions resolve against pdk_spec.material_cards when pdk_spec is available.

Enhancements:

  • Standardize silicon, silicon nitride, germanium, and aluminum material strings in all sub-PDK tech.py files to canonical names (Si, SiN, Ge, Al).
  • Update mode-solver sample configurations to use normalized core and clad material names (Si, SiO2, SiN).
  • Align notebook simulation material keys with the normalized material naming convention.

Tests:

  • Introduce a pytest-based coverage check that aggregates all sub-PDK layer stacks and fails on any unresolved material names.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@sourcery-ai

sourcery-ai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR standardizes material-name string literals across all cspdk sub-PDKs to match the upcoming pdk-spec material card naming (Si, SiO2, SiN, Ge, Al, TiN) and adds a guarded test that checks each sub-PDK layer stack for full material coverage against pdk_spec.material_cards.

Sequence diagram for guarded material coverage test using pdk_spec

sequenceDiagram
    actor Pytest
    participant test_material_coverage
    participant pdk_spec
    participant si220_cband_tech
    participant si340_tech

    Pytest ->> test_material_coverage: run
    test_material_coverage ->> Pytest: pytest.importorskip(pdk_spec)
    alt pdk_spec not installed
        Pytest -->> test_material_coverage: skip test
    else pdk_spec installed
        test_material_coverage ->> pdk_spec: material_cards
        test_material_coverage ->> si220_cband_tech: get_layer_stack
        test_material_coverage ->> si340_tech: get_layer_stack
        test_material_coverage ->> test_material_coverage: assert layer_stack materials in material_cards
    end
Loading

File-Level Changes

Change Details Files
Normalize material identifiers in mode-solver sample scripts to match pdk-spec casing.
  • Update core_material values from "si" to "Si" in silicon mode-solver samples.
  • Update clad_material values from "sio2" to "SiO2" in silicon mode-solver samples.
  • Update core_material values from "sin" to "SiN" and clad_material from "sio2" to "SiO2" in SiN samples.
cspdk/si220/cband/samples/mode_solver_r.py
cspdk/si220/cband/samples/mode_solver_s.py
cspdk/si220/oband/samples/mode_solver_r.py
cspdk/si220/oband/samples/mode_solver_s.py
cspdk/si500/samples/mode_solver_r500.py
cspdk/sin300/samples/mode_solver_n.py
Normalize material names in sub-PDK layer stack definitions to use canonical chemical/element symbols.
  • Change silicon materials from "si" to "Si" across silicon PDK layer stacks.
  • Change silicon nitride materials from "sin" to "SiN" in nitride PDK layer stacks.
  • Change germanium materials from "ge" to "Ge" in Ge-on-Si layer stacks.
  • Change metal pad material from "Aluminum" to "Al" in relevant PDKs while leaving TiN unchanged.
cspdk/si220/cband/tech.py
cspdk/si220/oband/tech.py
cspdk/si340/tech.py
cspdk/si500/tech.py
cspdk/si_sus/tech.py
cspdk/sin200/tech.py
cspdk/sin300/tech.py
cspdk/ge_on_si/tech.py
Align notebook simulation material keys with normalized material names.
  • Update sim.materials dict keys from "si" to "Si" in meep simulation notebooks to match pdk-spec card names.
docs/notebooks/meep_dc.ipynb
docs/notebooks/meep_mmi.ipynb
Add a guarded pilot test that asserts all sub-PDK layer stacks have full material coverage against pdk_spec.material_cards.
  • Import each sub-PDK LAYER_STACK and aggregate them into a single LAYER_STACKS mapping.
  • Use pytest.importorskip to conditionally import pdk_spec so the test is skipped if pdk-spec is absent (including CI).
  • Call pdk_spec.check_material_coverage for each layer stack, collect missing materials, and fail if any unresolved material names remain.
tests/test_material_coverage.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!

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vvahidd
vvahidd marked this pull request as draft July 25, 2026 05:20
@vvahidd
vvahidd marked this pull request as ready for review July 25, 2026 08:07
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@vvahidd
vvahidd marked this pull request as draft July 25, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant