Components
QNS.components holds every optical device plus the simulation clock. All of
them are re-exported from the subpackage:
from QNS.components import (Timeline, Laser, HalfWavePlate, QuarterWavePlate,
LinearPolarizer, PhaseShifter, BeamSplitter,
PolarisingBeamSplitter, Detector)
Overview
Class |
In |
Out |
Role |
|---|---|---|---|
0 |
1 |
Pulsed source with Poissonian photon number per pulse. |
|
0 |
2 |
SPDC pair source; polarisation-entangled signal and idler arms. |
|
1 |
1 |
Rotates linear polarisation about a fast axis at |
|
1 |
1 |
Converts between linear and circular polarisation. |
|
1 |
1 |
Projects onto |
|
1 |
1 |
Applies \(e^{i\phi}\) to one mode, both polarisations. |
|
2 |
2 |
Non-polarising splitter with adjustable transmittance. |
|
2 |
2 |
Routes H one way and V the other. |
|
1 |
0 |
Single-photon detector with dead time, jitter, dark counts. |
Common constructor signature
Every optical component starts with the same three arguments:
Component(uID, env, stateManager, **device_parameters)
uIDA unique string. It shows up in the result dictionary for detectors, in error messages, and in the generated IDs of photon objects downstream of splitters. Keep them distinct.
envThe
simpy.Environment, alwaystimeline.env.stateManagerThe single
StateManagerfor the experiment.
Both env and stateManager are checked for None and raise
ValueError if missing. Device parameters are range-checked in the
constructor, so an out-of-range angle or efficiency fails immediately rather
than producing quiet nonsense later.
Common instance methods
- receive(qc, p)
Called by a channel when a photon arrives.
qcis the channel it arrived on (used by two-input components to identify the port);pis the photon object. Transforms the pulse’s quantum state and forwards the photon onto the outgoing channel. Not called by user code.
- set_receiver(receiver=None, port=None)
Registers an outgoing channel on
port. RaisesTypeErrorfor an invalid port. Called for you bychannel.connect_channel.
- set_sender(sender=None, port=None)
Registers an incoming channel on
port. Same contract as above.
You should not call set_receiver or set_sender yourself - use
connect_channel so both ends of the link stay consistent.