Skip to content

Commit

Permalink
Merge b9c5864 into b7ae604
Browse files Browse the repository at this point in the history
  • Loading branch information
thangleiter committed Jun 25, 2020
2 parents b7ae604 + b9c5864 commit de86c3e
Show file tree
Hide file tree
Showing 26 changed files with 33,109 additions and 349 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install:
- conda info -a
- conda env create -f ./environment.yml
- source activate filter_functions
- pip install .[fancy_progressbar,doc,tests]
- pip install .[all]

script:
- coverage run --rcfile=coverage.ini -m pytest
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ hadamard = ff.PulseSequence(H_c, H_n, dt) # Central object representing a cont
omega = ff.util.get_sample_frequencies(hadamard)
F = hadamard.get_filter_function(omega)

ff.plot_filter_function(hadamard) # Filter function cached from before
from filter_functions import plotting
plotting.plot_filter_function(hadamard) # Filter function cached from before
```

![Hadamard dephasing filter function](./doc/source/_static/hadamard.png)
Expand Down Expand Up @@ -59,16 +60,16 @@ infidelity = ff.infidelity(hadamard, spectrum, omega)
```

## Installation
To install the package from PyPI, run `pip install filter_functions`. It is recommended to install QuTiP before by following the [instructions on their website](http://qutip.org/docs/latest/installation.html) 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 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](http://qutip.org/docs/latest/installation.html) 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 the optional dependencies (`tqdm` and `requests` for a fancy progress bar), run `pip install -e .[fancy_progressbar]` from the root directory.
To install dependencies of optional extras (`tqdm` and `requests` for a fancy progress bar, `matplotlib` for plotting, `QuTiP` for Bloch sphere visualization), run `pip install -e .[extra]` where `extra` is one or more of `fancy_progressbar`, `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](https://filter-functions.readthedocs.io/en/latest/). It is built from Jupyter notebooks that can also be run interactively and are located [here](doc/source/examples). 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](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`.

Building the documentation requires the following additional dependencies: `nbsphinx`, `numpydoc`, `sphinx_rtd_theme`, `jupyter_client`, `ipython`, `ipykernel`, as well as `pandoc`. The last can be installed via conda (`conda install pandoc`) or downloaded from [Github](https://github.com/jgm/pandoc/releases/) and the rest automatically by running `pip install -e .[doc]`.
Building the documentation requires the following additional dependencies: `nbsphinx`, `numpydoc`, `sphinx_rtd_theme`, `ipython`, `ipykernel`, `jupyter_client`, as well as `pandoc`. The last can be installed via conda (`conda install pandoc`) or downloaded from [Github](https://github.com/jgm/pandoc/releases/) and the rest automatically by running `pip install -e .[doc]`.

## References
[1]: Cywinski, L., Lutchyn, R. M., Nave, C. P., & Das Sarma, S. (2008). How to enhance dephasing time in superconducting qubits. Physical Review B - Condensed Matter and Materials Physics, 77(17), 1–11. [https://doi.org/10.1103/PhysRevB.77.174509](https://doi.org/10.1103/PhysRevB.77.174509)
Expand Down
Binary file modified doc/source/_static/hadamard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions doc/source/examples/advanced_concatenation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"d = 2\n",
"H = np.empty((2, d, d), dtype=complex)\n",
"\n",
"Id, Px, Py, Pz = ff.util.P_np\n",
"Id, Px, Py, Pz = ff.util.paulis\n",
"H[0] = 1/2*Px\n",
"H[1] = 1/2*Pz\n",
"\n",
Expand Down Expand Up @@ -184,8 +184,11 @@
"metadata": {},
"outputs": [],
"source": [
"from filter_functions import plotting\n",
"\n",
"for gate in gate_types:\n",
" ff.plot_bloch_vector_evolution(H[gate], n_samples=501, figsize=(4, 4))"
" plotting.plot_bloch_vector_evolution(H[gate], n_samples=501,\n",
" figsize=(4, 4))"
]
},
{
Expand All @@ -203,9 +206,8 @@
"source": [
"pulses = ('Y', 'X_1', 'X_2')\n",
"for gate_type, hadamard in H.items():\n",
" fig, ax, leg = ff.plot_pulse_correlation_filter_function(hadamard,\n",
" xscale='linear',\n",
" figsize=(9, 6))\n",
" fig, ax, leg = plotting.plot_pulse_correlation_filter_function(\n",
" hadamard, xscale='linear', figsize=(9, 6))\n",
"\n",
" # Adjust the titles to something more meaningful\n",
" for i in range(3):\n",
Expand Down
13,963 changes: 13,922 additions & 41 deletions doc/source/examples/calculating_error_transfer_matrices.ipynb

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions doc/source/examples/extending_pulses.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"import filter_functions as ff\n",
"from filter_functions import util\n",
"\n",
"I, X, Y, Z = util.P_np\n",
"I, X, Y, Z = util.paulis\n",
"\n",
"# In order to be able to remap cached filter functions, we need a separable\n",
"# basis like the Pauli basis\n",
Expand Down Expand Up @@ -209,8 +209,10 @@
"metadata": {},
"outputs": [],
"source": [
"from filter_functions import plotting\n",
"\n",
"print(swap_14_23.is_cached('F'))\n",
"_ = ff.plot_filter_function(swap_14_23)"
"_ = plotting.plot_filter_function(swap_14_23)"
]
}
],
Expand Down
12 changes: 7 additions & 5 deletions doc/source/examples/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"metadata": {},
"outputs": [],
"source": [
"from filter_functions import analytic\n",
"from filter_functions import analytic, plotting\n",
"\n",
"# Generate logarithmically spaced frequencies over an interval which generally\n",
"# captures the important regions of the filter function. Since the filter\n",
Expand All @@ -135,7 +135,7 @@
"omega = ff.util.get_sample_frequencies(FID, n_samples=200, spacing='log',\n",
" symmetric=False)\n",
"# Plot the filter function.\n",
"fig, ax, legend = ff.plot_filter_function(FID, omega)\n",
"fig, ax, legend = plotting.plot_filter_function(FID, omega)\n",
"# Plot the analytic solution into the same plot\n",
"ax.plot(omega*tau, analytic.FID(omega*tau)/omega**2,\n",
" 'x-', label='Analytical', zorder=0)\n",
Expand All @@ -161,7 +161,8 @@
"# Initial state the +1 eigenstate of X\n",
"psi_i = (qt.basis(2, 0) + qt.basis(2, 1))/np.sqrt(2)\n",
"\n",
"ff.plot_bloch_vector_evolution(FID, psi0=psi_i, n_samples=101, figsize=(4, 4))"
"plotting.plot_bloch_vector_evolution(FID, psi0=psi_i, n_samples=101,\n",
" figsize=(4, 4))"
]
},
{
Expand Down Expand Up @@ -261,14 +262,15 @@
"omega = ff.util.get_sample_frequencies(SE, n_samples=400, spacing='log',\n",
" symmetric=False)\n",
"# Plot the filter function\n",
"fig, ax, legend = ff.plot_filter_function(SE, omega, yscale='log')\n",
"fig, ax, legend = plotting.plot_filter_function(SE, omega, yscale='log')\n",
"ax.set_ylim(bottom=1e-13)\n",
"# Plot the analytical solution\n",
"ax.plot(omega*tau, analytic.SE(omega*tau)/omega**2, '--',\n",
" label='Analytical (Bang-Bang)', zorder=0)\n",
"legend = ax.legend()\n",
"\n",
"ff.plot_bloch_vector_evolution(SE, psi0=psi_i, n_samples=101, figsize=(4, 4))"
"plotting.plot_bloch_vector_evolution(SE, psi0=psi_i, n_samples=101,\n",
" figsize=(4, 4))"
]
},
{
Expand Down
3,657 changes: 3,627 additions & 30 deletions doc/source/examples/periodic_driving.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit de86c3e

Please sign in to comment.