diff --git a/.github/workflows/notebook-automation.yml b/.github/workflows/notebook-automation.yml index 090520d..37a9c9a 100644 --- a/.github/workflows/notebook-automation.yml +++ b/.github/workflows/notebook-automation.yml @@ -12,27 +12,43 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: + fetch-depth: 2 ssh-key: ${{ secrets.ACTIONS_BOT_KEY }} - name: Identify Modified and Deleted Notebooks run: | + echo "Current SHA: ${{ github.sha }}" + echo "Before SHA: ${{ github.event.before }}" if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then echo "First push to this branch. Checking for parents." - if git log --pretty=%P -n 1 ${{ github.sha }} | grep -q .; then - echo "Commit has parent(s). Diffing against first parent." - git diff --name-status ${{ github.sha }}^ ${{ github.sha }} | grep '\.ipynb$' > notebook_changes.txt + parent_sha=$(git log --pretty=%P -n 1 ${{ github.sha }} | cut -d' ' -f1) + echo "Parent SHA: $parent_sha" + if [ -n "$parent_sha" ]; then + echo "Commit has parent: $parent_sha. Diffing against it." + if ! git cat-file -e "$parent_sha^{commit}" 2>/dev/null; then + echo "Parent not in shallow clone. Fetching." + git fetch origin "$parent_sha" --depth=1 + fi + git diff --name-status "$parent_sha" "${{ github.sha }}" | grep '\.ipynb$' > notebook_changes.txt else echo "No parent (orphan branch). Diffing against empty tree." - git diff --name-status 4b825dc642cb6eb9a060e54bf8d69288fbee4904 ${{ github.sha }} | grep '\.ipynb$' > notebook_changes.txt + git diff --name-status 4b825dc642cb6eb9a060e54bf8d69288fbee4904 "${{ github.sha }}" | grep '\.ipynb$' > notebook_changes.txt fi else - if git cat-file -e ${{ github.event.before }}^{commit} 2>/dev/null; then - git diff --name-status ${{ github.event.before }} ${{ github.sha }} | grep '\.ipynb$' > notebook_changes.txt + if git cat-file -e "${{ github.event.before }}^{commit}" 2>/dev/null; then + echo "Diffing against previous commit: ${{ github.event.before }}" + git diff --name-status "${{ github.event.before }}" "${{ github.sha }}" | grep '\.ipynb$' > notebook_changes.txt else - git fetch origin ${{ github.event.before }} --depth=1 - git diff --name-status ${{ github.event.before }} ${{ github.sha }} | grep '\.ipynb$' > notebook_changes.txt + echo "Fetching previous commit: ${{ github.event.before }}" + git fetch origin "${{ github.event.before }}" --depth=1 + git diff --name-status "${{ github.event.before }}" "${{ github.sha }}" | grep '\.ipynb$' > notebook_changes.txt fi fi + if [ ! -s notebook_changes.txt ]; then + echo "No notebook changes detected." + echo "A .dummy.ipynb" > notebook_changes.txt + fi + echo "Contents of notebook_changes.txt:" cat notebook_changes.txt - name: Set up Python diff --git a/10-deep-strong-coupling.ipynb b/10-deep-strong-coupling.ipynb index cd41c4a..e88a321 100644 --- a/10-deep-strong-coupling.ipynb +++ b/10-deep-strong-coupling.ipynb @@ -5,7 +5,7 @@ "id": "97f2ce24-d34c-4838-8041-2f010670f303", "metadata": {}, "source": [ - "\"Open           \"Open" + "\"Open           \"Open" ] }, { @@ -23,7 +23,7 @@ "source": [ "So far in this tutorial series, we've explored how two-level-systems (TLS) behave when the coupling between them is small. In general, much of the \"intuition\" for how quantum systems behave is based on small couplings in one form or another.\n", "\n", - "In this tutorial, we'll let the coupling become so strong it dominates the dynamics - so called \"Deep strong coupling\". In this regime, what's usually forbidden becomes common place. Bosons are created from no where and resonance no longer seems important! 🤯\n", + "In this tutorial, we'll let the coupling become so strong that it dominates the dynamics - so called \"Deep strong coupling\". In this regime, what's usually forbidden becomes common place. Bosons are created from no where and resonance no longer seems important! 🤯\n", "\n", "Ready to challenge your intuition? Let's do it!" ] @@ -76,7 +76,7 @@ "source": [ "For the last few tutorials, we've been spending a lot of time building up capabilities for studying many TLS.\n", "\n", - "For this tutorial, we've going to return to a single TLS coupled to a quantised boson field. We've previously called this the spin-boson model, but it's also called the Rabi model. The Hamiltonian is given by:\n", + "For this tutorial, we're going to return to a single TLS coupled to a quantised boson field. We've previously called this the single mode spin-boson model, but it's better known as the Rabi model. The Hamiltonian is given by:\n", "\n", "$$H = \\frac{\\Delta E}{2} \\sigma_z + \\hbar\\omega\\left(a^{\\dagger}a +\\frac{1}{2}\\right) + U\\left( a^{\\dagger} + a \\right)(\\sigma_+ + \\sigma_-)$$\n", "\n", @@ -169,12 +169,12 @@ "source": [ "Let's consider the case (as we've done many times throughout this tutorial series) of two coupled pendulums with frequencies $\\omega_1$ and $\\omega_2$. The coupling can be described in terms of a frequency $\\omega_{\\rm coupling}$ (imagine a spring connecting the two pendulums) and dissipation can be described by a rate $\\gamma_{\\rm diss}$.\n", "\n", - "The different coupling regimes are determined by how large $\\omega_{\\rm coupling}$ is compared to $\\omega_1$, $\\omega_2$ and $\\gamma_{\\rm diss}$. The naming conventions used in the [quantum optics literature](https://www.nature.com/articles/s42254-018-0006-2) are going to be useful for us. They describe the coupling as:\n", + "The different coupling regimes are determined by how large $\\omega_{\\rm coupling}$ is compared to $\\omega_1$, $\\omega_2$ and the dissipation $\\gamma_{\\rm diss}$. The naming conventions used in the [quantum optics literature](https://www.nature.com/articles/s42254-018-0006-2) are going to be useful for us. They describe the coupling as:\n", "\n", - "- Weak - $\\omega_{\\rm coupling} \\ll \\gamma_{\\rm diss} \\ll \\omega_1,\\omega_2$\n", - "- Strong - $\\gamma_{\\rm diss} \\ll \\omega_{\\rm coupling} \\ll \\omega_1,\\omega_2$\n", - "- Ultra strong - $\\gamma_{\\rm diss} \\ll \\omega_{\\rm coupling} \\sim 0.1\\times \\omega_1,\\omega_2$\n", - "- Deep strong - $\\gamma_{\\rm diss} \\ll \\omega_1,\\omega_2 \\lesssim \\omega_{\\rm coupling}$" + "- Weak: $\\omega_{\\rm coupling} \\ll \\gamma_{\\rm diss} \\ll \\omega_1,\\omega_2$\n", + "- Strong: $\\gamma_{\\rm diss} \\ll \\omega_{\\rm coupling} \\ll \\omega_1,\\omega_2$\n", + "- Ultra strong: $\\gamma_{\\rm diss} \\ll \\omega_{\\rm coupling} \\sim 0.1 \\omega_1,\\omega_2$\n", + "- Deep strong: $\\gamma_{\\rm diss} \\ll \\omega_1,\\omega_2 \\lesssim \\omega_{\\rm coupling}$" ] }, { @@ -214,7 +214,7 @@ "source": [ "### Ultra strong coupling\n", "\n", - "When the coupling is ultra strong, energy exchange happens on the time scale of a single swing of one of the pendulums. The two natural natural frequencies - when both pendulums move in the same and in opposite directions to one another - can be noticeably discerned. The coupling is getting strong enough so that more energy can be exchanged between pendulums of different lengths. This exact boundary for this regime is somewhat artificial - there is nothing particularly special about the value $0.1 \\omega_{\\rm 1}, \\omega_2$. This value was first used as part of the quantum optics literature.\n", + "When the coupling is ultra strong, energy exchange happens on the time scale of a single swing of one of the pendulums. The two natural natural frequencies - when both pendulums move in the same and in opposite directions to one another - can be noticeably discerned. The coupling is getting strong enough so that more energy can be exchanged between pendulums of different lengths. This exact boundary for this regime is somewhat artificial - there is nothing particularly special about the value $0.1 \\omega_{\\rm 1}, \\omega_2$. This value was first used as part of the [quantum optics literature](https://www.nature.com/articles/s42254-018-0006-2).\n", "\n", "\n", "