differt 0.4.1__tar.gz → 0.6.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.
Files changed (35) hide show
  1. {differt-0.4.1 → differt-0.6.0}/PKG-INFO +15 -9
  2. {differt-0.4.1 → differt-0.6.0}/README.md +11 -3
  3. {differt-0.4.1 → differt-0.6.0}/pyproject.toml +3 -5
  4. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_antenna.py +25 -25
  5. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_fresnel.py +6 -7
  6. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_material.py +3 -8
  7. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_utd.py +3 -5
  8. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_utils.py +4 -5
  9. {differt-0.4.1 → differt-0.6.0}/src/differt/geometry/__init__.py +0 -2
  10. {differt-0.4.1 → differt-0.6.0}/src/differt/geometry/_paths.py +10 -15
  11. {differt-0.4.1 → differt-0.6.0}/src/differt/geometry/_triangle_mesh.py +67 -107
  12. {differt-0.4.1 → differt-0.6.0}/src/differt/geometry/_utils.py +41 -54
  13. {differt-0.4.1 → differt-0.6.0}/src/differt/plotting/__init__.py +2 -0
  14. {differt-0.4.1 → differt-0.6.0}/src/differt/plotting/_core.py +4 -5
  15. {differt-0.4.1 → differt-0.6.0}/src/differt/plotting/_utils.py +44 -7
  16. {differt-0.4.1 → differt-0.6.0}/src/differt/plugins/_deepmimo_types.py +1 -1
  17. {differt-0.4.1 → differt-0.6.0}/src/differt/plugins/deepmimo.py +10 -10
  18. {differt-0.4.1 → differt-0.6.0}/src/differt/rt/_image_method.py +26 -16
  19. {differt-0.4.1 → differt-0.6.0}/src/differt/rt/_utils.py +237 -142
  20. {differt-0.4.1 → differt-0.6.0}/src/differt/scene/_sionna.py +3 -3
  21. {differt-0.4.1 → differt-0.6.0}/src/differt/scene/_triangle_scene.py +222 -267
  22. differt-0.6.0/src/differt/utils.py +91 -0
  23. differt-0.4.1/src/differt/utils.py +0 -214
  24. {differt-0.4.1 → differt-0.6.0}/.gitignore +0 -0
  25. {differt-0.4.1 → differt-0.6.0}/LICENSE.md +0 -0
  26. {differt-0.4.1 → differt-0.6.0}/src/differt/__init__.py +0 -0
  27. {differt-0.4.1 → differt-0.6.0}/src/differt/_version.py +0 -0
  28. {differt-0.4.1 → differt-0.6.0}/src/differt/em/__init__.py +0 -0
  29. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_constants.py +0 -0
  30. {differt-0.4.1 → differt-0.6.0}/src/differt/em/_interaction_type.py +0 -0
  31. {differt-0.4.1 → differt-0.6.0}/src/differt/plugins/__init__.py +0 -0
  32. {differt-0.4.1 → differt-0.6.0}/src/differt/py.typed +0 -0
  33. {differt-0.4.1 → differt-0.6.0}/src/differt/rt/__init__.py +0 -0
  34. {differt-0.4.1 → differt-0.6.0}/src/differt/rt/_fermat.py +0 -0
  35. {differt-0.4.1 → differt-0.6.0}/src/differt/scene/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DiffeRT
3
- Version: 0.4.1
3
+ Version: 0.6.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
@@ -14,23 +14,21 @@ Keywords: differentiable,jax,propagation,radio,ray tracing
14
14
  Classifier: License :: OSI Approved :: MIT License
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python :: 3
17
- Classifier: Programming Language :: Python :: 3.10
18
17
  Classifier: Programming Language :: Python :: 3.11
19
18
  Classifier: Programming Language :: Python :: 3.12
20
19
  Classifier: Programming Language :: Python :: 3.13
21
20
  Classifier: Topic :: Scientific/Engineering
22
- Requires-Python: >=3.10
21
+ Requires-Python: >=3.11
23
22
  Requires-Dist: chex>=0.1.86
24
- Requires-Dist: differt-core==0.4.1
23
+ Requires-Dist: differt-core==0.6.0
25
24
  Requires-Dist: equinox>=0.12.2
26
25
  Requires-Dist: filelock>=3.15.4
27
- Requires-Dist: jax>=0.4.32
26
+ Requires-Dist: jax>=0.7.0
28
27
  Requires-Dist: jaxtyping>=0.3.2
29
28
  Requires-Dist: numpy>=1.26.1
30
29
  Requires-Dist: optax>=0.1.7
31
30
  Requires-Dist: requests>=2.32.0
32
31
  Requires-Dist: tqdm>=4.66.2
33
- Requires-Dist: typing-extensions>=4.9.0; python_version < '3.11'
34
32
  Provides-Extra: all
35
33
  Requires-Dist: ipympl>=0.9.4; extra == 'all'
36
34
  Requires-Dist: jupyter-rfb>=0.4.2; extra == 'all'
@@ -78,7 +76,7 @@ Differentiable Ray Tracing toolbox for Radio Propagation powered by the [JAX eco
78
76
  > **WARNING:**
79
77
  > This package is still under important development, see
80
78
  > the [v1.0.0](https://github.com/jeertmans/DiffeRT/milestone/2) milestone for future
81
- > features, and the [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/README.md)
79
+ > features, and the [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/CHANGELOG.md)
82
80
  > for versioning policy.
83
81
  >
84
82
  > If you have any suggestion regarding the development of this package,
@@ -116,7 +114,7 @@ if your issue does not fit one of the proposed topics.
116
114
  The more precise you are in the description of your problem, the faster we will
117
115
  be able to help you!
118
116
 
119
- If you rather have question than a problem,
117
+ If you rather have a question than a problem,
120
118
  then it is probably best suited to ask it in the
121
119
  [Q&A category of the discussions](https://github.com/jeertmans/DiffeRT/discussions/categories/q-a).
122
120
 
@@ -132,6 +130,8 @@ for a detailed step-by-step procedure.
132
130
 
133
131
  ## Citing
134
132
 
133
+ <!-- start citing -->
134
+
135
135
  If you use this software, please cite it as:
136
136
 
137
137
  ```bibtex
@@ -140,10 +140,16 @@ If you use this software, please cite it as:
140
140
  author = {Eertmans, Jérome},
141
141
  url = {https://github.com/jeertmans/DiffeRT},
142
142
  license = {MIT},
143
- version = {v0.4.1}
143
+ version = {v0.6.0}
144
144
  }
145
145
  ```
146
146
 
147
+ For other citation formats, please refer to the [*Cite this repository*](https://github.com/jeertmans/DiffeRT) button the main page of our GitHub repository or to our [Zenodo records](https://doi.org/10.5281/zenodo.11386432).
148
+
149
+ Thank you for using this software and helping us!
150
+
151
+ <!-- end citing -->
152
+
147
153
  [pypi-version-badge]: https://img.shields.io/pypi/v/DiffeRT?label=DiffeRT&color=blueviolet
148
154
  [pypi-version-url]: https://pypi.org/project/DiffeRT/
149
155
  [pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/DiffeRT?color=orange
@@ -21,7 +21,7 @@ Differentiable Ray Tracing toolbox for Radio Propagation powered by the [JAX eco
21
21
  > [!WARNING]
22
22
  > This package is still under important development, see
23
23
  > the [v1.0.0](https://github.com/jeertmans/DiffeRT/milestone/2) milestone for future
24
- > features, and the [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/README.md)
24
+ > features, and the [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/CHANGELOG.md)
25
25
  > for versioning policy.
26
26
  >
27
27
  > If you have any suggestion regarding the development of this package,
@@ -59,7 +59,7 @@ if your issue does not fit one of the proposed topics.
59
59
  The more precise you are in the description of your problem, the faster we will
60
60
  be able to help you!
61
61
 
62
- If you rather have question than a problem,
62
+ If you rather have a question than a problem,
63
63
  then it is probably best suited to ask it in the
64
64
  [Q&A category of the discussions](https://github.com/jeertmans/DiffeRT/discussions/categories/q-a).
65
65
 
@@ -75,6 +75,8 @@ for a detailed step-by-step procedure.
75
75
 
76
76
  ## Citing
77
77
 
78
+ <!-- start citing -->
79
+
78
80
  If you use this software, please cite it as:
79
81
 
80
82
  ```bibtex
@@ -83,10 +85,16 @@ If you use this software, please cite it as:
83
85
  author = {Eertmans, Jérome},
84
86
  url = {https://github.com/jeertmans/DiffeRT},
85
87
  license = {MIT},
86
- version = {v0.4.1}
88
+ version = {v0.6.0}
87
89
  }
88
90
  ```
89
91
 
92
+ For other citation formats, please refer to the [*Cite this repository*](https://github.com/jeertmans/DiffeRT) button the main page of our GitHub repository or to our [Zenodo records](https://doi.org/10.5281/zenodo.11386432).
93
+
94
+ Thank you for using this software and helping us!
95
+
96
+ <!-- end citing -->
97
+
90
98
  [pypi-version-badge]: https://img.shields.io/pypi/v/DiffeRT?label=DiffeRT&color=blueviolet
91
99
  [pypi-version-url]: https://pypi.org/project/DiffeRT/
92
100
  [pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/DiffeRT?color=orange
@@ -6,7 +6,6 @@ requires = ["hatchling", "hatch-fancy-pypi-readme"]
6
6
  authors = [{name = "Jérome Eertmans", email = "jeertmans@icloud.com"}]
7
7
  classifiers = [
8
8
  "Programming Language :: Python :: 3",
9
- "Programming Language :: Python :: 3.10",
10
9
  "Programming Language :: Python :: 3.11",
11
10
  "Programming Language :: Python :: 3.12",
12
11
  "Programming Language :: Python :: 3.13",
@@ -16,14 +15,13 @@ classifiers = [
16
15
  ]
17
16
  dependencies = [
18
17
  "chex>=0.1.86",
19
- "differt-core==0.4.1",
18
+ "differt-core==0.6.0",
20
19
  "equinox>=0.12.2",
21
20
  "filelock>=3.15.4",
22
- "jax>=0.4.32", # TODO: fixme, issue with pmap
21
+ "jax>=0.7.0",
23
22
  "jaxtyping>=0.3.2",
24
23
  "numpy>=1.26.1",
25
24
  "optax>=0.1.7",
26
- "typing-extensions>=4.9.0;python_version<'3.11'",
27
25
  "requests>=2.32.0",
28
26
  "tqdm>=4.66.2",
29
27
  ]
@@ -32,7 +30,7 @@ dynamic = ["readme", "version"]
32
30
  keywords = ["ray tracing", "differentiable", "propagation", "radio", "jax"]
33
31
  license = "MIT"
34
32
  name = "DiffeRT"
35
- requires-python = ">=3.10"
33
+ requires-python = ">=3.11"
36
34
 
37
35
  [project.optional-dependencies]
38
36
  all = [
@@ -13,7 +13,7 @@ from differt.geometry import (
13
13
  spherical_to_cartesian,
14
14
  )
15
15
  from differt.plotting import PlotOutput, draw_surface
16
- from differt.utils import dot, safe_divide
16
+ from differt.utils import safe_divide
17
17
 
18
18
  from ._constants import c, epsilon_0, mu_0
19
19
 
@@ -24,16 +24,16 @@ def poynting_vector(
24
24
  b: Inexact[ArrayLike, "*#batch 3"],
25
25
  ) -> Inexact[Array, "*batch 3"]:
26
26
  r"""
27
- Compute the Pointing vector in vacuum at from electric :math:`\vec{E}` and magnetic :math:`\vec{B}` fields.
27
+ Compute the Poynting vector in vacuum from electric :math:`\vec{E}` and magnetic :math:`\vec{B}` fields.
28
28
 
29
29
  Args:
30
30
  e: The electrical field.
31
- b: The magnetical field.
31
+ b: The magnetic field.
32
32
 
33
33
  Returns:
34
- The pointing vector :math:`\vec{S}`.
34
+ The Poynting vector :math:`\vec{S}`.
35
35
 
36
- It can be either real of complex-valued.
36
+ It can be either real or complex-valued.
37
37
  """
38
38
  return jnp.cross(jnp.asarray(e), jnp.asarray(b)) / mu_0
39
39
 
@@ -86,7 +86,7 @@ class Antenna(BaseAntenna):
86
86
  def reference_power(self) -> Float[Array, " "]:
87
87
  r"""The reference power (W) radiated by this antenna.
88
88
 
89
- This is the maximal value of the pointing vector at a distance
89
+ This is the maximal value of the Poynting vector at a distance
90
90
  of one meter from this antenna, multiplied by the area of the sphere
91
91
  (:math:`4\phi`),
92
92
  to obtain a power.
@@ -109,7 +109,7 @@ class Antenna(BaseAntenna):
109
109
  is assumed.
110
110
 
111
111
  Returns:
112
- The electric :math:`\vec{E}` and magnetical :math:`\vec{B}` fields.
112
+ The electric :math:`\vec{E}` and magnetic :math:`\vec{B}` fields.
113
113
 
114
114
  Fields can be either real or complex-valued.
115
115
  """
@@ -131,9 +131,9 @@ class Antenna(BaseAntenna):
131
131
  is assumed.
132
132
 
133
133
  Returns:
134
- The pointing vector :math:`\vec{S}`.
134
+ The Poynting vector :math:`\vec{S}`.
135
135
 
136
- It can be either real of complex-valued.
136
+ It can be either real or complex-valued.
137
137
  """
138
138
  e, b = self.fields(r, t)
139
139
  return poynting_vector(e, b)
@@ -147,7 +147,7 @@ class Antenna(BaseAntenna):
147
147
  Float[Array, "2*{num_points} {num_points}"],
148
148
  ]:
149
149
  """
150
- Compute an estimate of the antenna directivity for azimutal and elevation angles.
150
+ Compute an estimate of the antenna directivity for azimuthal and elevation angles.
151
151
 
152
152
  .. note::
153
153
 
@@ -157,10 +157,10 @@ class Antenna(BaseAntenna):
157
157
  Args:
158
158
  num_points: The number of points to sample along the elevation axis.
159
159
 
160
- Twice this number of points are sampled on the aximutal axis.
160
+ Twice this number of points are sampled on the azimuthal axis.
161
161
 
162
162
  Returns:
163
- Azimutal and elevation angles, as well as corresponding directivity values.
163
+ Azimuthal and elevation angles, as well as corresponding directivity values.
164
164
 
165
165
  .. seealso::
166
166
 
@@ -220,12 +220,12 @@ class Antenna(BaseAntenna):
220
220
  """
221
221
  Plot the radiation pattern (normalized power) of this antenna.
222
222
 
223
- The power is computed on points on an sphere around the antenna.
223
+ The power is computed on points on a sphere around the antenna.
224
224
 
225
225
  Args:
226
226
  num_points: The number of points to sample along the elevation axis.
227
227
 
228
- Twice this number of points are sampled on the aximutal axis.
228
+ Twice this number of points are sampled on the azimuthal axis.
229
229
  distance: The distance from the antenna at which power samples
230
230
  are evaluated.
231
231
  num_wavelengths: If provided, supersedes ``distance`` by setting
@@ -279,8 +279,8 @@ class Dipole(Antenna):
279
279
  By default, the dipole is aligned with the z-axis.
280
280
  current: The current (in A) flowing in the dipole.
281
281
 
282
- If this is provided, which is the default, the only the direction of the moment
283
- vector is used, and its insensity is set to match the dipole moment with
282
+ If this is provided, which is the default, only the direction of the moment
283
+ vector is used, and its intensity is set to match the dipole moment with
284
284
  specified current.
285
285
  charge: The dipole charge (in Coulomb), assuming opposite charges on either ends of the dipole.
286
286
 
@@ -533,7 +533,7 @@ class RadiationPattern(BaseAntenna):
533
533
  r: The array of positions.
534
534
 
535
535
  Returns:
536
- The electric :math:`\vec{E}` and magnetical :math:`\vec{B}` fields.
536
+ The electric :math:`\vec{E}` and magnetic :math:`\vec{B}` fields.
537
537
 
538
538
  Fields can be either real or complex-valued.
539
539
  """
@@ -547,7 +547,7 @@ class RadiationPattern(BaseAntenna):
547
547
  Float[Array, "2*{num_points} {num_points}"],
548
548
  ]:
549
549
  """
550
- Compute an estimate of the antenna directivity for azimutal and elevation angles.
550
+ Compute an estimate of the antenna directivity for azimuthal and elevation angles.
551
551
 
552
552
  .. note::
553
553
 
@@ -557,10 +557,10 @@ class RadiationPattern(BaseAntenna):
557
557
  Args:
558
558
  num_points: The number of points to sample along the elevation axis.
559
559
 
560
- Twice this number of points are sampled on the aximutal axis.
560
+ Twice this number of points are sampled on the azimuthal axis.
561
561
 
562
562
  Returns:
563
- Azimutal and elevation angles, as well as corresponding directivity values.
563
+ Azimuthal and elevation angles, as well as corresponding directivity values.
564
564
 
565
565
  .. seealso::
566
566
 
@@ -576,7 +576,7 @@ class RadiationPattern(BaseAntenna):
576
576
 
577
577
  s, p = self.polarization_vectors(r)
578
578
 
579
- g = dot(s) + dot(p)
579
+ g = jnp.sum(s * s, axis=-1) + jnp.sum(p * p, axis=-1)
580
580
 
581
581
  # TODO: check if this is correct
582
582
 
@@ -616,12 +616,12 @@ class RadiationPattern(BaseAntenna):
616
616
  """
617
617
  Plot the radiation pattern (normalized power) of this antenna.
618
618
 
619
- The power is computed on points on an sphere around the antenna.
619
+ The power is computed on points on a sphere around the antenna.
620
620
 
621
621
  Args:
622
622
  num_points: The number of points to sample along the elevation axis.
623
623
 
624
- Twice this number of points are sampled on the aximutal axis.
624
+ Twice this number of points are sampled on the azimuthal axis.
625
625
  distance: The distance from the antenna at which power samples
626
626
  are evaluated.
627
627
  num_wavelengths: If provided, supersedes ``distance`` by setting
@@ -672,12 +672,12 @@ class HWDipolePattern(RadiationPattern):
672
672
  r = jnp.asarray(r)
673
673
  r_hat, r = normalize(r - self.center, keepdims=True)
674
674
 
675
- cos_theta = dot(r_hat, self.direction)
675
+ cos_theta = jnp.sum(r_hat * self.direction, axis=-1)
676
676
  sin_theta = jnp.sqrt(1 - cos_theta**2)
677
677
 
678
678
  d = 1.640922376984585 # Directive gain: 4 / Cin(2*pi)
679
679
 
680
- cos_theta = dot(d)
680
+ cos_theta = jnp.sum(d * d, axis=-1)
681
681
  sin_theta = jnp.sin(d)
682
682
  _d = safe_divide(jnp.cos(0.5 * jnp.pi * cos_theta), sin_theta)
683
683
  raise NotImplementedError
@@ -258,7 +258,6 @@ def reflection_coefficients(
258
258
  ... )
259
259
  >>> from differt.geometry import normalize
260
260
  >>> from differt.rt import image_method
261
- >>> from differt.utils import dot
262
261
 
263
262
  The first step is to define the antenna and the geometry of the scene.
264
263
  Here, we place a dipole antenna above the origin, and generate a
@@ -344,7 +343,7 @@ def reflection_coefficients(
344
343
  >>> # [num_positions 3]
345
344
  >>> E_i, B_i = ant.fields(reflection_points - tx_position, t=-tau)
346
345
  >>> # [num_positions 1]
347
- >>> cos_theta = dot(ground_normal, -k_i, keepdims=True)
346
+ >>> cos_theta = jnp.sum(ground_normal * -k_i, axis=-1, keepdims=True)
348
347
  >>> n_r = 1.5 # Air to glass
349
348
  >>> # [num_positions 1]
350
349
  >>> r_s, r_p = reflection_coefficients(n_r, cos_theta)
@@ -366,10 +365,10 @@ def reflection_coefficients(
366
365
  We then transform XYZ-components into local s and p components.
367
366
 
368
367
  >>> # [num_positions 1]
369
- >>> E_i_s = dot(E_i, e_i_s, keepdims=True)
370
- >>> E_i_p = dot(E_i, e_i_p, keepdims=True)
371
- >>> B_i_s = dot(B_i, e_i_s, keepdims=True)
372
- >>> B_i_p = dot(B_i, e_i_p, keepdims=True)
368
+ >>> E_i_s = jnp.sum(E_i * e_i_s, axis=-1, keepdims=True)
369
+ >>> E_i_p = jnp.sum(E_i * e_i_p, axis=-1, keepdims=True)
370
+ >>> B_i_s = jnp.sum(B_i * e_i_s, axis=-1, keepdims=True)
371
+ >>> B_i_p = jnp.sum(B_i * e_i_p, axis=-1, keepdims=True)
373
372
 
374
373
  Then, we apply reflection coefficients to the local s and p components.
375
374
 
@@ -446,7 +445,7 @@ def reflection_coefficients(
446
445
  ... color="green",
447
446
  ... label="Exact",
448
447
  ... ) # doctest: +SKIP
449
- >>> P_tot_pw = A_e * dot(E_tot, E_tot) / z_0
448
+ >>> P_tot_pw = A_e * jnp.sum(E_tot * E_tot, axis=-1) / z_0
450
449
  >>> plt.semilogx(
451
450
  ... x,
452
451
  ... 10 * jnp.log10(P_tot_pw / ant.reference_power),
@@ -1,7 +1,7 @@
1
1
  # ruff: noqa: FURB152
2
2
 
3
3
  import operator
4
- import os
4
+ import typing
5
5
  from collections.abc import Callable
6
6
  from functools import partial
7
7
  from typing import TYPE_CHECKING, Any
@@ -11,13 +11,8 @@ import jax
11
11
  import jax.numpy as jnp
12
12
  from jaxtyping import Array, ArrayLike, Float
13
13
 
14
- if TYPE_CHECKING or "READTHEDOCS" in os.environ:
15
- import sys
16
-
17
- if sys.version_info >= (3, 11):
18
- from typing import Self
19
- else:
20
- from typing_extensions import Self
14
+ if TYPE_CHECKING or hasattr(typing, "GENERATING_DOCS"):
15
+ from typing import Self
21
16
  else:
22
17
  Self = Any # Because runtime type checking from 'beartype' will fail when combined with 'jaxtyping'
23
18
 
@@ -8,8 +8,6 @@ import jax.numpy as jnp
8
8
  import jax.scipy.special as jsp
9
9
  from jaxtyping import Array, Complex, Float
10
10
 
11
- from differt.utils import dot
12
-
13
11
  # TODO: use ArrayLike instead of Array as inputs
14
12
 
15
13
 
@@ -100,10 +98,10 @@ def L_i(
100
98
 
101
99
  where :math:`s^d` is the distance from the point of diffraction (:math:`Q_d`) to the observer
102
100
  point (:math:`P`),
103
- :math:`\rho_1^i` is the principal radius of curvature of the incident wavewront at :math:`Q_d`
101
+ :math:`\rho_1^i` is the principal radius of curvature of the incident wavefront at :math:`Q_d`
104
102
  in the plane of incidence,
105
- :math:`\rho_2^i` is the principal radius of curvature of the incident wavewront at :math:`Q_d`
106
- in the place transverse to the plane of incidence,
103
+ :math:`\rho_2^i` is the principal radius of curvature of the incident wavefront at :math:`Q_d`
104
+ in the plane transverse to the plane of incidence,
107
105
  :math:`\rho_e^i` is radius of curvature of the incident wavefront in the edge-fixed
108
106
  plane of incidence., and :math:`\beta_0` is the angle of diffraction.
109
107
 
@@ -6,7 +6,6 @@ import jax.numpy as jnp
6
6
  from jaxtyping import Array, ArrayLike, Float, Int
7
7
 
8
8
  from differt.geometry import normalize, path_lengths, perpendicular_vectors
9
- from differt.utils import dot
10
9
 
11
10
  from ._constants import c
12
11
  from ._interaction_type import InteractionType
@@ -293,10 +292,10 @@ def sp_rotation_matrix(
293
292
  e_a_p = jnp.asarray(e_a_p)
294
293
  e_b_s = jnp.asarray(e_b_s)
295
294
  e_b_p = jnp.asarray(e_b_p)
296
- r11 = dot(e_b_s, e_a_s, keepdims=True)
297
- r12 = dot(e_b_s, e_a_p, keepdims=True)
298
- r21 = dot(e_b_p, e_a_s, keepdims=True)
299
- r22 = dot(e_b_p, e_a_p, keepdims=True)
295
+ r11 = jnp.sum(e_b_s * e_a_s, axis=-1, keepdims=True)
296
+ r12 = jnp.sum(e_b_s * e_a_p, axis=-1, keepdims=True)
297
+ r21 = jnp.sum(e_b_p * e_a_s, axis=-1, keepdims=True)
298
+ r22 = jnp.sum(e_b_p * e_a_p, axis=-1, keepdims=True)
300
299
 
301
300
  r11, r12, r21, r22 = jnp.broadcast_arrays(r11, r12, r21, r22)
302
301
 
@@ -11,7 +11,6 @@ __all__ = (
11
11
  "min_distance_between_cells",
12
12
  "normalize",
13
13
  "orthogonal_basis",
14
- "pairwise_cross",
15
14
  "path_lengths",
16
15
  "perpendicular_vectors",
17
16
  "rotation_matrix_along_axis",
@@ -35,7 +34,6 @@ from ._utils import (
35
34
  min_distance_between_cells,
36
35
  normalize,
37
36
  orthogonal_basis,
38
- pairwise_cross,
39
37
  path_lengths,
40
38
  perpendicular_vectors,
41
39
  rotation_matrix_along_axis,
@@ -1,5 +1,5 @@
1
1
  import math
2
- import os
2
+ import typing
3
3
  import warnings
4
4
  from collections.abc import Callable, Iterator, Sequence
5
5
  from dataclasses import KW_ONLY
@@ -12,13 +12,8 @@ from jaxtyping import Array, ArrayLike, Bool, Float, Int, Num, Shaped
12
12
 
13
13
  from differt.plotting import PlotOutput, draw_paths, reuse
14
14
 
15
- if TYPE_CHECKING or "READTHEDOCS" in os.environ:
16
- import sys
17
-
18
- if sys.version_info >= (3, 11):
19
- from typing import Self
20
- else:
21
- from typing_extensions import Self
15
+ if TYPE_CHECKING or hasattr(typing, "GENERATING_DOCS"):
16
+ from typing import Self
22
17
  else:
23
18
  Self = Any # Because runtime type checking from 'beartype' will fail when combined with 'jaxtyping'
24
19
 
@@ -102,7 +97,7 @@ class Paths(eqx.Module):
102
97
  )
103
98
  """An optional mask to indicate which paths are valid and should be used.
104
99
 
105
- The mask is kept separately to :attr:`vertices` so that we can keep information
100
+ The mask is kept separately to :attr:`vertices` so that we can keep information about
106
101
  batch ``*batch`` dimensions, which would not be possible if we were to directly
107
102
  store valid paths.
108
103
  """
@@ -147,7 +142,7 @@ class Paths(eqx.Module):
147
142
 
148
143
  def reshape(self, *batch: int) -> Self:
149
144
  """
150
- Return a copy with reshaped paths' batch dimensions to match a given shape.
145
+ Return a new paths instance with reshaped paths' batch dimensions to match a given shape.
151
146
 
152
147
  Args:
153
148
  batch: The new batch shapes.
@@ -182,7 +177,7 @@ class Paths(eqx.Module):
182
177
 
183
178
  def squeeze(self, axis: int | Sequence[int] | None = None) -> Self:
184
179
  """
185
- Return a copy by squeezing one or more axes of paths' batch dimensions.
180
+ Return a new paths instance by squeezing one or more axes of paths' batch dimensions.
186
181
 
187
182
  Args:
188
183
  axis: See :func:`jax.numpy.squeeze` for allowed values.
@@ -235,7 +230,7 @@ class Paths(eqx.Module):
235
230
  @eqx.filter_jit
236
231
  def mask_duplicate_objects(self, axis: int = -1) -> Self:
237
232
  """
238
- Return a copy by masking duplicate objects along a given axis.
233
+ Return a new paths instance by masking duplicate objects along a given axis.
239
234
 
240
235
  E.g., when generating path candidates from a generative Machine Learning model,
241
236
  see :ref:`sampling-paths`, it is possible that the model generates the same
@@ -363,7 +358,7 @@ class Paths(eqx.Module):
363
358
  return objects
364
359
 
365
360
  def masked(self) -> Self:
366
- """Return a flattened copy of this object that only keeps valid paths.
361
+ """Return a flattened version of this object that only keeps valid paths.
367
362
 
368
363
  The returned object has all batch dimensions flattened into one,
369
364
  keeping only the paths where :attr:`mask` is :data:`True` (or where :attr:`confidence` is greater than or equal to :attr:`confidence_threshold`), and :attr:`mask` and :attr:`confidence` attributes are set to :data:`None`.
@@ -451,7 +446,7 @@ class Paths(eqx.Module):
451
446
  ValueError: If :attr:`mask` is None.
452
447
  """
453
448
  if self.mask is None and self.confidence is None:
454
- msg = "Cannot create multiplath cells from non-existing mask (or confidence matrix)!"
449
+ msg = "Cannot create multipath cells from non-existing mask (or confidence matrix)!"
455
450
  raise ValueError(msg)
456
451
 
457
452
  if self.mask is not None:
@@ -578,7 +573,7 @@ class SBRPaths(Paths):
578
573
 
579
574
  Warning:
580
575
  The ``mask`` argument is ignored as it will automatically
581
- by overwritten with the last array in :attr:`masks`.
576
+ be overwritten with the last array in :attr:`masks`.
582
577
  """
583
578
 
584
579
  _: KW_ONLY