Fix model lookup for numbered component variants#121
Closed
jackgdsf wants to merge 1 commit into
Closed
Conversation
gdsfactory's CountedNetlistNamer appends numeric suffixes (e.g. coupler2, coupler3) to deduplicate cell names in recursive netlists. SAX's strict dict lookup failed for these variants, causing them to silently degrade to layout-extracted sub-netlists instead of using the analytical model. Add _strip_counted_suffix() to fall back to the base model name when the exact numbered name isn't found. Applied to DAG construction, model validation, the main circuit build loop, and the flat circuit builder. Closes gdsfactory#120 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
Closing per Mark's request — leaving the approach to Floris. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_strip_counted_suffix()helper that strips trailing numeric suffixes (e.g.coupler2→coupler) added by gdsfactory'sCountedNetlistNamerin recursive netlistsCloses #120
Test plan
test_numbered_component_variants: recursive netlist withcoupler/coupler2andwaveguide/waveguide2— all resolve to base modeltest_numbered_variant_explicit_model_takes_priority: explicitwaveguide2model is used directly, not stripped🤖 Generated with Claude Code