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 = Clements(dim)
U = unitary_group.rvs(dim)
simulation_result = 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.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| multiport_interferometer-0.0.12.tar.gz | 20.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multiport_interferometer-0.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.2 kB
Release files / multiport_interferometer-0.0.12.tar.gz
| Download URL | multiport_interferometer-0.0.12.tar.gz |
|---|---|
| Size | 20.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86d1e3d0980951165549aa49b25efb70c29df3e5a1c368139e86e657b91424a2
|
|
BLAKE2b-256 checksum How to use checksums |
855386147ad8cb104fe65c3aeb137180c5400daae6644dd08c12f99f4ccff6f8
|
| 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.12-py3-none-any.whl
| Download URL | multiport_interferometer-0.0.12-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c0baaf7006cbf5f2c9b882700a90640b05030329f9c6961d6ead06a42b65f46
|
|
BLAKE2b-256 checksum How to use checksums |
9b80cef01e87437ed4341c6781992c4c4013aaf550626fce22eb23cf2350110c
|
| 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 log