filter_functions: A package for efficient numerical calculation of generalized filter functions to describe the effect of noise on quantum gate operations
Introduction
Simply put, filter functions characterize a quantum system's susceptibility to noise at a given frequency during a control operation and can thus be used to gain insight into its decoherence. The formalism allows for efficient calculation of several quantities of interest such as average gate fidelity and even the entire quantum process up to a unitary rotation. Moreover, the filter function of a composite pulse can be easily derived from those of the constituent pulses, allowing for efficient assembly and characterization of pulse sequences.
Initially, filter functions have been introduced to model dynamical decoupling sequences [5, 6]. With this project we aim to provide a toolkit for calculating and inspecting filter functions for arbitrary pulses including pulses without analytic form such as one might get from numerical pulse optimization algorithms. These filter functions can be used to compute process descriptions, fidelities and other quantities of interest from arbitrary classical noise spectral densities. For the efficient and convenient treatment of gate sequences, concatenation rules that allow the filter function of a sequence to be computed from those of its constituents are implemented.
The filter_functions package is built to interface with QuTiP, a widely-used quantum toolbox for Python, as well as qopt and comes with extensive documentation and a test suite.
As a very brief introduction, consider a Hadamard gate implemented by a pi/2 Y-gate followed by a NOT-gate using simple square pulses. We can calculate and plot the dephasing filter function of the gate with the following code:
import filter_functions as ff
import qutip as qt
from math import pi
H_c = [[qt.sigmax()/2, [0, pi], 'X'],
[qt.sigmay()/2, [pi/2, 0], 'Y']] # control Hamiltonian
H_n = [[qt.sigmaz()/2, [1, 1], 'Z']] # constant coupling to z noise
dt = [1, 1] # time steps
hadamard = ff.PulseSequence(H_c, H_n, dt) # Central object representing a control pulse
omega = ff.util.get_sample_frequencies(hadamard)
F = hadamard.get_filter_function(omega)
from filter_functions import plotting
plotting.plot_filter_function(hadamard) # Filter function cached from before
An alternative way of obtaining the Hadamard PulseSequence is by concatenating the composing pulses:
Y2 = ff.PulseSequence([[qt.sigmay()/2, [pi/2], 'Y']],
[[qt.sigmaz()/2, [1], 'Z']],
[1])
X = ff.PulseSequence([[qt.sigmax()/2, [pi], 'X']],
[[qt.sigmaz()/2, [1], 'Z']],
[1])
Y2.cache_filter_function(omega)
X.cache_filter_function(omega)
hadamard = Y2 @ X # equivalent: ff.concatenate((Y2, X))
hadamard.is_cached('filter function')
# True (filter function cached during concatenation)
To compute, for example, the infidelity of the gate in the presence of an arbitrary classical noise spectrum, we can simply call infidelity():
spectrum = 1e-2/omega
infidelity = ff.infidelity(hadamard, spectrum, omega)
# array([0.0025]) (one contribution per noise operator)
Installation
To install the package from PyPI, run pip install filter_functions. If you require the optional features provided by QuTiP (visualizing Bloch sphere trajectories), it is recommended to install QuTiP before by following the instructions on their website rather than installing it through pip. To install the package from source run python setup.py develop to install using symlinks or python setup.py install without.
To install dependencies of optional extras (matplotlib for plotting, QuTiP for Bloch sphere visualization), run pip install -e .[extra] where extra is one or more of plotting, bloch_sphere_visualization from the root directory. To install all dependencies, including those needed to build the documentation and run the tests, use the extra all.
Documentation
You can find the documentation on Readthedocs. It is built from Jupyter notebooks that can also be run interactively and are located here. The notebooks explain how to use the package and thus make sense to follow chronologically as a first step. Furthermore, there are also a few example scripts in the examples folder.
The documentation including the example notebooks and an automatically generated API documentation can be built by running make <format> inside the doc directory where <format> is for example html.
Interactively using the documentation requires jupyter, and building a static version additionally requires nbsphinx, numpydoc, sphinx_rtd_theme, as well as pandoc. The last can be installed via conda (conda install pandoc) or downloaded from Github and the rest automatically by running pip install -e .[doc].
Citing
If this software has benefited your research, please consider citing:
Formalism
[1]: T. Hangleiter, P. Cerfontaine, and H. Bluhm. Filter-function formalism and software package to compute quantum processes of gate sequences for classical non-Markovian noise. Phys. Rev. Res. 3, 043047 (2021). 10.1103/PhysRevResearch.3.043047. arXiv:2103.02403.
[2]: P. Cerfontaine, T. Hangleiter, and H. Bluhm. Filter Functions for Quantum Processes under Correlated Noise. Phys. Rev. Lett. 127, 170403 (2021). 10.1103/PhysRevLett.127.170403. arXiv:2103.02385.
Gradients
[3]: I. N. M. Le, J. D. Teske, T. Hangleiter, P. Cerfontaine, and Hendrik Bluhm. Analytic Filter Function Derivatives for Quantum Optimal Control. Phys. Rev. Applied 17, 024006 (2022). 10.1103/PhysRevApplied.17.024006. arXiv:2103.09126.
Software
[4]: T. Hangleiter, I. N. M. Le, and J. D. Teske, "filter_functions: A package for efficient numerical calculation of generalized filter functions to describe the effect of noise on quantum gate operations," (2021). 10.5281/zenodo.4575000.
Additional References
[5]: L. Cywinski, R. M. Lutchyn, C. P. Nave, and S. Das Sarma. How to enhance dephasing time in superconducting qubits. Phys. Rev. B 77, 174509 (2008). 10.1103/PhysRevB.77.174509.
[6]: T. J Green., J. Sastrawan, H. Uys, and M. J. Biercuk. Arbitrary quantum control of qubits in the presence of universal noise. New J. Phys. 15, 095004 (2013). 10.1088/1367-2630/15/9/095004.
Metadata
Release files for filter_functions 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| filter_functions-1.2.3.tar.gz | 1.3 MB | Without provenance | Details for filter_functions-1.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filter_functions-1.2.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for filter_functions-1.2.3-py2.py3-none-any.whl |
Total release size: 1.4 MB
Release files / filter_functions-1.2.3.tar.gz
| Download URL | filter_functions-1.2.3.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73ccc17a619d4455f8815ecca6e30125a213e4be6ea9192ef5d1c90a9fd9014b
|
|
BLAKE2b-256 checksum How to use checksums |
8c2cfd53322faf917c94c10fe8aa9de53fc4474c99188346c129f7d4682bede4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
|
Release files / filter_functions-1.2.3-py2.py3-none-any.whl
| Download URL | filter_functions-1.2.3-py2.py3-none-any.whl |
|---|---|
| Size | 116.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
343f5ba2f9702cf6084b5dd75b2fa4987515fb15c7db88e14c8c0bfe13d5c7aa
|
|
BLAKE2b-256 checksum How to use checksums |
20fb65a51f5f73dd6f25bfd93de066cb10996424bb7b33c29dd4ef7b08a7ad6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
|
Security for filter_functions 1.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.