{"id":49172530,"url":"https://github.com/suryakantamangaraj/touchstone-python","last_synced_at":"2026-04-24T22:00:48.504Z","repository":{"id":352277971,"uuid":"1214160325","full_name":"suryakantamangaraj/touchstone-python","owner":"suryakantamangaraj","description":"Python library for parsing Touchstone .sNp files in RF/microwave engineering. Provides easy APIs for S‑parameter analysis, integration with NumPy/SciPy, and reproducible workflows for simulation and visualization.","archived":false,"fork":false,"pushed_at":"2026-04-23T06:18:17.000Z","size":140,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-23T21:16:28.554Z","etag":null,"topics":["microwave","network","networkanalyzer","parser","rf","s-parameter","s2p","snp","touchstone"],"latest_commit_sha":null,"homepage":"https://suryaraj.com/touchstone-python/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suryakantamangaraj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"suryakantamangaraj","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2026-04-18T07:39:15.000Z","updated_at":"2026-04-23T06:18:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/suryakantamangaraj/touchstone-python","commit_stats":null,"previous_names":["suryakantamangaraj/touchstone-python"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/suryakantamangaraj/touchstone-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakantamangaraj%2Ftouchstone-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakantamangaraj%2Ftouchstone-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakantamangaraj%2Ftouchstone-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakantamangaraj%2Ftouchstone-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suryakantamangaraj","download_url":"https://codeload.github.com/suryakantamangaraj/touchstone-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakantamangaraj%2Ftouchstone-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32242315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["microwave","network","networkanalyzer","parser","rf","s-parameter","s2p","snp","touchstone"],"created_at":"2026-04-22T20:02:03.520Z","updated_at":"2026-04-24T22:00:48.469Z","avatar_url":"https://github.com/suryakantamangaraj.png","language":"Python","funding_links":["https://github.com/sponsors/suryakantamangaraj"],"categories":[],"sub_categories":[],"readme":"# touchstone.parser\n\n\u003e **A Python library for Touchstone `.sNp` parsing and S‑parameter analysis in RF/microwave engineering.**\n\n[![PyPI](https://img.shields.io/pypi/v/touchstone.parser?style=flat-square\u0026logo=pypi\u0026label=PyPI)](https://pypi.org/project/touchstone.parser/)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/touchstone.parser?style=flat-square\u0026logo=pypi)](https://pypi.org/project/touchstone.parser/)\n[![Build](https://img.shields.io/github/actions/workflow/status/suryakantamangaraj/touchstone-python/ci.yml?branch=main\u0026style=flat-square\u0026logo=github\u0026label=CI)](https://github.com/suryakantamangaraj/touchstone-python/actions/workflows/ci.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/suryakantamangaraj/touchstone-python?style=flat-square\u0026logo=codecov)](https://codecov.io/gh/suryakantamangaraj/touchstone-python)\n[![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue?style=flat-square\u0026logo=github)](https://suryakantamangaraj.github.io/touchstone-python/)\n[![License](https://img.shields.io/github/license/suryakantamangaraj/touchstone-python?style=flat-square)](LICENSE)\n[![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?style=flat-square\u0026logo=python\u0026logoColor=white)](https://python.org/)\n\n**touchstone.parser** is a clean, modular, enterprise-ready Python library for parsing [Touchstone](https://ibis.org/) (`.sNp`) files — the industry-standard format for RF and microwave S‑parameter data. It provides strongly typed classes, LINQ-friendly APIs, and seamless integration into simulation and analysis workflows.\n\n---\n\n## ✨ Features\n\n- **Parse `.sNp` files** into strongly typed Python classes (`TouchstoneData`, `FrequencyPoint`, `NetworkParameter`)\n- **Multi-port support** — 1‑port through N‑port networks\n- **All data formats** — Real/Imaginary (RI), Magnitude/Angle (MA), Decibel/Angle (DB)\n- **All frequency units** — Hz, kHz, MHz, GHz with automatic normalization\n- **All parameter types** — S, Y, Z, H, G\n- **LINQ-friendly APIs** — query S‑parameters with `get_s11(data)`, `get_s21(data)`, `data.get_parameter(r, c)`\n- **RF calculations** — insertion loss, return loss, VSWR out of the box\n- **Export utilities** — CSV export and Touchstone writer for round-trip fidelity\n- **Minimal dependencies** — powered by `numpy` for fast array operations\n\n\n---\n\n## 📦 Installation\n\n```bash\npip install touchstone.parser\n```\n\nOr via the PyPI Package Manager:\n\n```\npip install touchstone.parser\n```\n\n---\n\n## 🚀 Quick Start\n\n```python\nfrom touchstone.parser import TouchstoneParser\n\n# Parse a Touchstone file\ndata = TouchstoneParser.parse(\"filter.s2p\")\n\nprint(f\"Ports: {data.n_ports}\")\nprint(f\"Frequency points: {data.n_freq}\")\n\n# Query S21 insertion loss\nil = data.to_insertion_loss()\nfor f, val in zip(data.frequencies, il):\n    freq_ghz = f / 1e9\n    print(f\"{freq_ghz:.3f} GHz → IL = {val:.2f} dB\")\n\n# Filter to a frequency range\npassband = data.in_frequency_range(2.0e9, 3.0e9)\n\n# Compute VSWR\nvswr = data.to_vswr()\nfor f, val in zip(data.frequencies, vswr):\n    print(f\"VSWR = {val:.3f}\")\n\n# Export to CSV\ndata.to_csv(\"output.csv\")\n```\n\n---\n\n## 📖 API Overview\n\n### Parsing\n\n| Method | Description |\n|--------|-------------|\n| `TouchstoneParser.parse(filepath)` | Parse from a file path |\n| `TouchstoneParser.parse_string(content, n_ports?)` | Parse from a raw string |\n\n### Data Access\n\n| Method | Description |\n|--------|-------------|\n| `data.get_s(to_port, from_port)` | Get S‑parameters across all frequencies |\n| `data.frequency` | All frequency values in Hz |\n| `data.s_parameters` | 3D numpy array of all parameters |\n\n### RF Calculations\n\n| Method | Description |\n|--------|-------------|\n| `data.to_insertion_loss()` | \\|S21\\| insertion loss in dB |\n| `data.to_return_loss()` | \\|S11\\| return loss in dB |\n| `data.to_vswr()` | VSWR from S11 |\n\n### Filtering \u0026 Export\n\n| Method | Description |\n|--------|-------------|\n| `data.in_frequency_range(min_hz, max_hz)` | Filter to frequency range |\n| `data.to_csv(writer)` | Export to CSV file or path |\n| `data.to_csv_string()` | Export to CSV string |\n| `write_snp(data, filepath)` | Write back to Touchstone format |\n\n### Utilities\n\n| Method | Description |\n|--------|-------------|\n| `normalize_frequency(val, unit)` | Convert to Hz |\n| `db_to_mag(db)` | Convert DB to magnitude |\n| `mag_to_db(mag)` | Convert magnitude to DB |\n| `ma_to_complex(mag, deg)` | Create from MA |\n| `db_to_complex(dB, deg)` | Create from DB |\n\n---\n\n## 🏗️ Project Structure\n\n```\ntouchstone-python/\n├── src/\n│   └── touchstone/parser/          # Core library\n│       ├── models/                  # Domain models (enums, data classes)\n│       ├── parsing/                 # Parser engine\n│       └── utilities/               # Converters, extensions, writer\n├── tests/                           # pytest test suite\n├── docs/                            # Sphinx documentation\n├── pyproject.toml                   # Project metadata and dependencies\n└── .github/workflows/               # GitHub Actions CI/CD\n```\n\n---\n\n## 🔧 Supported Formats\n\n| Feature | Supported |\n|---------|-----------|\n| Touchstone v1.0 / v1.1 | ✅ |\n| 1‑port (`.s1p`) | ✅ |\n| 2‑port (`.s2p`) | ✅ |\n| Multi-port (`.s3p`, `.s4p`, ...) | ✅ |\n| Real-Imaginary (RI) | ✅ |\n| Magnitude-Angle (MA) | ✅ |\n| Decibel-Angle (DB) | ✅ |\n| Hz / kHz / MHz / GHz | ✅ |\n| S / Y / Z / H / G parameters | ✅ |\n| Comments and metadata | ✅ |\n| Touchstone v2.0 keywords | 🔜 Planned |\n\n---\n\n## 🧪 Running Tests\n\n```bash\npytest --verbosity normal\n```\n\n---\n\n## 🤝 Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n---\n\n## 💬 Community\n\n- ⭐ **Star this repo** and related RF/microwave projects to help them grow - then mention your project in context to build visibility.\n- 💡 **Share feedback** via [GitHub Discussions](https://github.com/suryakantamangaraj/touchstone-python/discussions) - we'd love to hear how you're using the library, what's working, and what could be better.\n\n---\n\n## 📄 License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\n## 💖 Support \u0026 Funding\n\nIf this library helps you in your RF/microwave engineering work, consider supporting its maintenance and the development of new features:\n- **[Sponsor on GitHub](https://github.com/sponsors/suryakantamangaraj)**\n- ⭐ **Star the project** to help it gain visibility in the engineering community.\n\n---\n\n## 📚 Resources\n\n- [Touchstone File Format Specification (IBIS)](https://ibis.org/)\n- [S-parameter — Wikipedia](https://en.wikipedia.org/wiki/Scattering_parameters)\n- [PyPI Package](https://www.pypi.org/packages/touchstone.parser)\n- [Touchstone .NET Library](https://github.com/suryakantamangaraj/touchstone-dotnet) - check out the .NET version for C#-based workflows.\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made by \u003ca href=\"https://suryaraj.com\"\u003esuryamangaraj\u003c/a\u003e · Built for the RF/microwave engineering community 📡\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuryakantamangaraj%2Ftouchstone-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuryakantamangaraj%2Ftouchstone-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuryakantamangaraj%2Ftouchstone-python/lists"}