Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/nightly_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ jobs:
with:
use-quiet-mode: 'yes'
folder-path: tutorials-v${{ matrix.qutip-version }}
#use config file to define 403 and 405 errors as valid links
#(APS blocks this link check)
config-file: mlc_config.json

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: test-environment
activate-environment: test-environment-v${{ matrix.qutip-version }}
use-mamba: true

- name: Get Date
Expand All @@ -51,7 +54,7 @@ jobs:

- name: Install environment
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n test-environment -f test_environment.yml
run: mamba env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml

- name: Install QuTiP
run: |
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/notebook_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ jobs:
with:
use-quiet-mode: 'yes'
folder-path: tutorials-v${{ matrix.qutip-version }}
#use config file to define 403 and 405 errors as valid links
#(APS blocks this link check)
config-file: mlc_config.json

- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: test-environment
activate-environment: test-environment-v${{ matrix.qutip-version }}
use-mamba: true

- name: Get Date
Expand All @@ -53,7 +56,7 @@ jobs:

- name: Install environment
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n test-environment -f test_environment.yml
run: mamba env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml

- name: Install QuTiP
run: |
Expand Down
8 changes: 8 additions & 0 deletions mlc_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"projectBaseUrl":"${workspaceFolder}",
"timeout": "20s",
"retryOn429": true,
"retryCount": 5,
"fallbackRetryDelay": "30s",
"aliveStatusCodes": [200, 206, 403, 405]
}
2 changes: 1 addition & 1 deletion test_environment.yml → test_environment-v4.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-environment
name: test-environment-v4
channels:
- conda-forge
dependencies:
Expand Down
16 changes: 16 additions & 0 deletions test_environment-v5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: test-environment-v5
channels:
- conda-forge
dependencies:
- python==3.12
- pip>=22.1.2
- numpy>=2.0.0
- scipy>=1.9
- matplotlib>=3.9
- imagemagick>=7.1.0_36
- mpmath>=1.2.1
- pytest>=7.1.2
- nbmake>=1.3.4
- jupytext>=1.13.8
- jupyter>=1.0.0
- ipykernel>=6.17.1 # 6.18.0 was yanked but is still present on conda-forge
16 changes: 8 additions & 8 deletions tutorials-v5/lectures/Lecture-5-Parametric-Amplifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.13.8
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -416,12 +416,12 @@ def plot_covariance_matrix(V, ax):

ax.view_init(azim=-40, elev=60)
ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color=colors)
ax.axes.w_xaxis.set_major_locator(plt.IndexLocator(1, -0.5))
ax.axes.w_yaxis.set_major_locator(plt.IndexLocator(1, -0.5))
ax.axes.w_xaxis.set_ticklabels(("$q_-$", "$p_-$", "$q_+$", "$p_+$"),
fontsize=20)
ax.axes.w_yaxis.set_ticklabels(("$q_-$", "$p_-$", "$q_+$", "$p_+$"),
fontsize=20)
ax.axes.xaxis.set_major_locator(plt.IndexLocator(1, -0.5))
ax.axes.yaxis.set_major_locator(plt.IndexLocator(1, -0.5))
ax.axes.xaxis.set_ticklabels(("$q_-$", "$p_-$", "$q_+$", "$p_+$"),
fontsize=12)
ax.axes.yaxis.set_ticklabels(("$q_-$", "$p_-$", "$q_+$", "$p_+$"),
fontsize=12)
```

```python
Expand All @@ -430,7 +430,7 @@ t_idx_vec = [0, 20, 40]

fig, axes = plt.subplots(
len(t_idx_vec), 1, subplot_kw={"projection": "3d"},
figsize=(6, 3 * len(t_idx_vec))
figsize=(10, 3 * len(t_idx_vec))
)

for idx, t_idx in enumerate(t_idx_vec):
Expand Down
7 changes: 4 additions & 3 deletions tutorials-v5/time-evolution/008_brmesolve_time_dependence.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.13.8
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -86,8 +86,9 @@ $$ J(\omega, t) = \kappa * e^{-t} \quad \text{for} \; \omega \geq 0$$
```python
# setup dissipation
kappa = 0.2
a_ops = [[a + a.dag(), "{kappa}*exp(-t)*(w>=0)".format(kappa=kappa)]]

a_ops = [
([a+a.dag(), f'sqrt({kappa}*exp(-t))'], '(w>=0)')
]
# solve
result_brme_aops = brmesolve(H, psi0, times, a_ops, e_ops=[a.dag() * a])

Expand Down
4 changes: 2 additions & 2 deletions tutorials-v5/time-evolution/009_brmesolve-cavity-QED.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.13.8
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -134,7 +134,7 @@ The `qutip.brmesolve()` function automatically uses the secular approximation, i

```python
result_brme_nonsec = brmesolve(H_strong, psi0, times, a_ops,
e_ops, sec_cutoff=-1)
sec_cutoff=-1, e_ops=e_ops)
fig, axes = plot_expectation_values(
[result_brme_strong, result_brme_nonsec], ylabels=["<n_cav>", "<n_atom>"]
)
Expand Down
8 changes: 4 additions & 4 deletions tutorials-v5/time-evolution/013_nonmarkovian_monte_carlo.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.16.1
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -207,7 +207,7 @@ options = {"progress_bar": "enhanced"} # options shared by all solvers
ntraj = 5500

H = 2 * qt.sigmap() * qt.sigmam()
ops_and_rates = [[qt.sigmam(), Gamma_int]]
ops_and_rates = [[qt.sigmam(), qt.coefficient(Gamma_int)]]
psi0 = qt.basis(2, 0)
e_ops = [H]
```
Expand Down Expand Up @@ -766,8 +766,8 @@ if results_folder_exists and NUM_BATCHES > 0:
fit = np.polyfit(np.log(xval), yval, 1)
print(('Approximate number of trajectories required for convergence until '
'time t (according to linear fit):\n'
f'N = {np.exp(-fit[1] / fit[0]) :.2f} * '
f'exp( {1 / fit[0] / times3[-1] :.2f} * t )\n'))
f'N = {np.exp(-fit[1] / fit[0]):.2f} * '
f'exp( {1 / fit[0] / times3[-1]:.2f} * t )\n'))

plt.semilogx(xval, yval, label='Simulation result')
plt.semilogx(xval, fit[0] * np.log(xval) + fit[1], '--', label='Fit')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.13.8
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand Down Expand Up @@ -280,7 +280,7 @@ def calculate_rho_ss_c(Om):
rho_ss_c = [calculate_rho_ss_c(Om) for Om in Om_list]

# calculate list of interference values for all driving strengths
alpha_list = -expect(rho_ss_c, a_r)
alpha_list = -np.array(expect(rho_ss_c, a_r))
alpha_c_list = alpha_list.conjugate()

# decompose emission for all driving strengths
Expand Down
11 changes: 5 additions & 6 deletions tutorials-v5/visualization/pseudo-probability-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.13.8
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -24,7 +24,6 @@ import matplotlib as mpl
import matplotlib.pylab as plt
import numpy as np
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
from qutip import about, basis, destroy, qfunc, wigner, wigner_cmap

%matplotlib inline
Expand All @@ -49,10 +48,10 @@ plt.colorbar();

```python
fig = plt.figure(figsize=(10, 8))
ax = Axes3D(fig, azim=-30, elev=73)
ax = fig.add_subplot(111, projection='3d', azim=-30, elev=73)
ax.plot_surface(X, Y, W, cmap=cmap, rstride=1, cstride=1, alpha=1, linewidth=0)
ax.set_zlim3d(-0.25, 0.25)
for a in ax.w_zaxis.get_ticklines() + ax.w_zaxis.get_ticklabels():
for a in ax.zaxis.get_ticklines() + ax.zaxis.get_ticklabels():
a.set_visible(False)
nrm = mpl.colors.Normalize(W.min(), W.max())
cax, kw = mpl.colorbar.make_axes(ax, shrink=0.66, pad=0.02)
Expand Down Expand Up @@ -85,7 +84,7 @@ X, Y = np.meshgrid(xvec, xvec)
W = wigner(psi, xvec, xvec)

fig1 = plt.figure(figsize=(8, 6))
ax = Axes3D(fig1)
ax = fig1.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, W, rstride=2, cstride=2, cmap=cm.jet, alpha=0.7)
ax.contour(X, Y, W, 15, zdir="x", offset=-6)
ax.contour(X, Y, W, 15, zdir="y", offset=6)
Expand All @@ -102,7 +101,7 @@ plt.title("Wigner function of squeezed state");
Q = qfunc(psi, xvec, xvec, g)

fig2 = plt.figure(figsize=(8, 6))
ax = Axes3D(fig2)
ax = fig2.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Q, rstride=2, cstride=2, cmap=cm.jet, alpha=0.7)
ax.contour(X, Y, Q, zdir="x", offset=-6)
ax.contour(X, Y, Q, zdir="y", offset=6)
Expand Down
Loading