Name | semiconductor-sim JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | A simulation library for basic semiconductor devices aimed at undergraduates. |
upload_time | 2025-09-14 20:38:33 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT License
Copyright (c) 2025 Michael Kennedy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
semiconductor
devices
pn-junction
led
solar-cell
zener
mos
education
simulation
|
VCS |
 |
bugtrack_url |
|
requirements |
numpy
matplotlib
scipy
plotly
ipywidgets
joblib
streamlit
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# SemiconductorSim
SemiconductorSim is an open-source Python library designed to simulate
fundamental semiconductor devices, making complex semiconductor physics
accessible to undergraduate students. Accompanied by interactive tutorials
and comprehensive examples, this library serves as a valuable educational tool
for students, educators, and enthusiasts in the fields of electronics and
semiconductor engineering.
[](https://github.com/kennedym-ds/semiconductor_sim/actions/workflows/ci.yml?query=branch%3Amain)
[](https://github.com/kennedym-ds/semiconductor_sim/actions/workflows/codeql.yml?query=branch%3Amain)
<!-- PyPI badge hidden until first release
[](https://pypi.org/project/semiconductor-sim/)
-->

[](LICENSE)
[](https://app.codecov.io/gh/kennedym-ds/semiconductor_sim)
[](https://kennedym-ds.github.io/semiconductor_sim/)
## 🧭 Table of Contents
- Installation
- Features
- Supported Devices
- Quickstart
- Examples & Docs
- Units & Conventions
- Interactive Notebooks
- Development
- Troubleshooting
- Contributing
- License
- Releases
## 📚 Features
- PN Junction Diode Simulation: IV, SRH recombination, temperature dependence
- LED Simulation: IV with emission, efficiency model, temperature effects
- Solar Cell Simulation: IV under illumination, short/open-circuit conditions
- Tunnel, Varactor, Zener, MOS Capacitor: teaching-focused models and plots
- Interactive Visualizations: Jupyter widgets and Plotly/Matplotlib support
- Documentation: API references, tutorials, and example scripts
## 🧪 Supported Devices
- PN Junction Diode: Ideal diode with SRH recombination and temperature effects.
- LED: Diode IV with emission intensity; simple efficiency model.
- Solar Cell: IV under illumination; short/open-circuit conditions.
- Tunnel Diode: Simplified IV with correct reverse-bias behavior for teaching.
- Varactor Diode: Junction capacitance vs. reverse bias; IV characteristic.
- Zener Diode: Breakdown behavior with optional ML-predicted Zener voltage.
- MOS Capacitor: C–V and I–V characteristics with depletion width model.
## 🔧 Installation
Install from PyPI (recommended):
```bash
pip install semiconductor-sim
```
From source (editable):
```bash
git clone https://github.com/kennedym-ds/semiconductor_sim.git
cd semiconductor_sim
python -m venv .venv
. .venv/Scripts/activate
pip install -U pip
pip install -r requirements.txt
pip install -e .
```
## 🚀 Quickstart
Minimal PN junction example (no plotting required):
```python
import numpy as np
from semiconductor_sim.devices import PNJunctionDiode
diode = PNJunctionDiode(doping_p=1e17, doping_n=1e17, temperature=300)
V = np.array([0.0, 0.2, 0.4])
I, R = diode.iv_characteristic(V, n_conc=1e16, p_conc=1e16)
print("Current:", I)
print("Recombination (SRH):", R)
```
LED quick preview (two-value return when concentrations omitted):
```python
import numpy as np
from semiconductor_sim.devices import LED
led = LED(doping_p=1e17, doping_n=1e17, temperature=300)
V = np.linspace(0, 2, 5)
current, emission = led.iv_characteristic(V)
```
## 📓 Examples & Docs
- Examples: see the `examples/` folder for scripts and Jupyter notebooks
(interactive versions use ipywidgets/plotly).
- API docs: browse module docstrings and examples until hosted docs are added.
## 📐 Units & Conventions
- Length: cm; Area: cm²; Volume: cm³; Charge: C; Capacitance: F.
- Doping and carrier concentrations: cm⁻³.
- Temperature: K (default `DEFAULT_T = 300 K`).
- Constants available via `semiconductor_sim.utils.constants`: `q`, `k_B`,
`epsilon_0`, `DEFAULT_T`.
- Return shapes: device `iv_characteristic` methods return arrays aligned to
the input `voltage_array`. Where scalar recombination is computed, it is
broadcast to match the voltage vector.
## 💡 Interactive Notebooks
- Explore interactive notebooks in `examples/` with Jupyter and ipywidgets.
- Launch Jupyter:
```bash
python -m pip install jupyter ipywidgets
jupyter notebook examples
```
If running on a headless server/CI, plotting uses Matplotlib’s
non-interactive backend automatically inside plotting helpers.
## 🖼️ Plotting Helper (Headless-Safe)
To keep plots consistent and CI-friendly, device plotting functions call
lightweight helpers:
- `semiconductor_sim.utils.plotting.use_headless_backend("Agg")`:
switch to a non-interactive backend before any figures are created.
- `semiconductor_sim.utils.plotting.apply_basic_style()`:
apply minimal, consistent rcParams (grid, sizes, legend).
When writing new scripts that use Matplotlib directly, you can opt-in to the
same behavior:
```python
from semiconductor_sim.utils.plotting import (
use_headless_backend,
apply_basic_style,
)
use_headless_backend("Agg")
apply_basic_style()
import matplotlib.pyplot as plt
# ... your plotting code ...
```
Notes:
- Prefer relying on device `.plot_*` helpers where available.
- Avoid calling `plt.switch_backend` at runtime; set backend via the helper
before any figures are created.
## 🧑💻 Development
Set up a virtual environment and install dev tools:
```bash
python -m venv .venv
. .venv/Scripts/activate
pip install -U pip
pip install -r requirements.txt
pip install -e .
pip install ruff mypy pytest pre-commit
pre-commit install
```
Run checks:
```bash
ruff check .
ruff format --check .
mypy .
pytest -q
```
CI runs Ruff, Mypy, and tests across Python 3.10–3.13 on
Linux/Windows/macOS with coverage thresholds. It includes dependency
review, pip-audit security checks, and CodeQL scanning. Dependabot keeps
GitHub Actions and pip dependencies updated. Publishing to PyPI is
automated on tags `v*.*.*`. See `CHANGELOG.md` for notable changes.
## 🩺 Troubleshooting
- "FigureCanvasAgg is non-interactive" warnings: safe to ignore in headless runs.
- Missing ML model for Zener voltage: library falls back to the configured
default and prints a notice. You can train your own model and place the
`zener_voltage_rf_model.pkl` under `semiconductor_sim/models/` if desired.
- On Windows, ensure you activate the venv before running commands:
```powershell
. .\.venv\Scripts\Activate.ps1
```
## 🤝 Contributing
Contributions are welcome! Please see `CONTRIBUTING.md` for guidelines. Typical flow:
```bash
git checkout -b feature/my-improvement
ruff check . && mypy . && pytest -q
```
Open a PR; CI runs lint, types, tests, CodeQL, and dependency review.
## ✅ Quality Checks
Before opening a PR, run the core checks locally:
```powershell
ruff check .
ruff format --check .
mypy .
pytest -q
```
See the detailed checklist in the PR template:
- `.github/pull_request_template.md`
## 📄 License
This project is licensed under the MIT License — see `LICENSE`.
## 🏷️ Releases
- Versioning: semantic (`MAJOR.MINOR.PATCH`).
- Publishing: push a tag like `v0.1.1` to trigger the publish workflow.
Raw data
{
"_id": null,
"home_page": null,
"name": "semiconductor-sim",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "semiconductor, devices, pn-junction, led, solar-cell, zener, mos, education, simulation",
"author": null,
"author_email": "Michael Kennedy <michael.patrick.kennedy@outlook.ie>",
"download_url": "https://files.pythonhosted.org/packages/5f/5e/fa2b754027a1bb595ba4e61d4b2a0ded1d5c81a9546640042d0e33c46b20/semiconductor_sim-1.0.0.tar.gz",
"platform": null,
"description": "# SemiconductorSim\n\nSemiconductorSim is an open-source Python library designed to simulate\nfundamental semiconductor devices, making complex semiconductor physics\naccessible to undergraduate students. Accompanied by interactive tutorials\nand comprehensive examples, this library serves as a valuable educational tool\nfor students, educators, and enthusiasts in the fields of electronics and\nsemiconductor engineering.\n\n[](https://github.com/kennedym-ds/semiconductor_sim/actions/workflows/ci.yml?query=branch%3Amain)\n[](https://github.com/kennedym-ds/semiconductor_sim/actions/workflows/codeql.yml?query=branch%3Amain)\n<!-- PyPI badge hidden until first release\n[](https://pypi.org/project/semiconductor-sim/)\n-->\n\n[](LICENSE)\n[](https://app.codecov.io/gh/kennedym-ds/semiconductor_sim)\n[](https://kennedym-ds.github.io/semiconductor_sim/)\n\n## \ud83e\udded Table of Contents\n\n- Installation\n- Features\n- Supported Devices\n- Quickstart\n- Examples & Docs\n- Units & Conventions\n- Interactive Notebooks\n- Development\n- Troubleshooting\n- Contributing\n- License\n- Releases\n\n## \ud83d\udcda Features\n\n- PN Junction Diode Simulation: IV, SRH recombination, temperature dependence\n- LED Simulation: IV with emission, efficiency model, temperature effects\n- Solar Cell Simulation: IV under illumination, short/open-circuit conditions\n- Tunnel, Varactor, Zener, MOS Capacitor: teaching-focused models and plots\n- Interactive Visualizations: Jupyter widgets and Plotly/Matplotlib support\n- Documentation: API references, tutorials, and example scripts\n\n## \ud83e\uddea Supported Devices\n\n- PN Junction Diode: Ideal diode with SRH recombination and temperature effects.\n- LED: Diode IV with emission intensity; simple efficiency model.\n- Solar Cell: IV under illumination; short/open-circuit conditions.\n- Tunnel Diode: Simplified IV with correct reverse-bias behavior for teaching.\n- Varactor Diode: Junction capacitance vs. reverse bias; IV characteristic.\n- Zener Diode: Breakdown behavior with optional ML-predicted Zener voltage.\n- MOS Capacitor: C\u2013V and I\u2013V characteristics with depletion width model.\n\n## \ud83d\udd27 Installation\n\nInstall from PyPI (recommended):\n\n```bash\npip install semiconductor-sim\n```\n\nFrom source (editable):\n\n```bash\ngit clone https://github.com/kennedym-ds/semiconductor_sim.git\ncd semiconductor_sim\npython -m venv .venv\n. .venv/Scripts/activate\npip install -U pip\npip install -r requirements.txt\npip install -e .\n```\n\n## \ud83d\ude80 Quickstart\n\nMinimal PN junction example (no plotting required):\n\n```python\nimport numpy as np\nfrom semiconductor_sim.devices import PNJunctionDiode\n\ndiode = PNJunctionDiode(doping_p=1e17, doping_n=1e17, temperature=300)\nV = np.array([0.0, 0.2, 0.4])\nI, R = diode.iv_characteristic(V, n_conc=1e16, p_conc=1e16)\nprint(\"Current:\", I)\nprint(\"Recombination (SRH):\", R)\n```\n\nLED quick preview (two-value return when concentrations omitted):\n\n```python\nimport numpy as np\nfrom semiconductor_sim.devices import LED\n\nled = LED(doping_p=1e17, doping_n=1e17, temperature=300)\nV = np.linspace(0, 2, 5)\ncurrent, emission = led.iv_characteristic(V)\n```\n\n## \ud83d\udcd3 Examples & Docs\n\n- Examples: see the `examples/` folder for scripts and Jupyter notebooks\n (interactive versions use ipywidgets/plotly).\n- API docs: browse module docstrings and examples until hosted docs are added.\n\n## \ud83d\udcd0 Units & Conventions\n\n- Length: cm; Area: cm\u00b2; Volume: cm\u00b3; Charge: C; Capacitance: F.\n- Doping and carrier concentrations: cm\u207b\u00b3.\n- Temperature: K (default `DEFAULT_T = 300 K`).\n- Constants available via `semiconductor_sim.utils.constants`: `q`, `k_B`,\n `epsilon_0`, `DEFAULT_T`.\n- Return shapes: device `iv_characteristic` methods return arrays aligned to\n the input `voltage_array`. Where scalar recombination is computed, it is\n broadcast to match the voltage vector.\n\n## \ud83d\udca1 Interactive Notebooks\n\n- Explore interactive notebooks in `examples/` with Jupyter and ipywidgets.\n- Launch Jupyter:\n\n```bash\npython -m pip install jupyter ipywidgets\njupyter notebook examples\n```\n\nIf running on a headless server/CI, plotting uses Matplotlib\u2019s\nnon-interactive backend automatically inside plotting helpers.\n\n## \ud83d\uddbc\ufe0f Plotting Helper (Headless-Safe)\n\nTo keep plots consistent and CI-friendly, device plotting functions call\nlightweight helpers:\n\n- `semiconductor_sim.utils.plotting.use_headless_backend(\"Agg\")`:\n switch to a non-interactive backend before any figures are created.\n- `semiconductor_sim.utils.plotting.apply_basic_style()`:\n apply minimal, consistent rcParams (grid, sizes, legend).\n\nWhen writing new scripts that use Matplotlib directly, you can opt-in to the\nsame behavior:\n\n```python\nfrom semiconductor_sim.utils.plotting import (\n use_headless_backend,\n apply_basic_style,\n)\nuse_headless_backend(\"Agg\")\napply_basic_style()\n\nimport matplotlib.pyplot as plt\n# ... your plotting code ...\n```\n\nNotes:\n\n- Prefer relying on device `.plot_*` helpers where available.\n- Avoid calling `plt.switch_backend` at runtime; set backend via the helper\n before any figures are created.\n\n## \ud83e\uddd1\u200d\ud83d\udcbb Development\n\nSet up a virtual environment and install dev tools:\n\n```bash\npython -m venv .venv\n. .venv/Scripts/activate\npip install -U pip\npip install -r requirements.txt\npip install -e .\npip install ruff mypy pytest pre-commit\npre-commit install\n```\n\nRun checks:\n\n```bash\nruff check .\nruff format --check .\nmypy .\npytest -q\n```\n\nCI runs Ruff, Mypy, and tests across Python 3.10\u20133.13 on\nLinux/Windows/macOS with coverage thresholds. It includes dependency\nreview, pip-audit security checks, and CodeQL scanning. Dependabot keeps\nGitHub Actions and pip dependencies updated. Publishing to PyPI is\nautomated on tags `v*.*.*`. See `CHANGELOG.md` for notable changes.\n\n## \ud83e\ude7a Troubleshooting\n\n- \"FigureCanvasAgg is non-interactive\" warnings: safe to ignore in headless runs.\n- Missing ML model for Zener voltage: library falls back to the configured\n default and prints a notice. You can train your own model and place the\n `zener_voltage_rf_model.pkl` under `semiconductor_sim/models/` if desired.\n- On Windows, ensure you activate the venv before running commands:\n\n```powershell\n. .\\.venv\\Scripts\\Activate.ps1\n```\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! Please see `CONTRIBUTING.md` for guidelines. Typical flow:\n\n```bash\ngit checkout -b feature/my-improvement\nruff check . && mypy . && pytest -q\n```\n\nOpen a PR; CI runs lint, types, tests, CodeQL, and dependency review.\n\n## \u2705 Quality Checks\n\nBefore opening a PR, run the core checks locally:\n\n```powershell\nruff check .\nruff format --check .\nmypy .\npytest -q\n```\n\nSee the detailed checklist in the PR template:\n\n- `.github/pull_request_template.md`\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License \u2014 see `LICENSE`.\n\n## \ud83c\udff7\ufe0f Releases\n\n- Versioning: semantic (`MAJOR.MINOR.PATCH`).\n- Publishing: push a tag like `v0.1.1` to trigger the publish workflow.\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Michael Kennedy\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "A simulation library for basic semiconductor devices aimed at undergraduates.",
"version": "1.0.0",
"project_urls": {
"Bug-Tracker": "https://github.com/kennedym-ds/semiconductor_sim/issues",
"Changelog": "https://github.com/kennedym-ds/semiconductor_sim/blob/main/CHANGELOG.md",
"Documentation": "https://kennedym-ds.github.io/semiconductor_sim/",
"Homepage": "https://github.com/kennedym-ds/semiconductor_sim",
"Repository": "https://github.com/kennedym-ds/semiconductor_sim"
},
"split_keywords": [
"semiconductor",
" devices",
" pn-junction",
" led",
" solar-cell",
" zener",
" mos",
" education",
" simulation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1b7a39cd07bbd3aaabedec424da1e27a1fe4a29f37ad9a9633e410cb9b3664a7",
"md5": "eec279e43e4341c3351a5833c4239c7b",
"sha256": "d0464e3eb53bdf4dc202cc51783bbe74972760bf8abc7911737468eb7a11b4b0"
},
"downloads": -1,
"filename": "semiconductor_sim-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eec279e43e4341c3351a5833c4239c7b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 37408,
"upload_time": "2025-09-14T20:38:32",
"upload_time_iso_8601": "2025-09-14T20:38:32.202025Z",
"url": "https://files.pythonhosted.org/packages/1b/7a/39cd07bbd3aaabedec424da1e27a1fe4a29f37ad9a9633e410cb9b3664a7/semiconductor_sim-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5f5efa2b754027a1bb595ba4e61d4b2a0ded1d5c81a9546640042d0e33c46b20",
"md5": "a2e191934befe9acd7b85eccff47cc89",
"sha256": "f676204bdc00b948694e5a3162deb47c6d07bb242b99568ed9f186d9084793a0"
},
"downloads": -1,
"filename": "semiconductor_sim-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a2e191934befe9acd7b85eccff47cc89",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 32199,
"upload_time": "2025-09-14T20:38:33",
"upload_time_iso_8601": "2025-09-14T20:38:33.456587Z",
"url": "https://files.pythonhosted.org/packages/5f/5e/fa2b754027a1bb595ba4e61d4b2a0ded1d5c81a9546640042d0e33c46b20/semiconductor_sim-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-14 20:38:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kennedym-ds",
"github_project": "semiconductor_sim",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "scipy",
"specs": []
},
{
"name": "plotly",
"specs": []
},
{
"name": "ipywidgets",
"specs": []
},
{
"name": "joblib",
"specs": []
},
{
"name": "streamlit",
"specs": []
}
],
"lcname": "semiconductor-sim"
}