Package: qsipy
Python package about interferometry using two-mode quantum statesThis package provides functions that return various physical quantities related to interferometry experiments using twin Fock states $|n,n\rangle$ or two-mode squeezed vacuum statesFunctions contained in this package are derived inthis articleDOI:paper published soonQuick context explanationThe scheme of the experiment that we aer considering is represented with the figure below:twin Fockortwo-mode squeezedstates are used asinputin a Mach-Zehnder interferometer ;the detection suffers from anon-unit quantum efficiency$\eta$ ;experimentalists are interested in the measurement of the phase difference $\phi$ between the two arms ;the observable $\hat{O}$ that one use to perform a measurement is thesquareof thehalf differenceof particles detected at both output ports $\hat{c}_1$ and $\hat{c}_2$, whose expectation value is actually thevarianceof thehalf differenceof particles detected (cf. note below):\hat{O} = \frac{1}{4} \left( \hat{N}_{c_2} - \hat{N}_{c_1} \right)^2detailed explanation about the derivation of the formulae are given in thesupplemental materialof the article ;(note): indeed,\langle\hat{N}_{c_2}-\hat{N}_{c_1}\rangle=0and therefore4\times\mathrm{Var}\left[\hat{O}\right]=\left\langle\left(\hat{N}_{c_2}-\hat{N}_{c_1}\right)^2\right\rangle-\left\langle\hat{N}_{c_2}-\hat{N}_{c_1}\right\rangle^2=\left\langle\left(\hat{N}_{c_2}-\hat{N}_{c_1}\right)^2\right\rangleInstallationMethod 1: download from PyPI (recommended for users)This package is published in the PyPI repository, it can be added to any Python environment with
the oneliner:pip install qsipyOr with any other Python packaging and dependency manager, such as poetry:poetry add qsipyMethod 2: cloning from the source (for contributers)You may also clone this project and use it right away. Since it is only Python scripts
no compilation is needed. The functions of interest are defined in two separate modules:src/qsipy/tfs.py$\Rightarrow$ for the functions related to thetwin Fock statessrc/qsipy/tms.py$\Rightarrow$ for the functions related to thetwo-mode squeezed vacuum statesExamplesN.B.the gain in decibels (relatively to the standard quantum limit) are defined as such:$$ G = 20 \log \left[ \sqrt{\eta N} , \Delta \phi \right]$$1. Phase uncertainty $\Delta \phi$ as a function of the measured phase differenceThe following figure shows theratiobetween thephase sensitivityachieved with those two quantum statesand the shot-noise. The quantum efficiency is set to $\eta = 0.95$. It shows in particular that interferometrybelow the standard quantum limit (SQL)can be obtained in specific ranges of phase differences $\phi$.The source code generating this figurecan be found here.2. Maps of the optimal $\phi_0$ to measure, and sub-shot-noise domainsThe example 1. exhibited the fact that (for given quantum efficiency $\eta$ and number of particles $N$) there is an optimal phase difference $\phi_0$ to measure, in order to minimize the measurement uncertainty $\Delta \phi$. One can plot the maps of those optimal phases in the $(\eta,N)$ plane, and identify the regions where sub-shot-noise interferometry may be performed.TFstands fortwin FockstateTMSstands fortwo-mode squeezed vacuumstateThe source code generating this figurecan be found here.3. Asymptotic behaviour of the phase uncertaintyKnowing the optimal phase $\phi_0$ to estimate, one can study the asymptotic behaviour of $\Delta \phi_0 = \left.\Delta \phi\right|_{\phi=\phi_0}$. One can therefore check that as soon as $\eta \neq 1$, $\Delta \phi_0$ has a $\mathcal{O}(N^{-1/2})$ scaling, therefore overtaking the standard quantum limit only by a constant factor.
Here is a visualization of this asymptotic behaviour in the case $\eta = 0.95$The source code generating this figurecan be found here.User guideCurrently the package is organized in two main modulestfsandtms, containing essentially the same functions, but considering eithertwin Fockortwo-mode squeezedstates at the input.Important abbreviations:for the sake of compactness we use the following abbreviation in the names of the functions provided byqsipy:evstands for"expectation value"vhdstands for"variance of the half difference"qestands for"quantum efficiency"(i.e. the value of $\eta$)Here is the listing of the useful functions that one can use, callingtfs.myfunctionortfs.myfunction:Most important functionsdefphase_uncertainty_vhd(phi:float|npt.NDArray[np.float_],N:float|npt.NDArray[np.float_],eta:float|npt.NDArray[np.float_]=1,)->float|npt.NDArray[np.float_]:"""Returns the phase uncertainty during an interferometry experiment using- twin-Fock or two-mode squeezed states at the input (depending from which modulethe function has been called);- considering the variance of the half difference of particles detected at theoutput as the observable of interest;This function only calls either "phase_uncertainty_vhd_perfect_qe" or"phase_uncertainty_vhd_finite_qe", depending on the value of eta that it is set asargument.Parameters----------phi : float | npt.NDArray[np.float_]Phase difference between both arms of the interferometer.N : float | npt.NDArray[np.float_]Total number of particles.eta : float | npt.NDArray[np.float_], optionalQuantum efficiency of the detector, must be between 0 and 1, by default 1.Returns-------float | npt.NDArray[np.float_]Phase uncertainty."""defoptimal_phi_vhd(N:float|npt.NDArray[np.float_],eta:float|npt.NDArray[np.float_]=1,)->float|npt.NDArray[np.float_]:"""Returns the optimal phase to estimate (minimizing the resolution) during aninterferometry experiment using detectors with finite quantum efficiency andconsidering the variance of the half difference of particles detected at the outputas the observable of interest. The detectors have a finite quantum efficiency eta.Parameters----------N : float | npt.NDArray[np.float_]Total number of particles.eta : float | npt.NDArray[np.float_], optionalQuantum efficiency of the detector, must be between 0 and 1, by default 1.Returns-------float | npt.NDArray[np.float_]Optimal phase to estimate experimentally."""defphase_uncertainty_at_optimal_phi_vhd(N:float|npt.NDArray[np.float_],eta:float|npt.NDArray[np.float_]=1,)->float|npt.NDArray[np.float_]:"""Returns the resolution at the optimal phase to estimate during an interferometryexperiment using detectors with finite quantum efficiency eta and considering thevariance of the difference of particles at the output as the observable of interest.This function is therefore just:phase_resolution_difference_finite_qe(optimal_phi_vhd(n, eta), n, eta)Parameters----------N : float | npt.NDArray[np.float_]Total number of particles.eta : float | npt.NDArray[np.float_], optionalQuantum efficiency of the detector, must be between 0 and 1, by default 1.Returns-------float | npt.NDArray[np.float_]Optimal resolution."""Functions with more specific usagedefev_vhd(phi:float|npt.NDArray[np.float_],N:float|npt.NDArray[np.float_],eta:float|npt.NDArray[np.float_]=1,)->float|npt.NDArray[np.float_]:"""Returns the expectation value of the variance of the half difference of number ofparticles detected at both output ports of the interferometer.Since the expectation value of the difference itself is zero, the variance isactually equal to the expectation value of the square of the difference.This function only calls either "ev_vhd_perfect_qe" or "ev_vhd_finite_qe", dependingon the value of eta that it is set as argument.Parameters----------phi : float | npt.NDArray[np.float_]Phase difference between both arms of the interferometer.N : float | npt.NDArray[np.float_]Average total number of particles in the interferometer.eta : float | npt.NDArray[np.float_], optionalQuantum efficiency of the detector, must be between 0 and 1, by default 1.Returns-------float | npt.NDArray[np.float_]Expectation value: <(1/4) * (N_output1 - N_output2) ** 2>"""defev_vhd_squared(phi:float|npt.NDArray[np.float_],N:float|npt.NDArray[np.float_],eta:float|npt.NDArray[np.float_]=1,)->float|npt.NDArray[np.float_]:"""Returns the expectation value of the power four of the half difference of numberof particles detected at both output ports of the interferometer.This function only calls either "ev_vhd_squared_perfect_qe" or"ev_vhd_squared_finite_qe", depending on the value of eta that it is set asargument.Parameters----------phi : float | npt.NDArray[np.float_]Phase difference between both arms of the interferometer.N : float | npt.NDArray[np.float_]Total number of particles.eta : float | npt.NDArray[np.float_], optionalQuantum efficiency of the detector, must be between 0 and 1, by default 1.Returns-------float | npt.NDArray[np.float_]Expectation value: <(1/16) * (N_output1 - N_output2) ** 4>"""deffluctuations_vhd(phi:float|npt.NDArray[np.float_],N:float|npt.NDArray[np.float_],eta:float|npt.NDArray[np.float_]=1,)->float|npt.NDArray[np.float_]:"""Returns the quantum fluctuations of the variance of the half difference of numberof particles detected at both output ports of the interferometer.This function only calls either "fluctuations_vhd_perfect_qe" or"fluctuations_vhd_finite_qe", depending on the value of eta that it is set asargument.Parameters----------phi : float | npt.NDArray[np.float_]Phase difference between both arms of the interferometer.N : float | npt.NDArray[np.float_]Total number of particles.eta : float | npt.NDArray[np.float_], optionalQuantum efficiency of the detector, must be between 0 and 1, by default 1.Returns-------float | npt.NDArray[np.float_]Expectation value: <Sqrt[Var( Var{ (1/2) * (N_output1 - N_output2) } )]>"""defasymptotic_ratio_phase_uncertainty_to_SQL_at_optimal_phi_vhd(eta:float|npt.NDArray[np.float_],)->float|npt.NDArray[np.float_]:"""Returns the asymptotic limit (as the number of particles goes to infinity) of the ratio between:- the phase uncertainty at the optimal phase and considering the variance of the half differenceof particles detected at the output as the observable of interest- the SQL 1/sqrt(eta N).It only depends on the quantum efficiency of the detectors.Parameters----------eta : float | npt.NDArray[np.float_]Quantum efficiency of the detector, must be between 0 and 1.Returns-------float | npt.NDArray[np.float_]Optimal phase uncertainty to SQL ratio in the asymptotic limit of N."""