Skip to content

Add gauge_equiv options - #499

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

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

Conversation

@kvid

@kvid kvid commented May 5, 2026

Copy link
Copy Markdown
Collaborator

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+. Rewrote 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  # digits precision
    awg: ['0000', '000', '00', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
    match:
      poor: 10
      invalid: 50

Alternative 2 - same as alternative 1 above, except listing mm2 values available:

    mm2: ['0.09', '0.14', '0.25', '0.34', '0.5', '0.75', '1', '1.5', '2.5', '4', '6', '10', '16', '25', '35', '50']

These values are just the keys of the old awg_equiv_table. Can someone suggest a more complete set of standard values?

  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?

Note that the initial commit 8dc1219 is not part of this PR, but has its own PR #498 that should be merged before this one.

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. 😄

kvid added 4 commits May 9, 2026 17:19
Bug: Always adding equivalent due to checking presence of equiv object.

Fix: Check the show flag of the object.
@kvid kvid mentioned this pull request May 27, 2026
9 tasks
kvid added 4 commits May 31, 2026 12:51
Bug: Each cable had a default False show value independently of any.
options.gauge_equiv.show value.

Fix: Use empty dict as default value to allow using
options.gauge_equiv.show as default value via gauge_equiv_defaults.
Use keys of the old awg_equiv_table as default values.
- Consistency with the corresponding options attribute.
- Enables a possible future Cable.length_equiv attribute.
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