{ "cells": [ { "cell_type": "markdown", "source": [ "# Components" ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "Every simulation model is constructed from a set of Component objects that are connected together in a quantum input-output network. Components can be categorised into three groups: sources, circuits, and detectors.\n", "\n", "Each of the three types of components has an associated factory class: Source, Circuit, and Detector. These classes can be used to create catalogue components---components that are pre-built and tested according to verified models. Although it is possible to instantiate components from scratch, as explained in [Component Construction](component_construction.ipynb), it is much easier to use the catalogue components if possible. For a list of the current catalogue source models, please see [Sources](sources_catalogue.ipynb); for the basic circuit components, please see [Circuits](circuits_catalogue.ipynb); and for the available detector types please see [Detectors](detectors_catalogue.ipynb).\n", "\n", "All components can be parameterised. This means that their physical models can include parameters that can be modified to alter the model behaviour. Parameters can be set when instantiating components, or they can be altered when simulating properties of the component. For more on how to set and manipulate parameters, please see [Parameters](parameters.ipynb).\n", "\n", "Any component can be composed with other components to form new components, as demonstrated below. This modular approach allows for a small set of catalogue components to capture a wide range of experimental configurations. If a particular component proves to be popular, future updates may see the component added as a catalogue component by expanding the appropriate factory class.\n", "\n", "Most often, components are combined by adding them to a single processor. This processor is used to solve for probabilities, source quantum states, and conditional quantum channels associated with photonic measurements. Please see [Processors](processors.ipynb) for an introduction on the Processor object." ], "metadata": { "collapsed": false } }, { "cell_type": "markdown", "source": [ "## Combining Components" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 6, "outputs": [], "source": [ "from zpgenerator import *" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-02-13T23:24:28.127297Z", "start_time": "2024-02-13T23:24:28.110577Z" } } }, { "cell_type": "markdown", "source": [ "As an example, we can create a new source component by adding a beam splitter to a source producing a Fock $|2\\rangle$ state. The source of Fock states can be created using the Source class's fock() method." ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 7, "outputs": [], "source": [ "source = Source.fock(2)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-02-13T23:24:28.135986Z", "start_time": "2024-02-13T23:24:28.114974Z" } } }, { "cell_type": "markdown", "source": [ "This source produces ideal two-photon pulses of light, which we can verify by computing and displaying the photon statistics of the source." ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 8, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number | Probability\n", "0 | 0.00000\n", "1 | 0.00000\n", "2 | 1.00000\n", "3 | 0.00000\n", "4 | 0.00000\n", "5 | 0.00000\n", "6 | 0.00000\n", "\n" ] } ], "source": [ "source.photon_statistics().display()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-02-13T23:24:28.150436Z", "start_time": "2024-02-13T23:24:28.121391Z" } } }, { "cell_type": "markdown", "source": [ "Now, we can modify our source by adding a beam splitter to its output mode." ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 9, "outputs": [], "source": [ "source.add(0, Circuit.bs()) # specify we add to mode 0 of the source (the only mode in this case)" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-02-13T23:24:28.154682Z", "start_time": "2024-02-13T23:24:28.152086Z" } } }, { "cell_type": "markdown", "source": [ "Since a beam splitter has two input modes and two output modes, the second input mode is automatically assumed to be in the vacuum state. Taking a look at the photon statistics, which looks again at mode 0 by default, we can see that the beam splitter drastically modified the photon number probabilities." ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 10, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number | Probability\n", "0 | 0.25000\n", "1 | 0.50000\n", "2 | 0.25000\n", "3 | 0.00000\n", "4 | 0.00000\n", "\n" ] } ], "source": [ "source.photon_statistics().display()" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2024-02-13T23:24:28.195172Z", "start_time": "2024-02-13T23:24:28.156571Z" } } } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 0 }