Find optimal resistor configurations using E-series standards
Project description
resistor
Find optimal resistor configurations for a target resistance using E-series standards.
Given a target resistance, this tool finds the best single resistor or two-resistor combination (series or parallel) from the E-series standard values, ranked by how well the tolerance envelope contains the target.
Installation
pip install resistor
Or install from source:
git clone https://github.com/commuted/e-table.git
cd e-table
pip install -e .
Usage
Command Line
# Find configurations for 1580 ohms
resistor 1580
# Supports k (kilo) and M (mega) suffixes
resistor 4.7k
resistor 2.2M
# Show more results
resistor 1580 -n 10
# Use different E-series (E24 instead of E96)
resistor 1580 -e 24
# Use 5% tolerance resistors
resistor 1580 -t 5
# Only show single/series/parallel results
resistor 1580 --single-only
resistor 1580 --series-only
resistor 1580 --parallel-only
Python API
from resistor import (
find_best_resistor_config,
create_table,
create_series_table,
create_parallel_table,
)
# Create lookup tables (do once, reuse for multiple queries)
base_table = create_table(es=96, decades=6, tolerance=0.01)
series_table = create_series_table(base_table)
parallel_table = create_parallel_table(base_table)
# Find best configurations for target
results = find_best_resistor_config(
target=1580,
base_table=base_table,
series_table=series_table,
parallel_table=parallel_table,
n=5
)
for r in results:
print(f"{r['config']}: {r['resistors']} = {r['nominal']}Ω")
How It Works
- Generates E-series values (default E96) across multiple decades with tolerance bounds
- Computes all series combinations: R_total = R1 + R2
- Computes all parallel combinations: R_total = (R1 × R2)/(R1 + R2)
- Scores each configuration by how well the tolerance envelope contains the target
- Returns top-n results sorted by score
The scoring function returns 0 if the target falls within the tolerance envelope, otherwise returns the normalized distance to the nearest bound. A small tiebreaker based on relative error ensures consistent ordering for equal scores.
E-Series Standards
The E-series (IEC 60063) defines preferred number values for electronic components:
| Series | Values/Decade | Typical Tolerance |
|---|---|---|
| E6 | 6 | 20% |
| E12 | 12 | 10% |
| E24 | 24 | 5% |
| E48 | 48 | 2% |
| E96 | 96 | 1% |
| E192 | 192 | 0.5% |
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov=resistor --cov-report=term-missing
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file resistor-0.2.0.tar.gz.
File metadata
- Download URL: resistor-0.2.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36cb70f8d3d376111810d9f1457749401858449f537a0bb6d3da3234c6620d18
|
|
| MD5 |
e34a6cd073c7de375c243468569c954d
|
|
| BLAKE2b-256 |
e39c7410bf409cf301c938d62b67823dd2a7b3b6501b02da7a7c1b9d8e251bad
|
Provenance
The following attestation bundles were made for resistor-0.2.0.tar.gz:
Publisher:
publish.yml on commuted/resistor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resistor-0.2.0.tar.gz -
Subject digest:
36cb70f8d3d376111810d9f1457749401858449f537a0bb6d3da3234c6620d18 - Sigstore transparency entry: 934728183
- Sigstore integration time:
-
Permalink:
commuted/resistor@6d992df61c8f59b7a63e62a4a103e5cfef165c13 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/commuted
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6d992df61c8f59b7a63e62a4a103e5cfef165c13 -
Trigger Event:
release
-
Statement type:
File details
Details for the file resistor-0.2.0-py3-none-any.whl.
File metadata
- Download URL: resistor-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bb2aaeaae0be4eff6c4d956ec5f768e51791f445ae163f6726bdef07705ba97
|
|
| MD5 |
bda5e159d61e1b09caed7e93150fc54f
|
|
| BLAKE2b-256 |
92763e751ae402260c82f03ba89fe414b2522b4c862392d2ab74e6e9636decf9
|
Provenance
The following attestation bundles were made for resistor-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on commuted/resistor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
resistor-0.2.0-py3-none-any.whl -
Subject digest:
5bb2aaeaae0be4eff6c4d956ec5f768e51791f445ae163f6726bdef07705ba97 - Sigstore transparency entry: 934728248
- Sigstore integration time:
-
Permalink:
commuted/resistor@6d992df61c8f59b7a63e62a4a103e5cfef165c13 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/commuted
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6d992df61c8f59b7a63e62a4a103e5cfef165c13 -
Trigger Event:
release
-
Statement type: