differt 0.6.1__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {differt-0.6.1 → differt-0.7.0}/PKG-INFO +27 -12
- {differt-0.6.1 → differt-0.7.0}/README.md +19 -4
- {differt-0.6.1 → differt-0.7.0}/pyproject.toml +6 -11
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_antenna.py +28 -28
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_material.py +10 -10
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_utd.py +14 -15
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_utils.py +4 -16
- {differt-0.6.1 → differt-0.7.0}/src/differt/geometry/_paths.py +85 -99
- {differt-0.6.1 → differt-0.7.0}/src/differt/geometry/_triangle_mesh.py +161 -53
- {differt-0.6.1 → differt-0.7.0}/src/differt/geometry/_utils.py +21 -48
- {differt-0.6.1 → differt-0.7.0}/src/differt/plotting/_core.py +8 -8
- {differt-0.6.1 → differt-0.7.0}/src/differt/plotting/_utils.py +22 -16
- {differt-0.6.1 → differt-0.7.0}/src/differt/plugins/_deepmimo_types.py +2 -1
- {differt-0.6.1 → differt-0.7.0}/src/differt/plugins/deepmimo.py +154 -175
- {differt-0.6.1 → differt-0.7.0}/src/differt/rt/_fermat.py +34 -93
- {differt-0.6.1 → differt-0.7.0}/src/differt/rt/_image_method.py +6 -7
- {differt-0.6.1 → differt-0.7.0}/src/differt/rt/_utils.py +31 -26
- {differt-0.6.1 → differt-0.7.0}/src/differt/scene/_triangle_scene.py +241 -108
- {differt-0.6.1 → differt-0.7.0}/src/differt/utils.py +2 -4
- {differt-0.6.1 → differt-0.7.0}/.gitignore +0 -0
- {differt-0.6.1 → differt-0.7.0}/LICENSE.md +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/_version.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_constants.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_fresnel.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/em/_interaction_type.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/geometry/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/plotting/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/plugins/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/py.typed +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/rt/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/scene/__init__.py +0 -0
- {differt-0.6.1 → differt-0.7.0}/src/differt/scene/_sionna.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DiffeRT
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Differentiable Ray Tracing Toolbox for Radio Propagation Simulations
|
|
5
5
|
Project-URL: Changelog, https://github.com/jeertmans/DiffeRT/releases
|
|
6
6
|
Project-URL: Documentation, https://eertmans.be/DiffeRT
|
|
@@ -21,25 +21,26 @@ Classifier: Programming Language :: Python :: Free Threading
|
|
|
21
21
|
Classifier: Topic :: Scientific/Engineering
|
|
22
22
|
Requires-Python: >=3.11
|
|
23
23
|
Requires-Dist: chex>=0.1.86
|
|
24
|
-
Requires-Dist: differt-core==0.
|
|
25
|
-
Requires-Dist: equinox>=0.13.
|
|
24
|
+
Requires-Dist: differt-core==0.7.0
|
|
25
|
+
Requires-Dist: equinox>=0.13.4
|
|
26
26
|
Requires-Dist: filelock>=3.15.4
|
|
27
|
-
Requires-Dist: jax
|
|
28
|
-
Requires-Dist:
|
|
27
|
+
Requires-Dist: fpt-jax==0.1.0
|
|
28
|
+
Requires-Dist: jax>=0.8.1
|
|
29
|
+
Requires-Dist: jaxtyping>=0.3.6
|
|
29
30
|
Requires-Dist: numpy>=1.26.1
|
|
30
|
-
Requires-Dist: optax>=0.1.7
|
|
31
31
|
Requires-Dist: requests>=2.32.0
|
|
32
32
|
Requires-Dist: tqdm>=4.66.2
|
|
33
33
|
Provides-Extra: all
|
|
34
|
+
Requires-Dist: ipykernel<7; extra == 'all'
|
|
34
35
|
Requires-Dist: ipympl>=0.9.4; extra == 'all'
|
|
35
36
|
Requires-Dist: jupyter-rfb>=0.4.2; extra == 'all'
|
|
36
37
|
Requires-Dist: matplotlib>=3.8.1; extra == 'all'
|
|
37
38
|
Requires-Dist: notebook>5; extra == 'all'
|
|
38
39
|
Requires-Dist: plotly>=5.18.0; extra == 'all'
|
|
39
|
-
Requires-Dist: pyopengl>=3.1.0; (platform_system == 'Darwin') and extra == 'all'
|
|
40
40
|
Requires-Dist: pyqt6>=6.6.1; extra == 'all'
|
|
41
41
|
Requires-Dist: vispy>=0.14.1; extra == 'all'
|
|
42
42
|
Provides-Extra: jupyter
|
|
43
|
+
Requires-Dist: ipykernel<7; extra == 'jupyter'
|
|
43
44
|
Requires-Dist: ipympl>=0.9.4; extra == 'jupyter'
|
|
44
45
|
Requires-Dist: jupyter-rfb>=0.4.2; extra == 'jupyter'
|
|
45
46
|
Requires-Dist: notebook>5; extra == 'jupyter'
|
|
@@ -48,7 +49,6 @@ Requires-Dist: matplotlib>=3.8.1; extra == 'matplotlib'
|
|
|
48
49
|
Provides-Extra: plotly
|
|
49
50
|
Requires-Dist: plotly>=5.18.0; extra == 'plotly'
|
|
50
51
|
Provides-Extra: vispy
|
|
51
|
-
Requires-Dist: pyopengl>=3.1.0; (platform_system == 'Darwin') and extra == 'vispy'
|
|
52
52
|
Requires-Dist: vispy>=0.14.1; extra == 'vispy'
|
|
53
53
|
Provides-Extra: vispy-backend
|
|
54
54
|
Requires-Dist: pyqt6>=6.6.1; extra == 'vispy-backend'
|
|
@@ -133,15 +133,30 @@ for a detailed step-by-step procedure.
|
|
|
133
133
|
|
|
134
134
|
<!-- start citing -->
|
|
135
135
|
|
|
136
|
-
If you use this software, please cite it as:
|
|
136
|
+
If you use this software, please cite it as (**preferred**):
|
|
137
137
|
|
|
138
138
|
```bibtex
|
|
139
|
-
@
|
|
140
|
-
title
|
|
139
|
+
@inproceedings{Eertmans_DiffeRT_ICMLCN_2025,
|
|
140
|
+
title = {Demonstrating {DiffeRT}: An Open-Source Library for Optimizing Radio Networks with Differentiable Ray Tracing},
|
|
141
|
+
author = {Eertmans, Jérome and Oestges, Claude and Jacques, Laurent},
|
|
142
|
+
year = 2025,
|
|
143
|
+
booktitle = {2025 IEEE International Conference on Machine Learning for Communication and Networking (ICMLCN)},
|
|
144
|
+
volume = {},
|
|
145
|
+
number = {},
|
|
146
|
+
pages = {1--2},
|
|
147
|
+
doi = {10.1109/ICMLCN64995.2025.11139997}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
or:
|
|
152
|
+
|
|
153
|
+
```bibtex
|
|
154
|
+
@software{Eertmans_DiffeRT_GitHub,
|
|
155
|
+
title = {{DiffeRT}: A Differentiable Ray Tracing Toolbox for Radio Propagation Simulations},
|
|
141
156
|
author = {Eertmans, Jérome},
|
|
142
157
|
url = {https://github.com/jeertmans/DiffeRT},
|
|
143
158
|
license = {MIT},
|
|
144
|
-
version = {v0.
|
|
159
|
+
version = {v0.7.0}
|
|
145
160
|
}
|
|
146
161
|
```
|
|
147
162
|
|
|
@@ -77,15 +77,30 @@ for a detailed step-by-step procedure.
|
|
|
77
77
|
|
|
78
78
|
<!-- start citing -->
|
|
79
79
|
|
|
80
|
-
If you use this software, please cite it as:
|
|
80
|
+
If you use this software, please cite it as (**preferred**):
|
|
81
81
|
|
|
82
82
|
```bibtex
|
|
83
|
-
@
|
|
84
|
-
title
|
|
83
|
+
@inproceedings{Eertmans_DiffeRT_ICMLCN_2025,
|
|
84
|
+
title = {Demonstrating {DiffeRT}: An Open-Source Library for Optimizing Radio Networks with Differentiable Ray Tracing},
|
|
85
|
+
author = {Eertmans, Jérome and Oestges, Claude and Jacques, Laurent},
|
|
86
|
+
year = 2025,
|
|
87
|
+
booktitle = {2025 IEEE International Conference on Machine Learning for Communication and Networking (ICMLCN)},
|
|
88
|
+
volume = {},
|
|
89
|
+
number = {},
|
|
90
|
+
pages = {1--2},
|
|
91
|
+
doi = {10.1109/ICMLCN64995.2025.11139997}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
or:
|
|
96
|
+
|
|
97
|
+
```bibtex
|
|
98
|
+
@software{Eertmans_DiffeRT_GitHub,
|
|
99
|
+
title = {{DiffeRT}: A Differentiable Ray Tracing Toolbox for Radio Propagation Simulations},
|
|
85
100
|
author = {Eertmans, Jérome},
|
|
86
101
|
url = {https://github.com/jeertmans/DiffeRT},
|
|
87
102
|
license = {MIT},
|
|
88
|
-
version = {v0.
|
|
103
|
+
version = {v0.7.0}
|
|
89
104
|
}
|
|
90
105
|
```
|
|
91
106
|
|
|
@@ -16,13 +16,13 @@ classifiers = [
|
|
|
16
16
|
]
|
|
17
17
|
dependencies = [
|
|
18
18
|
"chex>=0.1.86",
|
|
19
|
-
"differt-core==0.
|
|
20
|
-
"equinox>=0.13.
|
|
19
|
+
"differt-core==0.7.0",
|
|
20
|
+
"equinox>=0.13.4",
|
|
21
21
|
"filelock>=3.15.4",
|
|
22
|
-
"jax
|
|
23
|
-
"
|
|
22
|
+
"fpt-jax==0.1.0",
|
|
23
|
+
"jax>=0.8.1",
|
|
24
|
+
"jaxtyping>=0.3.6",
|
|
24
25
|
"numpy>=1.26.1",
|
|
25
|
-
"optax>=0.1.7",
|
|
26
26
|
"requests>=2.32.0",
|
|
27
27
|
"tqdm>=4.66.2",
|
|
28
28
|
]
|
|
@@ -37,16 +37,11 @@ requires-python = ">=3.11"
|
|
|
37
37
|
all = [
|
|
38
38
|
"differt[jupyter,matplotlib,plotly,vispy,vispy-backend]",
|
|
39
39
|
]
|
|
40
|
-
jupyter = ["notebook>5", "jupyter-rfb>=0.4.2", "ipympl>=0.9.4"]
|
|
40
|
+
jupyter = ["notebook>5", "jupyter-rfb>=0.4.2", "ipympl>=0.9.4", "ipykernel<7"]
|
|
41
41
|
matplotlib = ["matplotlib>=3.8.1"]
|
|
42
42
|
plotly = ["plotly>=5.18.0"]
|
|
43
43
|
vispy = [
|
|
44
44
|
"vispy>=0.14.1",
|
|
45
|
-
# PyOpenGL seems to be needed, see:
|
|
46
|
-
# https://github.com/vispy/vispy/issues/2547
|
|
47
|
-
# https://github.com/vispy/vispy/pull/2549
|
|
48
|
-
# https://github.com/bitcraze/crazyflie-clients-python/pull/708
|
|
49
|
-
"PyOpenGL>=3.1.0;platform_system=='Darwin'",
|
|
50
45
|
]
|
|
51
46
|
vispy-backend = ["PyQt6>=6.6.1"]
|
|
52
47
|
|
|
@@ -41,11 +41,11 @@ def poynting_vector(
|
|
|
41
41
|
class BaseAntenna(eqx.Module):
|
|
42
42
|
"""An antenna class, base class for :class:`Antenna` and :class:`RadiationPattern`."""
|
|
43
43
|
|
|
44
|
-
frequency: Float[Array, "
|
|
44
|
+
frequency: Float[Array, ""]
|
|
45
45
|
"""The frequency :math:`f` at which the antenna is operating."""
|
|
46
46
|
_: KW_ONLY
|
|
47
47
|
center: Float[Array, "3"] = eqx.field(
|
|
48
|
-
|
|
48
|
+
default_factory=lambda: jnp.array([0.0, 0.0, 0.0])
|
|
49
49
|
)
|
|
50
50
|
"""The center position of the antenna, from which the fields are radiated.
|
|
51
51
|
|
|
@@ -53,27 +53,27 @@ class BaseAntenna(eqx.Module):
|
|
|
53
53
|
"""
|
|
54
54
|
|
|
55
55
|
@property
|
|
56
|
-
def period(self) -> Float[Array, "
|
|
56
|
+
def period(self) -> Float[Array, ""]:
|
|
57
57
|
"""The period :math:`T = 1/f`."""
|
|
58
58
|
return 1 / self.frequency
|
|
59
59
|
|
|
60
60
|
@property
|
|
61
|
-
def angular_frequency(self) -> Float[Array, "
|
|
61
|
+
def angular_frequency(self) -> Float[Array, ""]:
|
|
62
62
|
r"""The angular frequency :math:`\omega = 2 \pi f`."""
|
|
63
63
|
return 2 * jnp.pi * self.frequency
|
|
64
64
|
|
|
65
65
|
@property
|
|
66
|
-
def wavelength(self) -> Float[Array, "
|
|
66
|
+
def wavelength(self) -> Float[Array, ""]:
|
|
67
67
|
r"""The wavelength :math:`\lambda = c / f`."""
|
|
68
68
|
return c * self.period
|
|
69
69
|
|
|
70
70
|
@property
|
|
71
|
-
def wavenumber(self) -> Float[Array, "
|
|
71
|
+
def wavenumber(self) -> Float[Array, ""]:
|
|
72
72
|
r"""The wavenumber :math:`k = \omega / c`."""
|
|
73
73
|
return self.angular_frequency / c
|
|
74
74
|
|
|
75
75
|
@property
|
|
76
|
-
def aperture(self) -> Float[Array, "
|
|
76
|
+
def aperture(self) -> Float[Array, ""]:
|
|
77
77
|
r"""The aperture :math:`A` of an isotropic antenna."""
|
|
78
78
|
return self.wavelength**2 / (4 * jnp.pi)
|
|
79
79
|
|
|
@@ -83,7 +83,7 @@ class Antenna(BaseAntenna):
|
|
|
83
83
|
|
|
84
84
|
@property
|
|
85
85
|
@abstractmethod
|
|
86
|
-
def reference_power(self) -> Float[Array, "
|
|
86
|
+
def reference_power(self) -> Float[Array, ""]:
|
|
87
87
|
r"""The reference power (W) radiated by this antenna.
|
|
88
88
|
|
|
89
89
|
This is the maximal value of the Poynting vector at a distance
|
|
@@ -189,7 +189,7 @@ class Antenna(BaseAntenna):
|
|
|
189
189
|
def directive_gain(
|
|
190
190
|
self,
|
|
191
191
|
num_points: int = int(1e2),
|
|
192
|
-
) -> Float[Array, "
|
|
192
|
+
) -> Float[Array, ""]:
|
|
193
193
|
"""
|
|
194
194
|
Compute an estimate of the antenna directive gain.
|
|
195
195
|
|
|
@@ -213,8 +213,8 @@ class Antenna(BaseAntenna):
|
|
|
213
213
|
def plot_radiation_pattern(
|
|
214
214
|
self,
|
|
215
215
|
num_points: int = int(1e2),
|
|
216
|
-
distance: Float[ArrayLike, "
|
|
217
|
-
num_wavelengths: Float[ArrayLike, "
|
|
216
|
+
distance: Float[ArrayLike, ""] = 1.0,
|
|
217
|
+
num_wavelengths: Float[ArrayLike, ""] | None = None,
|
|
218
218
|
**kwargs: Any,
|
|
219
219
|
) -> PlotOutput:
|
|
220
220
|
"""
|
|
@@ -345,24 +345,24 @@ class Dipole(Antenna):
|
|
|
345
345
|
>>> fig # doctest: +SKIP
|
|
346
346
|
"""
|
|
347
347
|
|
|
348
|
-
length: Float[Array, "
|
|
348
|
+
length: Float[Array, ""]
|
|
349
349
|
"""Dipole length (in meter)."""
|
|
350
|
-
moment: Float[Array, "3"]
|
|
350
|
+
moment: Float[Array, "3"]
|
|
351
351
|
"""Dipole moment (in Coulomb-meter)."""
|
|
352
352
|
|
|
353
353
|
def __init__(
|
|
354
354
|
self,
|
|
355
|
-
frequency: Float[ArrayLike, "
|
|
356
|
-
num_wavelengths: Float[ArrayLike, "
|
|
355
|
+
frequency: Float[ArrayLike, ""],
|
|
356
|
+
num_wavelengths: Float[ArrayLike, ""] = 0.5,
|
|
357
357
|
*,
|
|
358
|
-
length: Float[ArrayLike, "
|
|
358
|
+
length: Float[ArrayLike, ""] | None = None,
|
|
359
359
|
moment: Float[ArrayLike, "3"] | None = jnp.array([0.0, 0.0, 1.0]),
|
|
360
|
-
current: Float[ArrayLike, "
|
|
361
|
-
charge: Float[ArrayLike, "
|
|
360
|
+
current: Float[ArrayLike, ""] | None = 1.0,
|
|
361
|
+
charge: Float[ArrayLike, ""] | None = None,
|
|
362
362
|
center: Float[ArrayLike, "3"] = jnp.array([0.0, 0.0, 0.0]),
|
|
363
363
|
look_at: Float[ArrayLike, "3"] | None = None,
|
|
364
364
|
) -> None:
|
|
365
|
-
super().__init__(jnp.asarray(frequency), center=center)
|
|
365
|
+
super().__init__(jnp.asarray(frequency), center=jnp.asarray(center))
|
|
366
366
|
|
|
367
367
|
if length is not None:
|
|
368
368
|
self.length = jnp.asarray(length)
|
|
@@ -391,10 +391,10 @@ class Dipole(Antenna):
|
|
|
391
391
|
)
|
|
392
392
|
)
|
|
393
393
|
|
|
394
|
-
self.moment = moment
|
|
394
|
+
self.moment = moment
|
|
395
395
|
|
|
396
396
|
@property
|
|
397
|
-
def reference_power(self) -> Float[Array, "
|
|
397
|
+
def reference_power(self) -> Float[Array, ""]:
|
|
398
398
|
p_0 = jnp.linalg.norm(self.moment)
|
|
399
399
|
|
|
400
400
|
# Equivalent to
|
|
@@ -475,7 +475,7 @@ class Dipole(Antenna):
|
|
|
475
475
|
def directive_gain( # noqa: PLR6301
|
|
476
476
|
self,
|
|
477
477
|
num_points: int = int(1e2), # noqa: ARG002
|
|
478
|
-
) -> Float[Array, "
|
|
478
|
+
) -> Float[Array, ""]:
|
|
479
479
|
return jnp.array(1.5)
|
|
480
480
|
|
|
481
481
|
|
|
@@ -513,7 +513,7 @@ class ShortDipole(Dipole):
|
|
|
513
513
|
def directive_gain(
|
|
514
514
|
self,
|
|
515
515
|
num_points: int = int(1e2),
|
|
516
|
-
) -> Float[Array, "
|
|
516
|
+
) -> Float[Array, ""]:
|
|
517
517
|
# Bypass Dipole's specialized implementation
|
|
518
518
|
return Antenna.directive_gain(self, num_points=num_points)
|
|
519
519
|
|
|
@@ -585,7 +585,7 @@ class RadiationPattern(BaseAntenna):
|
|
|
585
585
|
def directive_gain(
|
|
586
586
|
self,
|
|
587
587
|
num_points: int = int(1e2),
|
|
588
|
-
) -> Float[Array, "
|
|
588
|
+
) -> Float[Array, ""]:
|
|
589
589
|
"""
|
|
590
590
|
Compute an estimate of the antenna directive gain.
|
|
591
591
|
|
|
@@ -609,8 +609,8 @@ class RadiationPattern(BaseAntenna):
|
|
|
609
609
|
def plot_radiation_pattern(
|
|
610
610
|
self,
|
|
611
611
|
num_points: int = int(1e2),
|
|
612
|
-
distance: Float[ArrayLike, "
|
|
613
|
-
num_wavelengths: Float[ArrayLike, "
|
|
612
|
+
distance: Float[ArrayLike, ""] = 1.0,
|
|
613
|
+
num_wavelengths: Float[ArrayLike, ""] | None = None,
|
|
614
614
|
**kwargs: Any,
|
|
615
615
|
) -> PlotOutput:
|
|
616
616
|
"""
|
|
@@ -662,7 +662,7 @@ class RadiationPattern(BaseAntenna):
|
|
|
662
662
|
class HWDipolePattern(RadiationPattern):
|
|
663
663
|
"""An half-wave dipole radiation pattern."""
|
|
664
664
|
|
|
665
|
-
direction: Float[Array, "3"]
|
|
665
|
+
direction: Float[Array, "3"]
|
|
666
666
|
"""The dipole direction."""
|
|
667
667
|
|
|
668
668
|
def polarization_vectors(
|
|
@@ -686,5 +686,5 @@ class HWDipolePattern(RadiationPattern):
|
|
|
686
686
|
class ShortDipolePattern(RadiationPattern):
|
|
687
687
|
"""An short dipole radiation pattern."""
|
|
688
688
|
|
|
689
|
-
direction: Float[Array, "3"]
|
|
689
|
+
direction: Float[Array, "3"]
|
|
690
690
|
"""The dipole direction."""
|
|
@@ -79,11 +79,11 @@ class Material(eqx.Module):
|
|
|
79
79
|
cls,
|
|
80
80
|
name: str,
|
|
81
81
|
*itu_properties: tuple[
|
|
82
|
-
Float[ArrayLike, "
|
|
83
|
-
Float[ArrayLike, "
|
|
84
|
-
Float[ArrayLike, "
|
|
85
|
-
Float[ArrayLike, "
|
|
86
|
-
tuple[Float[ArrayLike, "
|
|
82
|
+
Float[ArrayLike, ""],
|
|
83
|
+
Float[ArrayLike, ""],
|
|
84
|
+
Float[ArrayLike, ""],
|
|
85
|
+
Float[ArrayLike, ""],
|
|
86
|
+
tuple[Float[ArrayLike, ""], Float[ArrayLike, ""]] | None,
|
|
87
87
|
],
|
|
88
88
|
) -> Self:
|
|
89
89
|
r"""
|
|
@@ -130,13 +130,13 @@ class Material(eqx.Module):
|
|
|
130
130
|
|
|
131
131
|
aliases = ("itu_" + name.lower().replace(" ", "_"),)
|
|
132
132
|
|
|
133
|
-
@
|
|
133
|
+
@jax.jit(inline=True, static_argnums=(1, 2, 3, 4))
|
|
134
134
|
def callback(
|
|
135
135
|
f: Float[ArrayLike, " *batch"],
|
|
136
|
-
a: Float[ArrayLike, "
|
|
137
|
-
b: Float[ArrayLike, "
|
|
138
|
-
c: Float[ArrayLike, "
|
|
139
|
-
d: Float[ArrayLike, "
|
|
136
|
+
a: Float[ArrayLike, ""],
|
|
137
|
+
b: Float[ArrayLike, ""],
|
|
138
|
+
c: Float[ArrayLike, ""],
|
|
139
|
+
d: Float[ArrayLike, ""],
|
|
140
140
|
) -> tuple[Float[Array, "*batch"], Float[Array, "*batch"]]:
|
|
141
141
|
f_ghz = jnp.asarray(f) / 1e9
|
|
142
142
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# ruff: noqa: N802, N806
|
|
2
2
|
# type: ignore # noqa: PGH003
|
|
3
|
-
from functools import partial
|
|
4
3
|
from typing import Any, Literal, overload
|
|
5
4
|
|
|
6
5
|
import equinox as eqx
|
|
@@ -12,18 +11,18 @@ from jaxtyping import Array, Complex, Float
|
|
|
12
11
|
# TODO: use ArrayLike instead of Array as inputs
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
@
|
|
14
|
+
@jax.jit(inline=True)
|
|
16
15
|
def _cot(x: Float[Array, " *batch"]) -> Float[Array, " *batch"]:
|
|
17
16
|
return 1 / jnp.tan(x)
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
@
|
|
19
|
+
@jax.jit(inline=True)
|
|
21
20
|
def _sign(x: Float[Array, " *batch"]) -> Float[Array, " *batch"]:
|
|
22
21
|
ones = jnp.ones_like(x)
|
|
23
22
|
return jnp.where(x >= 0, ones, -ones)
|
|
24
23
|
|
|
25
24
|
|
|
26
|
-
@
|
|
25
|
+
@jax.jit(inline=True, static_argnames=("mode"))
|
|
27
26
|
def _N(
|
|
28
27
|
beta: Float[Array, " *#batch"], n: Float[Array, " *#batch"], mode: Literal["+", "-"]
|
|
29
28
|
) -> Float[Array, " *batch"]:
|
|
@@ -32,7 +31,7 @@ def _N(
|
|
|
32
31
|
return jnp.round((beta + jnp.pi) / (2 * n * jnp.pi))
|
|
33
32
|
|
|
34
33
|
|
|
35
|
-
@
|
|
34
|
+
@jax.jit(inline=True, static_argnames=("mode"))
|
|
36
35
|
def _a(
|
|
37
36
|
beta: Float[Array, " *#batch"], n: Float[Array, " *#batch"], mode: Literal["+", "-"]
|
|
38
37
|
) -> Float[Array, " *batch"]:
|
|
@@ -44,10 +43,10 @@ def _a(
|
|
|
44
43
|
def L_i(
|
|
45
44
|
s_d: Float[Array, " *#batch"],
|
|
46
45
|
sin_2_beta_0: Float[Array, " *#batch"],
|
|
47
|
-
rho_1_i: None =
|
|
48
|
-
rho_2_i: None =
|
|
49
|
-
rho_e_i: None =
|
|
50
|
-
s_i: None =
|
|
46
|
+
rho_1_i: None = ...,
|
|
47
|
+
rho_2_i: None = ...,
|
|
48
|
+
rho_e_i: None = ...,
|
|
49
|
+
s_i: None = ...,
|
|
51
50
|
) -> Float[Array, " *batch"]: ...
|
|
52
51
|
|
|
53
52
|
|
|
@@ -55,10 +54,10 @@ def L_i(
|
|
|
55
54
|
def L_i(
|
|
56
55
|
s_d: Float[Array, " *#batch"],
|
|
57
56
|
sin_2_beta_0: Float[Array, " *#batch"],
|
|
58
|
-
rho_1_i: None =
|
|
59
|
-
rho_2_i: None =
|
|
60
|
-
rho_e_i: None =
|
|
61
|
-
s_i: Float[Array, " *#batch"] | None =
|
|
57
|
+
rho_1_i: None = ...,
|
|
58
|
+
rho_2_i: None = ...,
|
|
59
|
+
rho_e_i: None = ...,
|
|
60
|
+
s_i: Float[Array, " *#batch"] | None = ...,
|
|
62
61
|
) -> Float[Array, " *batch"]: ...
|
|
63
62
|
|
|
64
63
|
|
|
@@ -69,7 +68,7 @@ def L_i(
|
|
|
69
68
|
rho_1_i: Float[Array, " *#batch"],
|
|
70
69
|
rho_2_i: Float[Array, " *#batch"],
|
|
71
70
|
rho_e_i: Float[Array, " *#batch"],
|
|
72
|
-
s_i: None =
|
|
71
|
+
s_i: None = ...,
|
|
73
72
|
) -> Float[Array, " *batch"]: ...
|
|
74
73
|
|
|
75
74
|
|
|
@@ -255,7 +254,7 @@ def diffraction_coefficients(
|
|
|
255
254
|
Raises:
|
|
256
255
|
NotImplementedError: The function is not yet implemented.
|
|
257
256
|
"""
|
|
258
|
-
# ruff: noqa:
|
|
257
|
+
# ruff: noqa: F821, F841
|
|
259
258
|
raise NotImplementedError
|
|
260
259
|
|
|
261
260
|
# Ensure input vectors are normalized
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from functools import partial
|
|
2
1
|
from typing import Any
|
|
3
2
|
|
|
4
3
|
import jax
|
|
@@ -258,7 +257,7 @@ def sp_directions(
|
|
|
258
257
|
normal_incidence,
|
|
259
258
|
perpendicular_vectors(k_i),
|
|
260
259
|
e_i_s,
|
|
261
|
-
)
|
|
260
|
+
)
|
|
262
261
|
e_i_p = normalize(jnp.cross(e_i_s, k_i))[0]
|
|
263
262
|
e_r_s = e_i_s
|
|
264
263
|
e_r_p = normalize(jnp.cross(e_r_s, k_r))[0]
|
|
@@ -311,23 +310,12 @@ def transition_matrices(
|
|
|
311
310
|
interaction_types: Int[ArrayLike, "*batch path_length-2"],
|
|
312
311
|
object_normals: Float[ArrayLike, "*batch path_length 3"],
|
|
313
312
|
) -> Float[Array, "*batch 2 2"]:
|
|
314
|
-
# ruff: noqa: D417, DOC202
|
|
315
313
|
"""
|
|
316
314
|
Compute the transition matrix, ...
|
|
317
315
|
|
|
318
|
-
|
|
319
|
-
k_i: The array of propagation direction of incident fields.
|
|
320
|
-
|
|
321
|
-
Each vector must have a unit length.
|
|
322
|
-
k_r: The array of propagation direction of reflected fields.
|
|
323
|
-
|
|
324
|
-
Each vector must have a unit length.
|
|
325
|
-
normals: The array of local normals.
|
|
326
|
-
|
|
327
|
-
Each vector must have a unit length.
|
|
316
|
+
.. warning::
|
|
328
317
|
|
|
329
|
-
|
|
330
|
-
The array of s and p directions, before and after reflection.
|
|
318
|
+
Do not use this function yet, it is not implemented!
|
|
331
319
|
"""
|
|
332
320
|
vertices = jnp.asarray(vertices)
|
|
333
321
|
objects = jnp.asarray(objects)
|
|
@@ -354,7 +342,7 @@ def transition_matrices(
|
|
|
354
342
|
raise NotImplementedError
|
|
355
343
|
|
|
356
344
|
|
|
357
|
-
@
|
|
345
|
+
@jax.jit(static_argnames=("dB",))
|
|
358
346
|
def fspl(
|
|
359
347
|
d: Float[ArrayLike, " *#batch"],
|
|
360
348
|
f: Float[ArrayLike, " *#batch"],
|