Skip to content

Fix metre suffix conversion in length values - #91

Merged
PP501 merged 1 commit into
sqdlab:mainfrom
davrens101:fix/metre-length-suffix
Nov 9, 2026
Merged

PP501 merged 1 commit into
sqdlab:mainfrom
davrens101:fix/metre-length-suffix

Conversation

@davrens101

@davrens101 davrens101 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

QUtilities.parse_value_length checks for a one-character m suffix but removes two characters. With actual SQDMetal imports, 5m raises ValueError, 10m becomes 1.0, and fractional metre values lose a digit. This affects consumers normalizing design lengths to SI units.

Fix

Remove only the metre suffix, retain the more-specific prefixed-unit branches, and keep unsupported units unchanged as documented. Add regressions for integer/fractional/spaced metre values, existing prefixed units, numeric inputs and unsupported units; clarify the existing parser docstring.

Verification

  • Before: 5m raises; 10m == 1.0; 1mm == 0.001.
  • After: 5m == 5.0, 10m == 10.0, 0.5m == 0.5, 2.5 m == 2.5; 1mm unchanged.
  • Four parser tests pass. The combined targeted parser/LC/existing gallery and Xmon-design run passed 11 tests, with two dependency deprecation warnings.
  • Independent read-only AI review found no code blocker. Actual normal package imports and calculator calls were exercised on Windows/Python 3.11, NumPy 2.2.6/SciPy 1.17.1; no external EM solver or full-suite claim.

Review and assistance

I supervised and checked the AI-assisted work as it progressed. AI assistance was used for investigation, implementation and verification. No maintainer review or approval is claimed. Verification was CPU-only; no GPU validation is claimed.

@PP501

PP501 commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

This is an obscure case as most users don't use m. But it's worth adding it in... Also, good to get the unit-tests for QUtilities started.

@PP501
PP501 merged commit 282a283 into sqdlab:main Nov 9, 2026
1 of 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.

2 participants