Skip to content

Commit

Permalink
chore(ci): fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Oct 17, 2024
1 parent 448ae4e commit a21b29e
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 86 deletions.
8 changes: 6 additions & 2 deletions differt/src/differt/plotting/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ def draw_rays(
>>>
>>> ray_origins = jnp.zeros(3)
>>> ray_directions = fibonacci_lattice(50)
>>> ray_origins, ray_directions = jnp.broadcast_arrays(ray_origins, ray_directions)
>>> ray_origins, ray_directions = jnp.broadcast_arrays(
... ray_origins, ray_directions
... )
>>> fig = draw_rays(
... ray_origins,
... ray_directions,
Expand Down Expand Up @@ -876,7 +878,9 @@ def draw_surface(
>>> fig1 = draw_surface(x, y, z=z, backend="plotly")
>>> fig1 # doctest: +SKIP
>>>
>>> fig2 = draw_surface(x, y, z=z, colors=x * x + y * y + z * z, backend="plotly")
>>> fig2 = draw_surface(
... x, y, z=z, colors=x * x + y * y + z * z, backend="plotly"
... )
>>> fig2 # doctest: +SKIP
"""
Expand Down
12 changes: 9 additions & 3 deletions differt/src/differt/plotting/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,13 @@ def set_defaults(backend: str | None = None, **kwargs: Any) -> BackendName:
'matplotlib'
>>> my_plot() # So that now it defaults to 'matplotlib' and color='red'
Using matplotlib backend with args = (), kwargs = {'color': 'red'}
>>> my_plot(backend="vispy") # Of course, the 'vispy' backend is still available
>>> my_plot(
... backend="vispy"
... ) # Of course, the 'vispy' backend is still available
Using vispy backend with args = (), kwargs = {'color': 'red'}
>>> my_plot(backend="vispy", color="green") # And we can also override any default
>>> my_plot(
... backend="vispy", color="green"
... ) # And we can also override any default
Using vispy backend with args = (), kwargs = {'color': 'green'}
>>> dplt.set_defaults("vispy") # Reset all defaults
'vispy'
Expand Down Expand Up @@ -204,7 +208,9 @@ def use(backend: str | None = None, **kwargs: Any) -> Iterator[BackendName]:
>>>
>>> my_plot() # When not specified, use default backend
Using vispy backend with args = (), kwargs = {}
>>> with dplt.use(): # No parameters = reset defaults (except the default backend)
>>> with (
... dplt.use()
... ): # No parameters = reset defaults (except the default backend)
... my_plot()
Using vispy backend with args = (), kwargs = {}
>>> with dplt.use("plotly"): # We can change the default backend
Expand Down
8 changes: 6 additions & 2 deletions differt/src/differt/rt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ def rays_intersect_triangles(
>>> download_sionna_scenes()
>>> file = get_sionna_scene("simple_street_canyon")
>>> scene = TriangleScene.load_xml(file)
>>> scene = eqx.tree_at(lambda s: s.transmitters, scene, jnp.array([-33, 0, 32.0]))
>>> scene = eqx.tree_at(
... lambda s: s.transmitters, scene, jnp.array([-33, 0, 32.0])
... )
>>> ray_origins, ray_directions = jnp.broadcast_arrays(
... scene.transmitters, fibonacci_lattice(25)
... )
Expand Down Expand Up @@ -433,7 +435,9 @@ def triangles_visible_from_vertices(
>>> download_sionna_scenes()
>>> file = get_sionna_scene("simple_street_canyon")
>>> scene = TriangleScene.load_xml(file)
>>> scene = eqx.tree_at(lambda s: s.transmitters, scene, jnp.array([-33, 0, 32.0]))
>>> scene = eqx.tree_at(
... lambda s: s.transmitters, scene, jnp.array([-33, 0, 32.0])
... )
>>> visible_triangles = triangles_visible_from_vertices(
... scene.transmitters,
... scene.mesh.triangle_vertices,
Expand Down
4 changes: 3 additions & 1 deletion differt/src/differt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ def minimize(
>>> # You can also change the optimizer and the number of steps
>>> import optax
>>> optimizer = optax.noisy_sgd(learning_rate=0.003)
>>> x, y = minimize(f, jnp.zeros(5), args=(4.0,), steps=10000, optimizer=optimizer)
>>> x, y = minimize(
... f, jnp.zeros(5), args=(4.0,), steps=10000, optimizer=optimizer
... )
>>> chex.assert_trees_all_close(x, 4.0 * jnp.ones(5), rtol=1e-2)
>>> chex.assert_trees_all_close(y, 0.0, atol=1e-3)
Expand Down
156 changes: 78 additions & 78 deletions docs/source/notebooks/multipath.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "e90f3c19",
"metadata": {
"tags": [
Expand Down Expand Up @@ -6723,8 +6723,8 @@
0,
0,
0,
0.00005731253622798249,
0.00005581309233093634
5.731253622798249e-05,
5.581309233093634e-05
],
[
0.0005743360961787403,
Expand Down Expand Up @@ -6822,11 +6822,11 @@
0,
0,
0,
0.00006250281148822978,
0.00006080223465687595,
0.00005916692680330016,
0.000057593744713813066,
0.00005607975253951736
6.250281148822978e-05,
6.080223465687595e-05,
5.916692680330016e-05,
5.7593744713813066e-05,
5.607975253951736e-05
],
[
0.0005796843324787915,
Expand Down Expand Up @@ -6922,13 +6922,13 @@
0,
0,
0,
0.00006647440750384703,
0.00006461329030571505,
0.00006282558751991019,
0.00006110764661571011,
0.00005945608427282423,
0.000057867695431923494,
0.00005633944601868279
6.647440750384703e-05,
6.461329030571505e-05,
6.282558751991019e-05,
6.110764661571011e-05,
5.945608427282423e-05,
5.7867695431923494e-05,
5.633944601868279e-05
],
[
0.0005848027067258954,
Expand Down Expand Up @@ -7022,15 +7022,15 @@
0,
0,
0,
0.00007082733645802364,
0.00006878539716126397,
0.00006682624371023849,
0.00006494566332548857,
0.00006313977064564824,
0.00006140484038041905,
0.00005973738370812498,
0.000058134148275712505,
0.000056591987231513485
7.082733645802364e-05,
6.878539716126397e-05,
6.682624371023849e-05,
6.494566332548857e-05,
6.313977064564824e-05,
6.140484038041905e-05,
5.973738370812498e-05,
5.8134148275712505e-05,
5.6591987231513485e-05
],
[
0.0005896772490814328,
Expand Down Expand Up @@ -7122,17 +7122,17 @@
0,
0,
0,
0.00007561061647720635,
0.00007336434646276757,
0.00007121171074686572,
0.00006914787081768736,
0.0000671683155815117,
0.00006526871584355831,
0.00006344506255118176,
0.00006169354310259223,
0.00006001060319249518,
0.00005839284131070599,
0.00005683711060555652
7.561061647720635e-05,
7.336434646276757e-05,
7.121171074686572e-05,
6.914787081768736e-05,
6.71683155815117e-05,
6.526871584355831e-05,
6.344506255118176e-05,
6.169354310259223e-05,
6.001060319249518e-05,
5.839284131070599e-05,
5.683711060555652e-05
],
[
0.0005942945135757327,
Expand Down Expand Up @@ -7222,12 +7222,12 @@
0,
0,
0,
0.00008088116010185331,
0.00007840317266527563,
0.00007603151607327163,
0.00007376053690677509,
0.00007158493099268526,
0.00006949972157599404,
8.088116010185331e-05,
7.840317266527563e-05,
7.603151607327163e-05,
7.376053690677509e-05,
7.158493099268526e-05,
6.949972157599404e-05,
0.00020877696806564927,
0.0002026628790190443,
0.00019680523837450892,
Expand Down Expand Up @@ -7321,8 +7321,8 @@
0,
0,
0,
0.00008957493264460936,
0.00008670519309816882,
8.957493264460936e-05,
8.670519309816882e-05,
0.00026097899535670877,
0.00025254441425204277,
0.00024449682678095996,
Expand Down Expand Up @@ -8954,7 +8954,7 @@
0,
0,
0,
0.0000867960334289819,
8.67960334289819e-05,
0.0002605440095067024,
0.0002521377755329013,
0.00024411626509390771,
Expand Down Expand Up @@ -9058,11 +9058,11 @@
0,
0,
0,
0.00008096366218524054,
0.00007848069799365476,
0.00007610441389260814,
0.00007382913463516161,
0.00007164954877225682,
8.096366218524054e-05,
7.848069799365476e-05,
7.610441389260814e-05,
7.382913463516161e-05,
7.164954877225682e-05,
0.0002148266939911991,
0.00020846158440690488,
0.00020236606360413137,
Expand Down Expand Up @@ -9162,15 +9162,15 @@
0,
0,
0,
0.00007568575529148802,
0.00007343506877077743,
0.00007127835124265403,
0.00006921070598764345,
0.00006722758553223684,
0.00006532468250952661,
0.00006349794421112165,
0.00006174355075927451,
0.0000600579114689026,
7.568575529148802e-05,
7.343506877077743e-05,
7.127835124265403e-05,
6.921070598764345e-05,
6.722758553223684e-05,
6.532468250952661e-05,
6.349794421112165e-05,
6.174355075927451e-05,
6.00579114689026e-05,
0.00017992878565564752,
0.00017500693502370268
],
Expand Down Expand Up @@ -9267,14 +9267,14 @@
0,
0,
0,
0.00006885007314849645,
0.00006688727444270626,
0.00006500331073766574,
0.00006319425301626325,
0.00006145636143628508,
0.000059786150814034045,
0.000058180332416668534,
0.000056635744840605184
6.885007314849645e-05,
6.688727444270626e-05,
6.500331073766574e-05,
6.319425301626325e-05,
6.145636143628508e-05,
5.9786150814034045e-05,
5.8180332416668534e-05,
5.6635744840605184e-05
],
[
0.00040123987128026783,
Expand Down Expand Up @@ -9371,12 +9371,12 @@
0,
0,
0,
0.0000646725675323978,
0.00006288161966949701,
0.00006116064469097182,
0.000059506273828446865,
0.000057915229263016954,
0.00005638451693812385
6.46725675323978e-05,
6.288161966949701e-05,
6.116064469097182e-05,
5.9506273828446865e-05,
5.7915229263016954e-05,
5.638451693812385e-05
],
[
0.0003980831825174391,
Expand Down Expand Up @@ -9475,10 +9475,10 @@
0,
0,
0,
0.00006085667700972408,
0.000059218466049060225,
0.0000576425991312135,
0.00005612604945781641
6.085667700972408e-05,
5.9218466049060225e-05,
5.76425991312135e-05,
5.612604945781641e-05
],
[
0.0003947421791963279,
Expand Down Expand Up @@ -9579,8 +9579,8 @@
0,
0,
0,
0.00005736263483413495,
0.000055860611610114574
5.736263483413495e-05,
5.5860611610114574e-05
],
[
0.0003912273969035596,
Expand Down

0 comments on commit a21b29e

Please sign in to comment.