This code simulates a mesh of inteferometers that are used to couple power from an array of optical waveguides to an accelerator on a chip. It provides mechanisms for simulating and controlling these interferometers using various protocols and algorithms.
For more information, see the accomanying paper here. The arxiv preprint is here and included as a pdf.
To use, simply clone this directory and import the DLA_Control/
package into your project.
See examples/
for more details on how to do this.
The code is organized as follows
DLA_Control/
alorithms.py
mesh.py
plots.py
util.py
examples/
Fig4.py
Fig5.py
Fig6.py
mesh_demo.py
optimize_demo.py
phase_fun.py
tests/
test_coupling.py
test_mesh.py
test_MZI.py
The main package is contained in DLA_Control
.
In mesh.py
you will find Mesh
objects that define the MZI mesh and contain all of the relevant transfer matrices.
Currently, Triangular
and Clements
meshes are supported. Printing these Mesh objects prints an ASCII representation of the mesh.
To make a Clements mesh with N ports and M layers and random phase shifter initialization:
mesh = Mesh(N, mesh_type='clements', initialization='random', M=M)
print(mesh)
To make a Triangular mesh with N ports and phase shifter initialized with all zeros (transmission):
mesh = Mesh(N, mesh_type='triangular', initialization='zeros')
print(mesh)
To couple light into the mesh and view the power through the device
input_values = np.random.random((N,))
mesh.input_couple(input_values)
im = plot_powers(mesh)
plt.show()
which will generate a plot like this
For an example see examples/mesh_demo.py
or the methods of Mesh
as defined in DLA_Control/mesh.py
For each Clements
and Triangular
meshes, there is an optimizer class that operates on the mesh, changing its MZI phase shifter settings to optimize for a given input-output relation.
These can be initialized with the input and target (complex-valued) mode amplitudes as
TO = TriangleOptimizer(mesh, input_values=input_values, output_target=output_target)
CO = ClementsOptimizer(mesh, input_values=input_values, output_target=output_target)
Then, one can call the optimize()
method on these optimizers with an algorithm to do the tuning. For example:
CO.optimize(algorithm='smart', verbose=False)
Triangular Optimizers contain up_down
and spread
algorithms. Here's a before and after:
Clements Optimizers contain smart
, smart_seq
(which is the one from the paper), and basic
algorithms.
Read more about these in DLA_Control/algorithms.py
or see examples/optmize_demo.py
for more examples.
plots.py
defines a few plotting functions.
To plot the progression of power within the device:
im = plot_powers(mesh, ax=None)
To make a 3D bar plot of the same image (note, not beautified)
plot_bar_3d(power_map, ax=None)
utils.py
contains helper functions for normalizing vectors and getting powers from complex mode amplitudes.
As explained previously, the examples/
directory contains several examples of this package in use.
Fig{4,5,6}.py
generate the figures in the paper, so you can see how these calculations were performed.
Tests cover the individual MZIs up to the full meshes and the optimization protocols.
To test the individual MZI construction:
python test_MZI.py
To test the Layer
and Mesh
objects:
python test_mesh.py
To test the optimizers
python test_coupling.py
To run all tests:
python -m unittest discover tests
This can take several minutes.
This code is continuously developing and I am open to collaboration. If you have any ideas for new features, or find any bugs, please make an issue or submit a pull request.
Things that would be nice to integrate:
- Incorporate this code with an actual MZI mesh for controlling an experimental demo.
- Simulating effects of noise, drift, fabrication errors, etc.
- Implementing damage / nonlinear constraints. Fancy algorithms for even power distribution within the mesh itself.
If you use this package, please cite us as
@article{PhysRevApplied.11.064014,
title = {Reconfigurable Photonic Circuit for Controlled Power Delivery to Laser-Driven Accelerators on a Chip},
author = {Hughes, Tyler W. and England, R. Joel and Fan, Shanhui},
journal = {Phys. Rev. Applied},
volume = {11},
issue = {6},
pages = {064014},
numpages = {10},
year = {2019},
month = {Jun},
publisher = {American Physical Society},
doi = {10.1103/PhysRevApplied.11.064014},
url = {https://link.aps.org/doi/10.1103/PhysRevApplied.11.064014}
}
This project is licensed under the MIT License - see the LICENSE.md file for details. Copyright 2018 Tyler Hughes.