Multiport-Interferometer
This library provides a set of tools for designing multiport interferometer photonic circuits to emulate unitary transformations. Includes generation of complete circuit gds layout and steady-state power and phase simulations of multiport interferometers.
Some of the functionalities of the library:
1. Bell type interferometer:
- Schematic Logic Simulation
- Automated GDS Layout construction
- Physical Circuit Simulation (Emulates unitary transformations)
2. Clements type inteferometer:
- Schematic Logic Simulation
- Build Circuit Simulation
The library accepts custom files for circuit building blocks gds components and physical simulation models.
Uses GDSfactory for gds file processing and SAX for S-parameter simulations.
This library is part of the Open Source P.I.C Design Workflow Tutorial.
For complete documentation check out Tutorial.
Supporting notebooks:
Installation
pip install multiport-interferometer
Import:
import multiport_interferometer as mi
Usage example
Bell Interferometer Logic Simulation:
import multiport_interferometer as mi
from scipy.stats import unitary_group
import numpy as np
import sax
dimension = 58
U_target = unitary_group(dim=dimension).rvs()
results = mi.decompose_bell(U_target)
mods = mi.ideal_bell_models(results)
netlist = mi.bell_circuit_schematic(dimension)
circuit, info = sax.circuit(netlist=netlist, models = mods)
S = circuit() #returns a sax S-dict object
S_mat = mi.sdict_to_matrix(S) #converts the sax sdict to a numpy matrix
print('Circuit Matches Target Matrix =', np.allclose(U_target, S_mat))
Circuit Matches Target Matrix = True
Bell Interferometer Physical SImulation:
dim = 5
mymesh = mi.Bell(dim)
U_target = unitary_group(dim).rvs()
S = mymesh.emulate(U_target)
S_mat = mi.sdict_to_matrix(S)
corrected = mymesh.phase_corrected(S)
print('Maximum Magnitude Error % =', np.max((abs(abs(S_mat)-abs(U_target)))*100/abs(S_mat)))
print('Maximum Phase Error = % ', np.max(np.angle(corrected/U_target)*100/np.pi))
mymesh.gds().plot()
Maximum Magnitude Error % = 9.225697420182325
Maximum Phase Error % = 8.080086688873948
Clements Interferometer Logic Simulation
mesh = mi.Clements(dim)
U = unitary_group.rvs(dim)
simulation_result = mi.sdict_to_matrix(mesh.ideal_emulate(U))
print('Circuit Matches Target Matrix =', np.allclose(U, simulation_result))
Circuit Matches Target Matrix = True
Development setup
Install development dependencies:
pip install -e ".[dev]"
Run tests:
pytest
Contributing
Contributions are welcome, please open an issue or pull request.
Metadata
Release files for multiport-interferometer 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| multiport_interferometer-0.0.13.tar.gz | 20.5 kB | With provenance | Details for multiport_interferometer-0.0.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| multiport_interferometer-0.0.13-py3-none-any.whl | Python 3 | none | any | Details for multiport_interferometer-0.0.13-py3-none-any.whl |
Total release size: 44.2 kB
Release files / multiport_interferometer-0.0.13.tar.gz
| Download URL | multiport_interferometer-0.0.13.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
647e1042581c9df2742eec2bca959b38399af4db3102b6ac39e5d33179f313f1
|
|
BLAKE2b-256 checksum How to use checksums |
df7a19c50a8a174c5670fd0e5579aad09aeecd2f87eeccbcb48badbc9c08d3ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logRelease files / multiport_interferometer-0.0.13-py3-none-any.whl
| Download URL | multiport_interferometer-0.0.13-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64647feb0b17f458188bc996c3b4660acf9b1bd43b188da4601f8542c7fc6197
|
|
BLAKE2b-256 checksum How to use checksums |
a41554e06decefd07408db4b390434f60a045144d6fb38e9850ef91b6923c07f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logSecurity for multiport-interferometer 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for multiport_interferometer-0.0.13.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.