Skip to content

Commit e0d9b4d

Browse files
authored
Merge branch 'master' into Add_tests
2 parents 74cf524 + e30fea6 commit e0d9b4d

File tree

9 files changed

+155
-117
lines changed

9 files changed

+155
-117
lines changed

.readthedocs.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
version: 2
22

3-
sphinx:
4-
configuration: docs/conf.py
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3.12"
57

68
python:
7-
version: 3.7
89
install:
9-
- requirements: requirements-dev.txt
10+
- requirements: requirements-dev.txt
11+
- method: pip
12+
path: .
13+
14+
sphinx:
15+
configuration: docs/conf.py

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ References
306306
(2024): 15501 - 15516.
307307
`[DOI] <https://doi.org/10.1109/JSEN.2024.3368875>`__
308308

309-
.. |Build| image:: https://github.com/dynamicslab/pysensors/workflows/Tests/badge.svg
310-
:target: https://github.com/dynamicslab/pysensors/actions?query=workflow%3ATests
309+
.. |Build| image:: https://github.com/dynamicslab/pysensors/workflows/main.yml/badge.svg
310+
:target: https://github.com/dynamicslab/pysensors/actions?query=workflow%3ACI
311311

312312
.. |RTD| image:: https://readthedocs.org/projects/python-sensors/badge/?version=latest
313313
:target: https://python-sensors.readthedocs.io/en/latest/?badge=latest

docs/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import importlib
2+
import os
23
import pathlib
4+
import sys
35

46
author = "Brian de Silva, Krithika Manohar, Emily Clark"
57
project = "pysensors" # package name
@@ -11,6 +13,7 @@
1113

1214
module = importlib.import_module(project)
1315
version = release = getattr(module, "__version__")
16+
sys.path.insert(0, os.path.abspath("."))
1417

1518
# The master toctree document.
1619
master_doc = "index"
@@ -22,7 +25,8 @@
2225
"sphinx.ext.autosummary",
2326
"sphinx.ext.napoleon",
2427
"sphinx.ext.mathjax",
25-
"sphinx_nbexamples",
28+
"nbsphinx",
29+
"sphinx_copy_examples",
2630
]
2731

2832
apidoc_module_dir = f"../{project}"
@@ -33,7 +37,7 @@
3337
autodoc_member_order = "bysource"
3438
autoclass_content = "init"
3539

36-
language = None
40+
language = "en"
3741

3842
here = pathlib.Path(__file__).parent
3943

docs/sphinx_copy_examples.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import shutil
2+
from pathlib import Path
3+
4+
from sphinx.application import Sphinx
5+
6+
7+
def setup(app: Sphinx):
8+
"""Copy notebooks and supporting files from examples/ to docs/examples/"""
9+
source = Path(__file__).parent.parent / "examples"
10+
target = Path(__file__).parent / "examples"
11+
12+
if target.exists():
13+
shutil.rmtree(target)
14+
target.mkdir()
15+
16+
for item in source.rglob("*"):
17+
# Accomodates for any helper scripts and data files
18+
rel_path = item.relative_to(source)
19+
dest_path = target / rel_path
20+
21+
if item.is_dir():
22+
dest_path.mkdir(parents=True, exist_ok=True)
23+
else:
24+
dest_path.parent.mkdir(parents=True, exist_ok=True)
25+
shutil.copy2(item, dest_path)
26+
print(f"Copied {rel_path}")

examples/functional_constraints_class.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"cell_type": "markdown",
149149
"metadata": {},
150150
"source": [
151-
"### Unconstrained sensor placaement:\n"
151+
"### Unconstrained sensor placement:\n"
152152
]
153153
},
154154
{
@@ -565,7 +565,7 @@
565565
"source": [
566566
"### Functional constaints:\n",
567567
"\n",
568-
"Suppose the user wants to constrain a circular aea centered at x = 20, y = 30 with a radius (r = 5)"
568+
"Suppose the user wants to constrain a circular aea centered at $x = 20$, $y = 30$ with a radius ($r = 5$)"
569569
]
570570
},
571571
{
@@ -862,7 +862,7 @@
862862
"cell_type": "markdown",
863863
"metadata": {},
864864
"source": [
865-
"### We want to constrain the region beyond x = 10 and x = 20 and y = 0 and y = 64"
865+
"### We want to constrain the region beyond $x = 10$ and $x = 20$ and $y = 0$ and $y = 64$"
866866
]
867867
},
868868
{
@@ -2155,7 +2155,7 @@
21552155
"cell_type": "markdown",
21562156
"metadata": {},
21572157
"source": [
2158-
"### Now let us consider an example where the user inputs the equation that they are considering as a constraint in a string of the form (x-30)^2 + (y-40)^2 < 25"
2158+
"### Now let us consider an example where the user inputs the equation that they are considering as a constraint in a string of the form $(x-30)^2 + (y-40)^2 < 25$"
21592159
]
21602160
},
21612161
{
@@ -2379,7 +2379,7 @@
23792379
],
23802380
"metadata": {
23812381
"kernelspec": {
2382-
"display_name": "base",
2382+
"display_name": "venv",
23832383
"language": "python",
23842384
"name": "python3"
23852385
},
@@ -2393,7 +2393,7 @@
23932393
"name": "python",
23942394
"nbconvert_exporter": "python",
23952395
"pygments_lexer": "ipython3",
2396-
"version": "3.9.7"
2396+
"version": "3.12.3"
23972397
}
23982398
},
23992399
"nbformat": 4,

examples/index.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
PySensors Examples
2+
==================
3+
4+
.. toctree::
5+
:maxdepth: 1
6+
:caption: Example Notebooks
7+
8+
pysensors_overview
9+
basis_comparison
10+
classification
11+
cost_constrained_qr
12+
cross_validation
13+
sea_surface_temperature
14+
vandermonde
15+
spatially_constrained_qr
16+
functional_constraints_class
17+
simulation_constrained_sensing

examples/simulation_constrained_sensing.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@
624624
"source": [
625625
"### Functional constraints:\n",
626626
"\n",
627-
"Suppose the user wants to constrain a circular area centered at x = 0.025 m, y = 0 m with a radius (r = 0.02 m).\n",
627+
"Suppose the user wants to constrain a circular area centered at $x = 0.025$ m, $y = 0$ m with a radius ($r = 0.02$ m).\n",
628628
"The user can do see by initiating an instance of the class Circle which has functionalities such as :\n",
629629
"- Plotting\n",
630630
"- Plotting all possible sensor locations\n",
@@ -928,9 +928,9 @@
928928
"source": [
929929
"### Trying out a custom parabolic constraint: ( Now what if the user has provided a python file with the required constraints)\n",
930930
"\n",
931-
"##### Here the parabola is centered at (h,k) = (0.025,0.00)\n",
932-
"##### The equation used is $y = a(x-h)^2 -k$ where a = 100\n",
933-
"##### A line drawn at y = 0.2 closes the parabola and the constrained region is bound by the parabola and the line."
931+
"##### Here the parabola is centered at $(h,k) = (0.025,0.00)$\n",
932+
"##### The equation used is $y = a(x-h)^2 -k$ where $a = 100$\n",
933+
"##### A line drawn at $y = 0.2$ closes the parabola and the constrained region is bound by the parabola and the line."
934934
]
935935
},
936936
{
@@ -1548,7 +1548,7 @@
15481548
"metadata": {},
15491549
"source": [
15501550
"For example the equation of a parabola is :\n",
1551-
"a(x-h)^2 - (y- k)"
1551+
"$a(x-h)^2 - (y- k)$"
15521552
]
15531553
},
15541554
{
@@ -1799,7 +1799,7 @@
17991799
],
18001800
"metadata": {
18011801
"kernelspec": {
1802-
"display_name": "base",
1802+
"display_name": "venv",
18031803
"language": "python",
18041804
"name": "python3"
18051805
},
@@ -1813,7 +1813,7 @@
18131813
"name": "python",
18141814
"nbconvert_exporter": "python",
18151815
"pygments_lexer": "ipython3",
1816-
"version": "3.9.7"
1816+
"version": "3.12.3"
18171817
},
18181818
"orig_nbformat": 4
18191819
},

examples/spatially_constrained_qr.ipynb

Lines changed: 80 additions & 95 deletions
Large diffs are not rendered by default.

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ sphinx >= 2
1212
sphinxcontrib-apidoc
1313
sphinx_rtd_theme
1414
pre-commit
15-
sphinx-nbexamples
15+
nbsphinx

0 commit comments

Comments
 (0)