Conversation
…dity
Two defects that made target_z0 fail on differential geometries and return
negative impedances on wide asymmetric striplines.
stripline_asymmetric used the IPC-2141A logarithmic form unguarded. That
form is only valid while 8*H_eff/(0.67*pi*(0.8W+T)) > 1; as W grows the
argument falls below 1, the log goes negative, and Z0, L_per_m and C_per_m
all come back negative. The TLineResult validators then rejected the
result, so a caller saw a confusing Pydantic error rather than "this trace
is too wide for this cavity", and the final re-solve in target_z0 died
outright. Raise a descriptive domain error naming the validity limit and
the widest W that satisfies it. The message is ASCII-only: it is raised on
paths that may be printed to a cp1252 console, where a non-ASCII character
would raise a second exception while reporting the first.
target_z0 hardcoded target={"z0": ...}, but a differential solve returns a
DiffResult carrying z_odd/z_even/z_diff/z_common and no z0 at all. Every
candidate therefore missed, the objective returned its 1e6 penalty
everywhere, the cost surface was perfectly flat, and the bounded search
parked at an arbitrary endpoint -- reporting success=False with a null
impedance instead of the actual problem, which is that the requested metric
does not exist for that geometry. Probe-solve the template once and pick
the metric it reports; accept an explicit metric= override.
Fixing the validity guard then exposed a second-order weakness. With wide W
now correctly refused, a default 0.1-100 mil bound can leave the feasible
region confined to the bottom fraction of the interval, and golden-section
samples only the flat penalty slab -- never touching a solvable geometry.
Added a 64-point log-spaced feasibility pre-scan to bracket the search, and
track the best evaluable candidate so the result no longer depends on where
the optimizer happens to stop. optimize_for now raises when nothing inside
the bounds is evaluable, rather than returning a bogus success=False.
Also replaces a docstring example that carried provenance from a specific
design with a neutral worked example.
Tests: 549 passed, 12 skipped (tests/test_web excluded -- needs the `gui`
extra, unrelated to this change).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
RFingAdam
marked this pull request as ready for review
September 10, 2026 01:19
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.
Fresh installs could select MCP 2, breaking FastMCP imports, and CI omitted GUI dependencies required by type checks and web tests. This consolidates the optimizer fixes from #34 with the dependency correction from #35, installs GUI dependencies in both relevant CI jobs, constrains MCP to its supported major version, and fixes the type errors exposed once dependency resolution succeeds.
Full-solver optimization now returns the full-solver result instead of a CGP-only result that could omit the optimized loss metric. The optimizer also validates its public contract before entering SciPy: variables and targets must be present, bounds must be finite and increasing, target values must be finite, and
max_itermust be positive. Regression tests cover the solver result and each invalid-input case.Validation on Windows and Python 3.11: 636 passed, 12 skipped; ruff, Black, focused mypy, and the prior full repository type, Rust, and documentation checks pass. The earlier coverage run measured 82.26%, above the configured 75% gate and below CONTRIBUTING.md's 90% target. The current head is also checked on Linux, macOS, and Windows with Python 3.11, 3.12, and 3.13.
README installation guidance, validation claims, license wording, and release history now match the checked source and contain no personal checkout path. This PR contains #34's commit and supersedes both #34 and #35.