components
¶
The components submodule contains functionality for simulating individual optical components, such as a single
phase shifter, a beamsplitter, or an MZI. Components are combined in a ComponentLayer
,
which describes the arrangement of the components on-chip.
-
class
neuroptica.components.
Beamsplitter
(m: int, n: int)[source]¶ Bases:
neuroptica.components.OpticalComponent
Simulation of a perfect 50:50 beamsplitter
-
class
neuroptica.components.
MZI
(m: int, n: int, theta: float = None, phi: float = None, phase_uncert=0.0)[source]¶ Bases:
neuroptica.components.OpticalComponent
Simulation of a programmable phase-shifting Mach-Zehnder interferometer
-
__init__
(m: int, n: int, theta: float = None, phi: float = None, phase_uncert=0.0)[source]¶ Parameters: - m – first waveguide index
- n – second waveguide index
- theta – phase shift value for inner phase shifter; assigned randomly between [0, 2pi) if unspecified
- phi – phase shift value for outer phase shifter; assigned randomly between [0, 2pi) if unspecified
- phase_uncertainty – optional uncertainty to add to the phase shifters; effective phase is computed as
self.(theta, phi) + np.random.normal(0, self.phase_uncert) if add_uncertainties is set to True during simulation
-
get_partial_transfer_matrices
(backward=False, cumulative=True, add_uncertainties=False) → <MagicMock id='140414712532832'>[source]¶ Compute the partial transfer matrices of each “column” of the MZI – after first beamsplitter, after first phase shifter, after second beamsplitter, and after second phase shifter :param backward: if true, compute the reverse transfer matrices in backward order :param cumulative: if true, each partial transfer matrix represents the total transfer matrix up to that point in the device :param add_uncertainties: whether to include uncertainties in the partial transfer matrix computation :return: numpy array of partial transfer matrices
-
-
class
neuroptica.components.
OpticalComponent
(ports: List[int], tunable: bool = True, dof: int = None, id: int = None)[source]¶ Bases:
object
Base class for an on-chip optical component
-
__init__
(ports: List[int], tunable: bool = True, dof: int = None, id: int = None)[source]¶ Initialize the component
Parameters: - ports (list) – list of ports the component is connected to
- tunable (bool) – whether the component is tunable or static
- dof (int) – number of degrees of freedom the component has
- id (int) – optional identifier for the component
-
__weakref__
¶ list of weak references to the object (if defined)
-
-
class
neuroptica.components.
PhaseShifter
(m: int, phi: float = None)[source]¶ Bases:
neuroptica.components.OpticalComponent
Single-mode phase shifter