Skip to content

Fix make_polycone length check to catch a single mismatched radius array#10

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/119-polycone-length-check
Jun 21, 2026
Merged

Fix make_polycone length check to catch a single mismatched radius array#10
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/119-polycone-length-check

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

The guard used not len(iradius) == nplanes and not len(oradius) == nplanes — it only raised when both radius arrays were wrong. The common case (exactly one array with the wrong length) slipped through and produced a malformed parameter string. Use or so either mismatch raises.

Validation: with 3 zplanes, a single wrong array (2/3 or 3/2) now errors; matching arrays still pass (Python 3.12).

Fixes #4

The guard used `not len(iradius) == nplanes and not len(oradius) ==
nplanes`, i.e. (iradius wrong) AND (oradius wrong) — it only raised when
BOTH arrays were wrong. The common case, exactly one array having the
wrong length, slipped through and produced a malformed parameter string.
Use `or` so either mismatch raises.

Verified: with 3 zplanes, a single wrong array (2/3 or 3/2) now errors;
matching arrays still pass (Python 3.12).

Fixes gemc#4
@maureeungaro maureeungaro merged commit ff90d25 into gemc:main Jun 21, 2026
2 checks passed
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.

[High] make_polycone() length check uses and instead of or, missing single-array mismatches

2 participants