Skip to content

Commit

Permalink
chore(ci): cleanup notebooks and codespell (#153)
Browse files Browse the repository at this point in the history
* chore(ci): cleanup notebooks and codespell

* chore(ci): check codespell in GA

* chore(ci): fmt

* fix(docs): typo

* chore(ci): nbsetup

* chore(ci): remove file skip
  • Loading branch information
jeertmans authored Oct 23, 2024
1 parent 05082e1 commit 4e7204a
Show file tree
Hide file tree
Showing 13 changed files with 168 additions and 145 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Check for common grammar and spelling mistakes
name: LanguageTool
name: Spelling

on:
pull_request:
Expand All @@ -23,3 +23,19 @@ jobs:
reporter: github-pr-review
patterns: '*.md src/**.rs python/differt/**.py docs/source/**.md docs/source/**.ipynb'
level: warning

codespell-jupyer:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Strip cell output
run: |
pip install nbstripout
find . -name '*.ipynb' -exec nbstripout {} +
- name: Run codespell
run: |
pip install codespell tomli
find . -name '*.ipynb' -exec codespell {} +
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ repos:
args:
- --sort-by-bibkey
- --drop=abstract
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
args:
- --keep-output
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies:
- tomli
exclude_types: [jupyter] # GitHub action will run on Notebooks
76 changes: 38 additions & 38 deletions docs/source/notebooks/advanced_path_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e90f3c19",
"id": "0",
"metadata": {
"tags": [
"differt-install-preamble",
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "markdown",
"id": "311d7587",
"id": "1",
"metadata": {},
"source": [
"# Advanced Path Tracing\n",
Expand All @@ -38,7 +38,7 @@
},
{
"cell_type": "markdown",
"id": "bdac281d-e122-494b-8f83-1dbcbcfaea39",
"id": "2",
"metadata": {},
"source": [
"## Example on a simple scene\n",
Expand All @@ -61,8 +61,8 @@
},
{
"cell_type": "code",
"execution_count": 2,
"id": "0c260649-d4de-452d-a578-7647c0e57993",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -87,7 +87,7 @@
},
{
"cell_type": "markdown",
"id": "76b12dd2-a6e0-4f50-bc17-3da15d359af0",
"id": "4",
"metadata": {},
"source": [
"### Loading a mesh\n",
Expand All @@ -98,8 +98,8 @@
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a4ff244d",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -109,7 +109,7 @@
},
{
"cell_type": "markdown",
"id": "d3a43cc4-f3b5-4aef-a25e-7c5aed739e9f",
"id": "6",
"metadata": {
"tags": []
},
Expand All @@ -123,7 +123,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2be70ad7-6dae-478f-83bd-b08e516d114d",
"id": "7",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -135,7 +135,7 @@
},
{
"cell_type": "markdown",
"id": "a65b5875-630c-4454-99c0-09e549488ef9",
"id": "8",
"metadata": {},
"source": [
"Ray Tracing without start and end points is not very interesting.\n",
Expand All @@ -145,7 +145,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1b575f59-b2ae-4425-aac2-5286f240e4dc",
"id": "9",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -159,7 +159,7 @@
},
{
"cell_type": "markdown",
"id": "db3d3187-c330-4367-b51c-b027dcdf05ed",
"id": "10",
"metadata": {},
"source": [
"### How we trace rays\n",
Expand All @@ -181,7 +181,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "471c5059-cc86-4ca6-ad9e-efc8d7cc2f91",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -201,7 +201,7 @@
},
{
"cell_type": "markdown",
"id": "7d1fb247-2aba-4064-aba9-f34bfea0d3c5",
"id": "12",
"metadata": {},
"source": [
"Looking at the above, we can clearly see that a line-of-sight (LOS) path between TX and RX exists.\n",
Expand All @@ -215,7 +215,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "30689d03-ac54-419f-ada3-c14a1a570d65",
"id": "13",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -275,7 +275,7 @@
},
{
"cell_type": "markdown",
"id": "739cb7d5-a067-4bf3-9641-673ea76ff11c",
"id": "14",
"metadata": {},
"source": [
"Nice! Thanks to the {func}`image_method<differt.rt.image_method.image_method>`, we successfully generated the paths we just mentioned.\n",
Expand All @@ -301,7 +301,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "32f1468a-bf02-4c33-8a1d-0dca89d09c20",
"id": "15",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -416,15 +416,15 @@
},
{
"cell_type": "markdown",
"id": "1512b1e9-44ed-4cba-bee4-abf067bf954a",
"id": "16",
"metadata": {},
"source": [
"Another path tracing method that is fully compatible with the above cell is {func}`fermat_path_on_planar_mirrors<differt.rt.fermat.fermat_path_on_planar_mirrors>`. You can safely use the latter instead of the former, and that should produce the same result. Note that the Fermat path tracing is much slower than the Image method, but can be applied to other types of interactions than just pure specular reflection. This is left as an exercise to the reader."
]
},
{
"cell_type": "markdown",
"id": "4c44db87-6b36-4000-919d-69b469a744d8",
"id": "17",
"metadata": {},
"source": [
"## Example on more complex scenes\n",
Expand Down Expand Up @@ -456,7 +456,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "435cf5c1-c0dd-47a1-9c1f-49c2d1d89b3d",
"id": "18",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -475,7 +475,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6ef52f5e-5620-4e6d-a731-8c7bad893641",
"id": "19",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -484,7 +484,7 @@
},
{
"cell_type": "markdown",
"id": "51243bb9",
"id": "20",
"metadata": {},
"source": [
"This number isn't actually that big, and can easily reach above a million on large cities.\n",
Expand All @@ -497,7 +497,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "fea3cba1-938f-49b2-ab21-ae88396e5b55",
"id": "21",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -515,15 +515,15 @@
},
{
"cell_type": "markdown",
"id": "917fbcc6",
"id": "22",
"metadata": {},
"source": [
"That means that there are over 200 million second order reflection paths to test... We need to reduce that number!"
]
},
{
"cell_type": "markdown",
"id": "4974a586",
"id": "23",
"metadata": {},
"source": [
"### Assuming quadrilaterals\n",
Expand All @@ -540,7 +540,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0b3456fe",
"id": "24",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -550,7 +550,7 @@
},
{
"cell_type": "markdown",
"id": "b5ba7acb",
"id": "25",
"metadata": {},
"source": [
"Again, we can compute the number of path candidates, and see that it is reduced almost by a factor 4.\n",
Expand All @@ -561,7 +561,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8080e60c",
"id": "26",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -576,7 +576,7 @@
},
{
"cell_type": "markdown",
"id": "725a925c",
"id": "27",
"metadata": {},
"source": [
"### Determining TX's visibility\n",
Expand Down Expand Up @@ -606,7 +606,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "08ab9f72-5d52-488c-bc09-7a635b7ab7a8",
"id": "28",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -637,7 +637,7 @@
},
{
"cell_type": "markdown",
"id": "f1104575",
"id": "29",
"metadata": {},
"source": [
"A visibility vector is simply an array of boolean, each entry indicating if a corresponding\n",
Expand All @@ -649,7 +649,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "4bd97917-c5d3-4b7e-b29a-c071b7a579cc",
"id": "30",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -658,7 +658,7 @@
},
{
"cell_type": "markdown",
"id": "7c0354a8",
"id": "31",
"metadata": {},
"source": [
"It is also possible to get the number of visible quadrilaterals by\n",
Expand All @@ -669,7 +669,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bf54e4da",
"id": "32",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -679,7 +679,7 @@
},
{
"cell_type": "markdown",
"id": "e6566874",
"id": "33",
"metadata": {},
"source": [
"We can then use this result to inform the graph about the limited number of faces\n",
Expand All @@ -696,7 +696,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ca360b86",
"id": "34",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -712,7 +712,7 @@
},
{
"cell_type": "markdown",
"id": "3c3229ef",
"id": "35",
"metadata": {},
"source": [
"### What about Ray Launching\n",
Expand Down
6 changes: 3 additions & 3 deletions docs/source/notebooks/diffraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e90f3c19",
"id": "0",
"metadata": {
"tags": [
"differt-install-preamble",
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "markdown",
"id": "dd7d10a7-b006-4112-bf51-16e519ffd0c1",
"id": "1",
"metadata": {},
"source": [
"# Handling Diffraction\n",
Expand All @@ -43,7 +43,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7f48a5a2-5531-4c42-a2e3-9106589a5347",
"id": "2",
"metadata": {},
"outputs": [],
"source": [
Expand Down
Loading

0 comments on commit 4e7204a

Please sign in to comment.