Skip to content

Add gauge_equiv options#499

Draft
kvid wants to merge 10 commits into
wireviz:masterfrom
kvid:fix282
Draft

Add gauge_equiv options#499
kvid wants to merge 10 commits into
wireviz:masterfrom
kvid:fix282

Conversation

@kvid
Copy link
Copy Markdown
Collaborator

@kvid kvid commented May 5, 2026

Avoid gauge equivalents bugs as reported in #282 by enabling the user to select the proper method for computing equivalents that fits the current wire harness.

  1. The current implementation requires Python 3.10+. Either rewrite slightly to support older versions, or change the Wireviz required Python versions.

  2. Find proper default values for the new options. Please test this branch and suggest default values that might be useful for most users.

Alternative 1:

options:
  gauge_equiv:
    show: false
    rounding: nearest
    mm2: 3
    awg: [40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, "00", "000", "0000"]
    match:
      poor: 10
      invalid: 50
  1. Should probably rename Cable.show_equiv to Cable.gauge_equiv for consistency with the new options attribute and to improve code readability. In addition, it removes a conflict with a possible future length_equiv attribute.

  2. Maybe consider also supporting kcmil?

kvid added 3 commits May 2, 2026 10:13
Avoid string operation on a None gauge_unit value.
The same variable can store equivalents for both AWG and mm2, not just AWG.
Avoid gauge equivalents bugs as reported in wireviz#282 by enabling the user to select
the proper method for computing equivalents that fits the current wire harness.
Comment thread src/wireviz/DataClasses.py Outdated

@dataclass
class MatchDeviationPercentage:
"""Match deviation limits in precentage for a poor and invalid match."""
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor typo precentage --> percentage

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for reviewing and catching my typo!

I didn't expect much attention about this PR while it still is a draft, so your message was a nice surprise. 😄

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.

[bug] mm² to AWG tables are inaccurate mm^2 to AWG conversion is wrong defined AWG to mm2 Conversion Error

2 participants