Skip to content

Commit

Permalink
Merge pull request #14 from saipavanc/master
Browse files Browse the repository at this point in the history
Updating notebooks and using nbval instead of nbsmoke
  • Loading branch information
petergthatsme committed Mar 1, 2024
2 parents 141ee70 + b09641f commit 8dc8882
Show file tree
Hide file tree
Showing 17 changed files with 159,365 additions and 66,329 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/pytests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: scqubits-examples testing via pytest --nbsmoke-run
name: scqubits-examples testing via pytest nbval

on: [push]
on: [push, workflow_dispatch, pull_request]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 100
strategy:
max-parallel: 1
matrix:
python-version: [3.7,
3.8,
Expand All @@ -29,8 +28,8 @@ jobs:
pip install ipywidgets
pip install -r workflow-requirements.info
python -m pip install git+https://github.com/scqubits/scqubits.git
- name: Test notebooks with pytest --nbsmoke-run
- name: Test notebooks with py.test --nbval-lax
run: |
pip install pytest
pip install nbsmoke
pytest --nbsmoke-run
pip install nbval
py.test --nbval-lax
20 changes: 5 additions & 15 deletions examples/demo-jaynes-cummings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@
"outputs": [
{
"data": {
"text/plain": "array([-0.5 , 0.25857864, 0.54142136, 1.02679492, 1.37320508])"
"text/plain": [
"array([-0.5 , 0.25857864, 0.54142136, 1.02679492, 1.37320508])"
]
},
"execution_count": 7,
"metadata": {},
Expand All @@ -256,18 +258,6 @@
"source": [
"energies(frequency_r, frequency_q, g, 3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
}
],
"metadata": {
Expand All @@ -287,7 +277,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.11.7"
},
"toc": {
"base_numbering": 1,
Expand Down Expand Up @@ -341,4 +331,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
19,607 changes: 15,575 additions & 4,032 deletions examples/demo_cos2phi_qubit.ipynb

Large diffs are not rendered by default.

27 changes: 10 additions & 17 deletions examples/demo_explorer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "40463f32303b4cebadb9fba1e67320eb",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -62,7 +62,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "73a179bc5f1a4d76bf8eab100eb07f13",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -76,7 +76,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "53118a8c7db94cdcb683283aec2e7def",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -150,7 +150,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a8abbe67076148c9818a965331f367dd",
"model_id": "8ce08088a7d14c598c84e93069af0aec",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -237,7 +237,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "1b56b3d5be6b403f895488c30673f16b",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -251,7 +251,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "6c833fe93ca847d2a196c1304a10e40f",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -265,7 +265,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "0a279d2a444146ea879a58b66d91a550",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -279,7 +279,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "",
"model_id": "e1dc9e9dc66e4d66999adbd5a6b1ec95",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -327,7 +327,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "853d55effe1743afb95b71b5f9011f65",
"model_id": "0e1430b779fd47e5946c952bb1810944",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -342,13 +342,6 @@
"source": [
"explorer = scq.Explorer(sweep=sweep)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -367,7 +360,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.11.7"
},
"pycharm": {
"stem_cell": {
Expand Down
26,339 changes: 13,554 additions & 12,785 deletions examples/demo_flux_qubit.ipynb

Large diffs are not rendered by default.

22,824 changes: 22,800 additions & 24 deletions examples/demo_fluxonium.ipynb

Large diffs are not rendered by default.

1,391 changes: 616 additions & 775 deletions examples/demo_gui.ipynb

Large diffs are not rendered by default.

117 changes: 8 additions & 109 deletions examples/demo_hilbertspace.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -473,26 +473,12 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f3f947cb87bf4b198948a37ee4bee782",
"model_id": "5bf3b76e9fe64691a3a91275a8e7bcf3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(VBox(children=(HBox(children=(Label(value='Select subsystems (Ctrl-Click)'), But…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2ffb1a622bac411199662b5548b04746",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
"Container(children=[Card(children=[CardTitle(children=['Create Hilbert Space'], layout=None), Container(childr…"
]
},
"metadata": {},
Expand All @@ -514,46 +500,6 @@
"text": [
"HilbertSpace: subsystems\n",
"-------------------------\n",
"\n",
"KerrOscillator------| [KerrOscillator_1]\n",
" | E_osc: 4.284\n",
" | K: 0.003\n",
" | l_osc: None\n",
" | truncated_dim: 4\n",
" |\n",
" | dim: 4\n",
"\n",
"\n",
"KerrOscillator------| [KerrOscillator_2]\n",
" | E_osc: 7.073\n",
" | K: 0.015\n",
" | l_osc: None\n",
" | truncated_dim: 4\n",
" |\n",
" | dim: 4\n",
"\n",
"\n",
"\n",
"HilbertSpace: interaction terms\n",
"--------------------------------\n",
"InteractionTerm----------| [InteractionTerm_0]\n",
" | expr: 'g * op1 * op2'\n",
" | operator_list: [(0, 'op1', array([[0. , 0. , 0. ...\n",
" | const: {}\n",
" | add_hc: True\n",
"\n",
"InteractionTerm----------| [InteractionTerm_1]\n",
" | expr: 'g2 * op1.dag() * op1.dag() * op2'\n",
" | operator_list: [(0, 'op1', array([[0. , 1. , 0. ...\n",
" | const: {}\n",
" | add_hc: True\n",
"\n",
"InteractionTerm----------| [InteractionTerm_2]\n",
" | expr: 'chi_ab * op1.dag() * op1 * op2.dag() * op2'\n",
" | operator_list: [(0, 'op1', array([[0. , 1. , 0. ...\n",
" | const: {}\n",
" | add_hc: False\n",
"\n",
"\n"
]
}
Expand All @@ -570,59 +516,12 @@
{
"data": {
"text/latex": [
"Quantum object: dims = [[4, 4], [4, 4]], shape = (16, 16), type = oper, isherm = True $ \\\\ \\left(\\begin{matrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \\cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 7.073 & 0.0 & 0.0 & 0.100 & \\cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 14.116 & 0.0 & 0.0 & \\cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 21.129 & 0.0 & \\cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.100 & 0.0 & 0.0 & 4.284 & \\cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\\\\vdots & \\vdots & \\vdots & \\vdots & \\vdots & \\ddots & \\vdots & \\vdots & \\vdots & \\vdots & \\vdots\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \\cdots & 29.751 & 0.0 & 0.0 & 0.300 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \\cdots & 0.0 & 12.834 & 0.0 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \\cdots & 0.0 & 0.0 & 19.937 & 0.0 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \\cdots & 0.300 & 0.0 & 0.0 & 27.010 & 0.0\\\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \\cdots & 0.0 & 0.0 & 0.0 & 0.0 & 34.053\\\\\\end{matrix}\\right)$"
"Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra $ \\\\ \\left(\\begin{matrix}0.0\\\\\\end{matrix}\\right)$"
],
"text/plain": [
"Quantum object: dims = [[4, 4], [4, 4]], shape = (16, 16), type = oper, isherm = True\n",
"Quantum object: dims = [[1], [1]], shape = (1, 1), type = bra\n",
"Qobj data =\n",
"[[ 0. 0. 0. 0. 0. 0.\n",
" 0. 0. 0. 0. 0. 0.\n",
" 0. 0. 0. 0. ]\n",
" [ 0. 7.073 0. 0. 0.1 0.\n",
" 0. 0. 0.04949747 0. 0. 0.\n",
" 0. 0. 0. 0. ]\n",
" [ 0. 0. 14.116 0. 0. 0.14142136\n",
" 0. 0. 0. 0.07 0. 0.\n",
" 0. 0. 0. 0. ]\n",
" [ 0. 0. 0. 21.129 0. 0.\n",
" 0.17320508 0. 0. 0. 0.08573214 0.\n",
" 0. 0. 0. 0. ]\n",
" [ 0. 0.1 0. 0. 4.284 0.\n",
" 0. 0. 0. 0. 0. 0.\n",
" 0. 0. 0. 0. ]\n",
" [ 0. 0. 0.14142136 0. 0. 11.367\n",
" 0. 0. 0.14142136 0. 0. 0.\n",
" 0.08573214 0. 0. 0. ]\n",
" [ 0. 0. 0. 0.17320508 0. 0.\n",
" 18.42 0. 0. 0.2 0. 0.\n",
" 0. 0.12124356 0. 0. ]\n",
" [ 0. 0. 0. 0. 0. 0.\n",
" 0. 25.443 0. 0. 0.24494897 0.\n",
" 0. 0. 0.14849242 0. ]\n",
" [ 0. 0.04949747 0. 0. 0. 0.14142136\n",
" 0. 0. 8.562 0. 0. 0.\n",
" 0. 0. 0. 0. ]\n",
" [ 0. 0. 0.07 0. 0. 0.\n",
" 0.2 0. 0. 15.655 0. 0.\n",
" 0.17320508 0. 0. 0. ]\n",
" [ 0. 0. 0. 0.08573214 0. 0.\n",
" 0. 0.24494897 0. 0. 22.718 0.\n",
" 0. 0.24494897 0. 0. ]\n",
" [ 0. 0. 0. 0. 0. 0.\n",
" 0. 0. 0. 0. 0. 29.751\n",
" 0. 0. 0.3 0. ]\n",
" [ 0. 0. 0. 0. 0. 0.08573214\n",
" 0. 0. 0. 0.17320508 0. 0.\n",
" 12.834 0. 0. 0. ]\n",
" [ 0. 0. 0. 0. 0. 0.\n",
" 0.12124356 0. 0. 0. 0.24494897 0.\n",
" 0. 19.937 0. 0. ]\n",
" [ 0. 0. 0. 0. 0. 0.\n",
" 0. 0.14849242 0. 0. 0. 0.3\n",
" 0. 0. 27.01 0. ]\n",
" [ 0. 0. 0. 0. 0. 0.\n",
" 0. 0. 0. 0. 0. 0.\n",
" 0. 0. 0. 34.053 ]]"
"[[0.]]"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -650,7 +549,7 @@
{
"data": {
"text/plain": [
"True"
"False"
]
},
"execution_count": 12,
Expand Down Expand Up @@ -805,7 +704,7 @@
{
"data": {
"text/plain": [
"18.413688985491895"
"18.413688985491923"
]
},
"execution_count": 17,
Expand Down Expand Up @@ -845,7 +744,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.11.7"
},
"toc": {
"base_numbering": 1,
Expand Down
33,717 changes: 17,520 additions & 16,197 deletions examples/demo_noise.ipynb

Large diffs are not rendered by default.

0 comments on commit 8dc8882

Please sign in to comment.