Skip to content

Commit 21db2af

Browse files
committed
CI: Add Workflow to Run Jupyter Notebooks
1 parent 2e0f9ab commit 21db2af

File tree

3 files changed

+39
-20
lines changed

3 files changed

+39
-20
lines changed

.github/workflows/jupyter.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: 📙 Jupyter
2+
3+
on:
4+
push:
5+
branches:
6+
- "development"
7+
pull_request:
8+
paths-ignore:
9+
- "Docs/**"
10+
- "**.rst"
11+
12+
concurrency:
13+
group: ${{ github.ref }}-${{ github.head_ref }}-jupyter
14+
cancel-in-progress: true
15+
16+
jobs:
17+
jupyter_notebooks:
18+
name: Notebooks
19+
runs-on: ubuntu-latest
20+
if: github.event.pull_request.draft == false
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.x"
27+
- name: Install Dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install nbconvert nbformat jupyter
31+
- name: Run Notebooks
32+
run: |
33+
cd Tools/Algorithms
34+
jupyter nbconvert --to notebook --execute psatd.ipynb

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Python/dist/
2929
Python/pywarpx.egg-info/
3030
_tmppythonbuild/
3131
pywarpx.egg-info/
32+
*.ipynb_checkpoints/
3233

3334
##########
3435
# Sphinx #

Tools/Algorithms/psatd.ipynb

+4-20
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@
7373
" \"\"\"\n",
7474
" Simplify matrix W.\n",
7575
" \"\"\"\n",
76+
" W = sp.Matrix(W)\n",
7677
" for i in range(W.shape[0]):\n",
7778
" for j in range(W.shape[1]):\n",
78-
" W[i, j] = W[i, j].expand().simplify()"
79+
" W[i, j] = W[i, j].expand().simplify()\n",
80+
" W = sp.ImmutableMatrix(W)"
7981
]
8082
},
8183
{
@@ -689,24 +691,6 @@
689691
"\n",
690692
"Display the coefficients of the update equations one by one. For example, `coeff_h[('Ex', 'By')]` displays the coefficient of $E^x$ with respect to $B^y$ (resulting from the solution of the homogeneous system, hence the `_h` suffix), while `coeff_nh[('Ex', 'Jx_c0')]` displays the coefficient of $E^x$ with respect to $\\gamma_{J_x}$ (resulting from the solution of the non-homogeneous system, hence the `_nh` suffix). Note that $\\gamma_{J_x}$ is denoted as `Jx_c0` in the notebook, as described in the beginning."
691693
]
692-
},
693-
{
694-
"cell_type": "code",
695-
"execution_count": null,
696-
"metadata": {},
697-
"outputs": [],
698-
"source": [
699-
"coeff_h[(\"Ex\", \"By\")]"
700-
]
701-
},
702-
{
703-
"cell_type": "code",
704-
"execution_count": null,
705-
"metadata": {},
706-
"outputs": [],
707-
"source": [
708-
"coeff_nh[(\"Ex\", \"Jx_c0\")]"
709-
]
710694
}
711695
],
712696
"metadata": {
@@ -725,7 +709,7 @@
725709
"name": "python",
726710
"nbconvert_exporter": "python",
727711
"pygments_lexer": "ipython3",
728-
"version": "3.12.4"
712+
"version": "3.13.1"
729713
}
730714
},
731715
"nbformat": 4,

0 commit comments

Comments
 (0)