# μLO

A linear optics simulator in one file. Still a work in progress.

You will need Python27 and numpy

Circuits are described in JSON format. A tool to rapidly design and test circuits is on the way.

```
import linear_optics as lo
from numpy import pi, allclose
phase = pi/2
pairsource = [{"type": "fockstate", "x": 0, "y": 0, "n": 1},
{"type": "fockstate", "x": 0, "y": 1, "n": 1}]
mzi = [{"type": "coupler", "x": 1, "y": 0, "ratio": 0.5},
{"type": "phaseshifter", "x": 2, "y": 0, "phase": phase},
{"type": "coupler", "x": 3, "y": 0, "ratio": 0.5}]
circuit = sps+mzi
compiled_circuit = lo.compile(circuit)
amplitudes = lo.get_amplitudes(**compiled_circuit)
probabilities = lo.get_probabilities(**compiled_circuit)
```