Skip to content

Commit

Permalink
update for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
jkochNU committed Jul 10, 2022
1 parent c40a440 commit 0e1716c
Showing 1 changed file with 55 additions and 147 deletions.
202 changes: 55 additions & 147 deletions examples/demo_explorer.ipynb
@@ -1,32 +1,14 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# scqubits example: the Explorer class\n",
"J. Koch and P. Groszkowski\n",
"\n",
"For further documentation of scqubits see https://scqubits.readthedocs.io/en/latest/.\n",
"\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**SCQUBITS RELEASE V2.2 CHANGES:** The `Explorer` has been adapted to the new `ParameterSweep` class with scqubits release v2.2. The old `Explorer` is still intact but will be removed in future versions of scqubits. The following illustrates the up-to-date use."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T14:26:06.207526Z",
"start_time": "2020-02-13T14:26:03.363950Z"
}
"end_time": "2020-02-13T22:51:22.144589Z",
"start_time": "2020-02-13T22:51:19.760664Z"
},
"nbsphinx": "hidden"
},
"outputs": [],
"source": [
Expand All @@ -42,20 +24,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# The Explorer Class\n",
"\n",
"Sometimes, exploring the properties of coupled quantum systems benefits from visual aides, and the possibility to see how properties change when system parameters are changed. The `Explorer` class in scqubits provides an interactive plot with multiple panels collecting an important set of information. \n",
"\n",
"The idea behind the `Explorer` class is simple: the user selects an external parameter that they wish to sweep, e.g., an external magnetic flux. The composite system is user-defined through the `HilbertSpace` and `InteractionTerm` classes, allowing flexibility to include different types and numbers of superconducting qubits and harmonic modes.\n",
"# Explorer\n",
"\n",
"Once defined, the parameter sweep is computed by means of the `ParameterSweep` class, and spectral data is stored in memory to allow efficient, interactive display of data. The `Explorer` plots are currently fixed to:\n",
"Exploring properties of coupled quantum systems benefits from visualizing how properties change when system parameters are vaired. The `Explorer` class in scqubits provides an interactive plot with multiple panels collecting an important set of information. \n",
"\n",
"1. Bare spectra of the individual qubits\n",
"2. Wave functions of the bare qubits\n",
"3. Dressed spectrum of the composite Hilbert space\n",
"4. Spectrum for n-photon qubit transitions, starting from a given initial state\n",
"5. AC Stark shift $\\chi_{01}$ for any of the qubits\n",
"6. Charge matrix elements for any of the qubits, using the same initial state as in point 4.\n",
"The workflow is to generate a `HilbertSpace` object specifying the physical system, and a `ParameterSweep` object that contains all data to be visualized. Once this data is stored, the `Explorer` class is invoked for display.\n",
"\n",
"## Example 1: fluxonium coupled to resonator\n",
"As a first example, we consider a system composed of a fluxonium qubit, coupled through its charge operator to the voltage inside a resonator.\n",
Expand All @@ -69,8 +42,8 @@
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T14:26:06.228141Z",
"start_time": "2020-02-13T14:26:06.213556Z"
"end_time": "2020-02-13T22:51:22.164237Z",
"start_time": "2020-02-13T22:51:22.149299Z"
}
},
"outputs": [],
Expand Down Expand Up @@ -104,8 +77,8 @@
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T14:26:06.252987Z",
"start_time": "2020-02-13T14:26:06.235033Z"
"end_time": "2020-02-13T22:51:22.175209Z",
"start_time": "2020-02-13T22:51:22.168227Z"
}
},
"outputs": [],
Expand All @@ -117,13 +90,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The interaction between fluxonium and resonator is of the form $H_\\text{int} = g n (a+a^\\dagger)$, where $n$ is the fluxonium's charge operator: `qbt.n_operator()`. This structure is captured by creating an `InteractionTerm` object via `add_interaction`:"
"The interaction between fluxonium and resonator is of the form $H_\\text{int} = g n (a+a^\\dagger)$, where $n$ is the fluxonium's charge operator: `qbt.n_operator()`. This structure is captured by creating an `InteractionTerm` object via `add_interaction`:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T22:51:22.186179Z",
"start_time": "2020-02-13T22:51:22.178199Z"
}
},
"outputs": [],
"source": [
"hilbertspace.add_interaction(\n",
Expand Down Expand Up @@ -153,8 +131,8 @@
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T14:26:13.431122Z",
"start_time": "2020-02-13T14:26:09.721855Z"
"end_time": "2020-02-13T22:51:26.490669Z",
"start_time": "2020-02-13T22:51:23.156585Z"
}
},
"outputs": [
Expand All @@ -166,7 +144,7 @@
"version_minor": 0
},
"text/plain": [
"Bare spectra: 0%| | 0/101 [00:00<?, ?it/s]"
"Parallel compute bare eigensys for subsystem Fluxonium_1 [num_cpus=4]"
]
},
"metadata": {},
Expand All @@ -180,7 +158,7 @@
"version_minor": 0
},
"text/plain": [
"Bare spectra: 0%| | 0/1 [00:00<?, ?it/s]"
"Parallel compute bare eigensys for subsystem Oscillator_1 [num_cpus=4]"
]
},
"metadata": {},
Expand All @@ -194,19 +172,17 @@
"version_minor": 0
},
"text/plain": [
"Dressed spectrum: 0%| | 0/101 [00:00<?, ?it/s]"
"Parallel compute dressed eigensys [num_cpus=4]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"param_name = r'$\\Phi_{ext}/\\Phi_0$'\n",
"param_name = \"Φext/Φ0\"\n",
"param_vals = np.linspace(-0.5, 0.5, 101)\n",
"\n",
"subsys_update_list = [qbt]\n",
"\n",
"\n",
"def update_hilbertspace(param_val):\n",
" qbt.flux = param_val\n",
Expand All @@ -218,6 +194,7 @@
" hilbertspace=hilbertspace,\n",
" subsys_update_info={param_name: [qbt]},\n",
" update_hilbertspace=update_hilbertspace,\n",
" num_cpus=4\n",
")"
]
},
Expand All @@ -234,60 +211,28 @@
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T14:26:20.251368Z",
"start_time": "2020-02-13T14:26:17.313557Z"
"end_time": "2020-02-13T22:51:30.660521Z",
"start_time": "2020-02-13T22:51:27.493984Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "9fb6290da209488caebef9d43f4c2eae",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"sweeping : 0%| | 0/101 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "57d9639549d74c9398d49d175a64fd55",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(VBox(children=(FloatSlider(value=0.0, continuous_update=False, description='$\\\\Phi_{ext}/\\\\Phi_…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0692c9a81d6943d09612dec0ec4417d3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
"VBox(children=(Tab(children=(HBox(children=(HBox(children=(VBox(children=(Dropdown(layout=Layout(width='165px'…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"explorer = scq.Explorer(\n",
" sweep=sweep,\n",
" evals_count=10\n",
")\n",
"explorer.interact()"
"explorer = scq.Explorer(sweep)"
]
},
{
Expand All @@ -303,7 +248,12 @@
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T22:53:12.216513Z",
"start_time": "2020-02-13T22:53:12.198561Z"
}
},
"outputs": [],
"source": [
"qbt1 = scq.Transmon(\n",
Expand Down Expand Up @@ -356,7 +306,12 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T22:53:19.930404Z",
"start_time": "2020-02-13T22:53:15.996439Z"
}
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -416,7 +371,7 @@
}
],
"source": [
"param_name = r'$\\Phi_{ext}/\\Phi_0$'\n",
"param_name = \"Φext/Φ0\"\n",
"param_vals = np.linspace(0.0, 1.0, 151)\n",
"\n",
"subsys_update_list = [qbt1, qbt2]\n",
Expand Down Expand Up @@ -446,84 +401,37 @@
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2020-02-13T22:53:23.456005Z",
"start_time": "2020-02-13T22:53:21.239927Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"sweeping : 0%| | 0/151 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "32cbd4bda9b04cd28eb7b0389452806c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"sweeping : 0%| | 0/151 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1d969fdcb53d432190d3d1467909e2cb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(VBox(children=(FloatSlider(value=0.0, continuous_update=False, description='$\\\\Phi_{ext}/\\\\Phi_…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "71ba78c44f2441f78bf06cd15468f2ae",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
"VBox(children=(Tab(children=(HBox(children=(HBox(children=(VBox(children=(Dropdown(layout=Layout(width='165px'…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"explorer = scq.Explorer(\n",
" sweep=sweep,\n",
" evals_count=10\n",
")\n",
"explorer.interact()"
"explorer = scq.Explorer(sweep=sweep)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Edit Metadata",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -537,7 +445,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.12"
},
"pycharm": {
"stem_cell": {
Expand Down

0 comments on commit 0e1716c

Please sign in to comment.