Skip to content

Commit

Permalink
Merge branch 'master' into released
Browse files Browse the repository at this point in the history
# Conflicts:
#	examples/demo_explorer.ipynb
  • Loading branch information
jkochNU committed Jul 30, 2023
2 parents 0e1716c + 64cf6b2 commit 97cf43d
Show file tree
Hide file tree
Showing 17 changed files with 49,348 additions and 93,153 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions .github/workflows/pytests.yml
Expand Up @@ -10,9 +10,9 @@ jobs:
strategy:
max-parallel: 1
matrix:
python-version: [3.6,
3.7,
3.8]
python-version: [3.7,
3.8,
3.9]

steps:
- uses: actions/checkout@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
/.idea/
/examples/.ipynb_checkpoints/
84 changes: 58 additions & 26 deletions examples/demo-jaynes-cummings.ipynb
Expand Up @@ -2,7 +2,11 @@
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"# scqubits example: Jaynes-Cummings model\n",
"J. Koch and P. Groszkowski\n",
Expand All @@ -22,15 +26,12 @@
},
"init_cell": true,
"pycharm": {
"is_executing": false
"name": "#%%\n"
},
"scrolled": true
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'svg'\n",
"\n",
"import numpy as np\n",
"\n",
"import scqubits as scq\n",
Expand All @@ -39,7 +40,11 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"## The Jaynes-Cummings model\n",
"\n",
Expand All @@ -59,26 +64,34 @@
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"source": [
"# exact eigenenergies for comparing with numerics\n",
"\n",
"def energies(omega_r, omega_q, g, n_cutoff):\n",
" delta = omega_r - omega_q\n",
" energies1 = (np.arange(1, n_cutoff) - 0.5) * omega_r\n",
"def energies(frequency_r, frequency_q, g, n_cutoff):\n",
" delta = frequency_r - frequency_q\n",
" energies1 = (np.arange(1, n_cutoff) - 0.5) * frequency_r\n",
" energies2 = np.sqrt(delta**2/4 + np.arange(1, n_cutoff) * g**2)\n",
" energies_plus = energies1 + energies2\n",
" energies_minus = energies1 - energies2\n",
" energies_0 = np.asarray([[-0.5 * omega_q]])\n",
" energies_0 = np.asarray([[-0.5 * frequency_q]])\n",
" all_energies = np.append(energies_0, energies_minus)\n",
" all_energies = np.append(all_energies, energies_plus)\n",
" return np.sort(all_energies)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"### Set up the subsystems"
]
Expand All @@ -97,15 +110,15 @@
},
"outputs": [],
"source": [
"omega_q = 1.0\n",
"omega_r = 0.8\n",
"frequency_q = 1.0\n",
"frequency_r = 0.8\n",
"g = 0.1\n",
"\n",
"\n",
"qubit = scq.GenericQubit(E=omega_q)\n",
"qubit = scq.GenericQubit(E=frequency_q)\n",
"\n",
"osc = scq.Oscillator(\n",
" E_osc=omega_r,\n",
" E_osc=frequency_r,\n",
" truncated_dim=10 # up to 9 photons\n",
")"
]
Expand Down Expand Up @@ -153,6 +166,9 @@
"ExecuteTime": {
"end_time": "2020-03-31T11:43:54.772581Z",
"start_time": "2020-03-31T11:43:54.765597Z"
},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
Expand Down Expand Up @@ -182,8 +198,7 @@
"--------------------------------\n",
"InteractionTerm----------| [Interaction_1]\n",
" | g_strength: 0.1\n",
" | operator_list: [(0, array([[0., 0.],\n",
" [1., 0.]])), (1, arra ...\n",
" | operator_list: [(0, <bound method GenericQubit.sm_operator of Gen ...\n",
" | add_hc: True\n",
"\n",
"\n"
Expand All @@ -201,6 +216,9 @@
"ExecuteTime": {
"end_time": "2020-03-31T11:44:06.327709Z",
"start_time": "2020-03-31T11:44:06.314743Z"
},
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [
Expand All @@ -220,28 +238,42 @@
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"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": {},
"output_type": "execute_result"
}
],
"source": [
"energies(omega_r, omega_q, g, 3)"
"energies(frequency_r, frequency_q, g, 3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
}
],
"metadata": {
"celltoolbar": "Initialisation Cell",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -255,7 +287,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.9.16"
},
"toc": {
"base_numbering": 1,
Expand Down Expand Up @@ -309,4 +341,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
17,184 changes: 4,324 additions & 12,860 deletions examples/demo_cos2phi_qubit.ipynb

Large diffs are not rendered by default.

0 comments on commit 97cf43d

Please sign in to comment.