differt 0.12.0__tar.gz → 0.12.1__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 (43) hide show
  1. {differt-0.12.0 → differt-0.12.1}/PKG-INFO +21 -12
  2. {differt-0.12.0 → differt-0.12.1}/README.md +16 -7
  3. {differt-0.12.0 → differt-0.12.1}/pyproject.toml +5 -5
  4. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_fresnel.py +3 -4
  5. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_material.py +1 -1
  6. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_utd.py +4 -4
  7. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_mesh.py +18 -14
  8. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_paths.py +2 -2
  9. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_solver_image_method.py +1 -1
  10. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_utils.py +5 -5
  11. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/solvers/_base.py +15 -14
  12. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/solvers/_exhaustive.py +1 -1
  13. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/solvers/_hybrid.py +1 -1
  14. {differt-0.12.0 → differt-0.12.1}/src/differt/plotting/__init__.py +3 -3
  15. {differt-0.12.0 → differt-0.12.1}/src/differt/plotting/_core.py +2 -2
  16. {differt-0.12.0 → differt-0.12.1}/src/differt/plotting/_utils.py +8 -6
  17. {differt-0.12.0 → differt-0.12.1}/src/differt/plugins/deepmimo.py +4 -4
  18. {differt-0.12.0 → differt-0.12.1}/src/differt/utils.py +2 -2
  19. {differt-0.12.0 → differt-0.12.1}/.gitignore +0 -0
  20. {differt-0.12.0 → differt-0.12.1}/LICENSE.md +0 -0
  21. {differt-0.12.0 → differt-0.12.1}/src/differt/__init__.py +0 -0
  22. {differt-0.12.0 → differt-0.12.1}/src/differt/_version.py +0 -0
  23. {differt-0.12.0 → differt-0.12.1}/src/differt/em/__init__.py +0 -0
  24. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_antenna.py +0 -0
  25. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_constants.py +0 -0
  26. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_fields.py +0 -0
  27. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_interaction_type.py +0 -0
  28. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_pipeline.py +0 -0
  29. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_solvers.py +0 -0
  30. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_utils.py +0 -0
  31. {differt-0.12.0 → differt-0.12.1}/src/differt/em/_wavefront.py +0 -0
  32. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/__init__.py +0 -0
  33. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_interaction_sites.py +0 -0
  34. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_scene.py +0 -0
  35. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_sionna.py +0 -0
  36. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_solver_fermat.py +0 -0
  37. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/_warp_utils.py +0 -0
  38. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/solvers/__init__.py +0 -0
  39. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/solvers/_dispatch.py +0 -0
  40. {differt-0.12.0 → differt-0.12.1}/src/differt/geometry/solvers/_sbr.py +0 -0
  41. {differt-0.12.0 → differt-0.12.1}/src/differt/plugins/__init__.py +0 -0
  42. {differt-0.12.0 → differt-0.12.1}/src/differt/plugins/_deepmimo_types.py +0 -0
  43. {differt-0.12.0 → differt-0.12.1}/src/differt/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: DiffeRT
3
- Version: 0.12.0
3
+ Version: 0.12.1
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
@@ -20,9 +20,9 @@ Classifier: Programming Language :: Python :: 3.14
20
20
  Classifier: Topic :: Scientific/Engineering
21
21
  Requires-Python: >=3.11
22
22
  Requires-Dist: chex>=0.1.86
23
- Requires-Dist: differt-core==0.12.0
23
+ Requires-Dist: differt-core==0.12.1
24
24
  Requires-Dist: equinox>=0.13.7
25
- Requires-Dist: filelock>=3.15.4
25
+ Requires-Dist: filelock>=4.2.1
26
26
  Requires-Dist: fpt-jax==0.2.0
27
27
  Requires-Dist: jax>=0.8.1
28
28
  Requires-Dist: jaxtyping>=0.3.11
@@ -35,7 +35,7 @@ Requires-Dist: ipykernel<7; extra == 'all'
35
35
  Requires-Dist: ipympl>=0.9.4; extra == 'all'
36
36
  Requires-Dist: jupyter-rfb>=0.4.2; extra == 'all'
37
37
  Requires-Dist: matplotlib>=3.8.1; extra == 'all'
38
- Requires-Dist: notebook>5; extra == 'all'
38
+ Requires-Dist: notebook>=7.6.3; extra == 'all'
39
39
  Requires-Dist: plotly>=5.18.0; extra == 'all'
40
40
  Requires-Dist: pyqt6>=6.6.1; extra == 'all'
41
41
  Requires-Dist: vispy>=0.14.1; extra == 'all'
@@ -43,7 +43,7 @@ Provides-Extra: jupyter
43
43
  Requires-Dist: ipykernel<7; extra == 'jupyter'
44
44
  Requires-Dist: ipympl>=0.9.4; extra == 'jupyter'
45
45
  Requires-Dist: jupyter-rfb>=0.4.2; extra == 'jupyter'
46
- Requires-Dist: notebook>5; extra == 'jupyter'
46
+ Requires-Dist: notebook>=7.6.3; extra == 'jupyter'
47
47
  Provides-Extra: matplotlib
48
48
  Requires-Dist: matplotlib>=3.8.1; extra == 'matplotlib'
49
49
  Provides-Extra: plotly
@@ -62,7 +62,8 @@ Description-Content-Type: text/markdown
62
62
 
63
63
  # DiffeRT
64
64
 
65
- Differentiable Ray Tracing toolbox for Radio Propagation powered by the [JAX ecosystem](https://github.com/jax-ml/jax).
65
+ Differentiable Ray Tracing toolbox for Radio Propagation powered by the
66
+ [JAX ecosystem](https://github.com/jax-ml/jax).
66
67
 
67
68
  [![Latest Release][pypi-version-badge]][pypi-version-url]
68
69
  [![Python version][pypi-python-version-badge]][pypi-version-url]
@@ -75,10 +76,11 @@ Differentiable Ray Tracing toolbox for Radio Propagation powered by the [JAX eco
75
76
  ## Usage
76
77
 
77
78
  > **WARNING:**
78
- > This package is still under important development, see
79
- > the [v1.0.0](https://github.com/jeertmans/DiffeRT/milestone/2) milestone for future
80
- > features, and the [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/CHANGELOG.md)
81
- > for versioning policy.
79
+ > This package is still under important development, see the
80
+ > [v1.0.0](https://github.com/jeertmans/DiffeRT/milestone/2) milestone for
81
+ > future features, and the
82
+ > [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/CHANGELOG.md) for
83
+ > versioning policy.
82
84
  >
83
85
  > If you have any suggestion regarding the development of this package,
84
86
  > please open an [issue](https://github.com/jeertmans/DiffeRT/issues).
@@ -135,6 +137,7 @@ for a detailed step-by-step procedure.
135
137
 
136
138
  If you use this software, please cite it as (**preferred**):
137
139
 
140
+ <!-- rumdl-disable -->
138
141
  ```bibtex
139
142
  @inproceedings{Eertmans_DiffeRT_ICMLCN_2025,
140
143
  title = {Demonstrating {DiffeRT}: An Open-Source Library for Optimizing Radio Networks with Differentiable Ray Tracing},
@@ -147,20 +150,26 @@ If you use this software, please cite it as (**preferred**):
147
150
  doi = {10.1109/ICMLCN64995.2025.11139997}
148
151
  }
149
152
  ```
153
+ <!-- rumdl-enable -->
150
154
 
151
155
  or:
152
156
 
157
+ <!-- rumdl-disable -->
153
158
  ```bibtex
154
159
  @software{Eertmans_DiffeRT_GitHub,
155
160
  title = {{DiffeRT}: A Differentiable Ray Tracing Toolbox for Radio Propagation Simulations},
156
161
  author = {Eertmans, Jérome},
157
162
  url = {https://github.com/jeertmans/DiffeRT},
158
163
  license = {MIT},
159
- version = {v0.12.0}
164
+ version = {v0.12.1}
160
165
  }
161
166
  ```
167
+ <!-- rumdl-enable -->
162
168
 
163
- 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).
169
+ For other citation formats, please refer to the
170
+ [*Cite this repository*](https://github.com/jeertmans/DiffeRT) button the main
171
+ page of our GitHub repository or to our
172
+ [Zenodo records](https://doi.org/10.5281/zenodo.11386432).
164
173
 
165
174
  Thank you for using this software and helping us!
166
175
 
@@ -6,7 +6,8 @@
6
6
 
7
7
  # DiffeRT
8
8
 
9
- Differentiable Ray Tracing toolbox for Radio Propagation powered by the [JAX ecosystem](https://github.com/jax-ml/jax).
9
+ Differentiable Ray Tracing toolbox for Radio Propagation powered by the
10
+ [JAX ecosystem](https://github.com/jax-ml/jax).
10
11
 
11
12
  [![Latest Release][pypi-version-badge]][pypi-version-url]
12
13
  [![Python version][pypi-python-version-badge]][pypi-version-url]
@@ -19,10 +20,11 @@ Differentiable Ray Tracing toolbox for Radio Propagation powered by the [JAX eco
19
20
  ## Usage
20
21
 
21
22
  > [!WARNING]
22
- > This package is still under important development, see
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/CHANGELOG.md)
25
- > for versioning policy.
23
+ > This package is still under important development, see the
24
+ > [v1.0.0](https://github.com/jeertmans/DiffeRT/milestone/2) milestone for
25
+ > future features, and the
26
+ > [CHANGELOG](https://github.com/jeertmans/DiffeRT/blob/main/CHANGELOG.md) for
27
+ > versioning policy.
26
28
  >
27
29
  > If you have any suggestion regarding the development of this package,
28
30
  > please open an [issue](https://github.com/jeertmans/DiffeRT/issues).
@@ -79,6 +81,7 @@ for a detailed step-by-step procedure.
79
81
 
80
82
  If you use this software, please cite it as (**preferred**):
81
83
 
84
+ <!-- rumdl-disable -->
82
85
  ```bibtex
83
86
  @inproceedings{Eertmans_DiffeRT_ICMLCN_2025,
84
87
  title = {Demonstrating {DiffeRT}: An Open-Source Library for Optimizing Radio Networks with Differentiable Ray Tracing},
@@ -91,20 +94,26 @@ If you use this software, please cite it as (**preferred**):
91
94
  doi = {10.1109/ICMLCN64995.2025.11139997}
92
95
  }
93
96
  ```
97
+ <!-- rumdl-enable -->
94
98
 
95
99
  or:
96
100
 
101
+ <!-- rumdl-disable -->
97
102
  ```bibtex
98
103
  @software{Eertmans_DiffeRT_GitHub,
99
104
  title = {{DiffeRT}: A Differentiable Ray Tracing Toolbox for Radio Propagation Simulations},
100
105
  author = {Eertmans, Jérome},
101
106
  url = {https://github.com/jeertmans/DiffeRT},
102
107
  license = {MIT},
103
- version = {v0.12.0}
108
+ version = {v0.12.1}
104
109
  }
105
110
  ```
111
+ <!-- rumdl-enable -->
106
112
 
107
- 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).
113
+ For other citation formats, please refer to the
114
+ [*Cite this repository*](https://github.com/jeertmans/DiffeRT) button the main
115
+ page of our GitHub repository or to our
116
+ [Zenodo records](https://doi.org/10.5281/zenodo.11386432).
108
117
 
109
118
  Thank you for using this software and helping us!
110
119
 
@@ -3,7 +3,7 @@ build-backend = "hatchling.build"
3
3
  requires = ["hatchling", "hatch-fancy-pypi-readme"]
4
4
 
5
5
  [project]
6
- authors = [{name = "Jérome Eertmans", email = "jeertmans@icloud.com"}]
6
+ authors = [{ name = "Jérome Eertmans", email = "jeertmans@icloud.com" }]
7
7
  classifiers = [
8
8
  "Programming Language :: Python :: 3",
9
9
  "Programming Language :: Python :: 3.11",
@@ -15,9 +15,9 @@ classifiers = [
15
15
  ]
16
16
  dependencies = [
17
17
  "chex>=0.1.86",
18
- "differt-core==0.12.0",
18
+ "differt-core==0.12.1",
19
19
  "equinox>=0.13.7",
20
- "filelock>=3.15.4",
20
+ "filelock>=4.2.1",
21
21
  "fpt-jax==0.2.0",
22
22
  "jax>=0.8.1",
23
23
  "jaxtyping>=0.3.11",
@@ -37,7 +37,7 @@ 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", "ipykernel<7"]
40
+ jupyter = ["notebook>=7.6.3", "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 = [
@@ -93,4 +93,4 @@ path = "../differt-core/Cargo.toml"
93
93
  pattern = '^version = "(?P<version>[^"]+)'
94
94
 
95
95
  [tool.uv.sources]
96
- differt_core = {workspace = true}
96
+ differt_core = { workspace = true }
@@ -186,11 +186,10 @@ def fresnel_coefficients(
186
186
  cos_theta_i_squared = jax.lax.integer_pow(cos_theta_i, 2)
187
187
  n_r_squared_cos_theta_i = n_r_squared * cos_theta_i
188
188
  dtype = jnp.result_type(n_r, cos_theta_i)
189
- n_r_cos_theta_t = jnp.sqrt(
190
- (n_r_squared + cos_theta_i_squared - 1).astype(
191
- jnp.complex128 if dtype == jnp.float64 else jnp.complex64
192
- )
189
+ c_dtype = (
190
+ jnp.complex128 if dtype in {jnp.float64, jnp.complex128} else jnp.complex64
193
191
  )
192
+ n_r_cos_theta_t = jnp.sqrt((n_r_squared + cos_theta_i_squared - 1).astype(c_dtype))
194
193
  two_cos_theta_i = 2 * cos_theta_i
195
194
 
196
195
  r_s = safe_divide(
@@ -359,7 +359,7 @@ class Material(eqx.Module):
359
359
  Create a material from ITU properties.
360
360
 
361
361
  The ITU-R Recommendation P.2040-4 :cite:`itu-r-2040` defines the electrical properties of a material
362
- using 4 real-valued coefficients: **a**, **b**, **c**, and **c**. The :data:`materials` mapping
362
+ using 4 real-valued coefficients: **a**, **b**, **c**, and **d**. The :data:`materials` mapping
363
363
  is already populated with values from :cite:`itu-r-2040{Tab. 3}`.
364
364
 
365
365
  Args:
@@ -106,7 +106,7 @@ def L_i(
106
106
  :math:`\rho_2^i` is the principal radius of curvature of the incident wavefront at :math:`Q_d`
107
107
  in the plane transverse to the plane of incidence,
108
108
  :math:`\rho_e^i` is radius of curvature of the incident wavefront in the edge-fixed
109
- plane of incidence., and :math:`\beta_0` is the angle of diffraction.
109
+ plane of incidence, and :math:`\beta_0` is the angle of diffraction.
110
110
 
111
111
  By default, when :math:`\rho_1^i`, :math:`\rho_e^i`, and :math:`\rho_2^i` are not provided,
112
112
  a plane wave incidence is assumed and the expression simplifies to
@@ -116,7 +116,7 @@ def L_i(
116
116
  L_i = s^d\sin^2\beta_0.
117
117
 
118
118
  For spherical wavefront, you can pass :math:`s^i` (**s\_i**), the radius of curvature of
119
- the spherical wavefront, where :math:`s^i = \rho_1^i = \rho_2^2 = \rho_e^i`,
119
+ the spherical wavefront, where :math:`s^i = \rho_1^i = \rho_2^i = \rho_e^i`,
120
120
  and the expression will be simplified to
121
121
  :cite:`utd-mcnamara{eq. 6.26, p. 270}`:
122
122
 
@@ -141,7 +141,7 @@ def L_i(
141
141
 
142
142
  Raises:
143
143
  ValueError: If 's_i' was provided along at least one of the other radius parameters,
144
- or if one or the three 'rho' parameters was not provided.
144
+ or if one of the three 'rho' parameters was not provided.
145
145
  """
146
146
  radii = (rho_1_i, rho_2_i, rho_e_i)
147
147
  all_none = all(x is None for x in radii)
@@ -188,7 +188,7 @@ def F(z: Float[Array, " *batch"]) -> Complex[Array, " *batch"]:
188
188
  .. math::
189
189
  2j \sqrt{z} e^{j z} \Big(\sqrt{\frac{\pi}{2}}\frac{1 - j}{2} - C(\sqrt{z}) + j S(\sqrt{z})\Big).
190
190
 
191
- With Fresnel integrals computed by :data:`jax.scipy.special.fresnel`.
191
+ With Fresnel integrals computed by :func:`jax.scipy.special.fresnel`.
192
192
 
193
193
  Args:
194
194
  z: Real point to evaluate.
@@ -70,7 +70,7 @@ class _GetIndexingKwargs(TypedDict):
70
70
  def triangle_contains_vertex_assuming_inside_same_plane(
71
71
  triangle_vertices: Float[ArrayLike, "*#batch 3 3"],
72
72
  vertex: Float[ArrayLike, "*#batch 3"],
73
- ) -> Bool[Array, " *#batch"]:
73
+ ) -> Bool[Array, " *batch"]:
74
74
  """
75
75
  Return whether the triangle contains the corresponding vertex, assuming the vertex lies in the same plane as the triangle.
76
76
 
@@ -440,7 +440,7 @@ class _MeshVerticesUpdateRef(Generic[_T]):
440
440
 
441
441
  def get(
442
442
  self, **kwargs: Unpack[_GetIndexingKwargs]
443
- ) -> Float[ArrayLike, "num_indexed_triangles 3"]:
443
+ ) -> Float[Array, "num_indexed_triangles 3"]:
444
444
  # get() is allowed to return duplicates, so we do not use _triangles_index()
445
445
  index = self.mesh.triangles.at[self.index, :].get(**kwargs).reshape(-1)
446
446
  return self.mesh.vertices.at[index, :].get(wrap_negative_indices=False)
@@ -635,7 +635,7 @@ class Mesh(eqx.Module):
635
635
  """The array of object indices.
636
636
 
637
637
  If the present mesh contains multiple objects, usually as a result of appending
638
- multiple meshes together, this array contain start end end indices for each sub mesh.
638
+ multiple meshes together, this array contains start and end indices for each sub-mesh.
639
639
 
640
640
  .. important::
641
641
 
@@ -859,7 +859,11 @@ class Mesh(eqx.Module):
859
859
  msg = "Cannot access the number of active quadrilaterals if 'assume_quads' is set to 'False'."
860
860
  raise ValueError(msg)
861
861
 
862
- return jnp.sum(self.mask[::2]) if self.mask is not None else self.num_quads
862
+ return (
863
+ jnp.sum(self.mask[::2] & self.mask[1::2])
864
+ if self.mask is not None
865
+ else self.num_quads
866
+ )
863
867
 
864
868
  @property
865
869
  def num_primitives(self) -> int:
@@ -891,7 +895,7 @@ class Mesh(eqx.Module):
891
895
 
892
896
  def set_assume_quads(self, flag: bool = True) -> Self:
893
897
  """
894
- Return a new instance of this scene with :attr:`Mesh.assume_quads<differt.geometry.Mesh.assume_quads>` set to ``flag``.
898
+ Return a new instance of this mesh with :attr:`Mesh.assume_quads<differt.geometry.Mesh.assume_quads>` set to ``flag``.
895
899
 
896
900
  Unlike with using :func:`equinox.tree_at`, this function will also
897
901
  perform runtime checks.
@@ -1361,11 +1365,11 @@ class Mesh(eqx.Module):
1361
1365
  will not result in duplicate updates.
1362
1366
 
1363
1367
  Warning:
1364
- As duplicate vertices are ignored, the number of update vertices is not
1368
+ As duplicate vertices are ignored, the number of updated vertices is not
1365
1369
  necessarily equal to the number of triangles selected times three. Moreover,
1366
- vertices are re-ordered when duplicates are removed. As a results, you should
1370
+ vertices are re-ordered when duplicates are removed. As a result, you should
1367
1371
  not apply any update that depends on the order of or the number of updated
1368
- the vertices.
1372
+ vertices.
1369
1373
 
1370
1374
  Examples:
1371
1375
  The following example shows how to translate the first two (triangle) faces.
@@ -1435,7 +1439,7 @@ class Mesh(eqx.Module):
1435
1439
  This method does not preserve the :attr:`object_bounds` attribute.
1436
1440
 
1437
1441
  Returns:
1438
- A new paths instance with flattened batch dimensions and only valid paths.
1442
+ A new mesh instance keeping only active triangles.
1439
1443
  """
1440
1444
  if self.mask is None:
1441
1445
  return jax.tree.map(lambda m: m, self)
@@ -1587,10 +1591,10 @@ class Mesh(eqx.Module):
1587
1591
  @classmethod
1588
1592
  def empty(cls) -> Self:
1589
1593
  """
1590
- Create a empty mesh.
1594
+ Create an empty mesh.
1591
1595
 
1592
1596
  Returns:
1593
- A new empty scene.
1597
+ A new empty mesh.
1594
1598
  """
1595
1599
  return cls(
1596
1600
  vertices=jnp.empty((0, 3)),
@@ -1613,11 +1617,11 @@ class Mesh(eqx.Module):
1613
1617
  * The vertices are concatenated;
1614
1618
  * The triangles are concatenated, and the indices of the second mesh are updated;
1615
1619
  * The face colors are concatenated. If one mesh has colors while the other does not,
1616
- then mesh with no colors will have its face colors set to black (0, 0, 0);
1620
+ then the mesh with no colors will have its face colors set to black (0, 0, 0);
1617
1621
  * The face materials are concatenated. If ``other`` has face materials not included
1618
1622
  in ``self``, then the face materials from ``other`` are renumbered.
1619
- If one mesh has colors while the other does not,
1620
- then mesh with no colors will have its face materials set to ``-1``;
1623
+ If one mesh has materials while the other does not,
1624
+ then the mesh with no materials will have its face materials set to ``-1``;
1621
1625
  * The material names are merged, keeping only unique names;
1622
1626
  * The object bounds are concatenated only if both meshes have them set,
1623
1627
  otherwise, the object bounds are set to :data:`None`;
@@ -518,7 +518,7 @@ class TracedPaths(eqx.Module):
518
518
  def __iter__(self) -> Iterator["TracedPaths"]:
519
519
  """Return an iterator over masked paths.
520
520
 
521
- Each item of the iterator is itself an instance :class:`TracedPaths`,
521
+ Each item of the iterator is itself an instance of :class:`TracedPaths`,
522
522
  so you can still benefit from convenient methods like :meth:`plot`.
523
523
 
524
524
  Yields:
@@ -663,7 +663,7 @@ class TracedPaths(eqx.Module):
663
663
  if len(unique_sigs) <= 1 and (
664
664
  len(unique_sigs) == 0 or unique_sigs[0][0] == self.order
665
665
  ):
666
- return [self]
666
+ return [self.masked()] if masked else [self]
667
667
 
668
668
  result: list[TracedPaths] = []
669
669
  for o, sig in unique_sigs:
@@ -410,7 +410,7 @@ def consecutive_vertices_are_on_same_side_of_mirror(
410
410
  mirror_normals: Mirror normals, where each normal has a unit
411
411
  length and is perpendicular to the corresponding mirror.
412
412
  smoothing_factor: If set, hard conditions are replaced with smoothed ones,
413
- as described in :cite:`fully-eucap2024`, and this argument parameters the slope
413
+ as described in :cite:`fully-eucap2024`, and this argument parameterizes the slope
414
414
  of the smoothing function. The output value is now a real value
415
415
  between 0 (:data:`False`) and 1 (:data:`True`).
416
416
 
@@ -48,7 +48,7 @@ def normalize(
48
48
  The normalized vector and its length.
49
49
 
50
50
  Examples:
51
- The following examples shows how normalization works and
51
+ The following example shows how normalization works and
52
52
  its special behavior at zero.
53
53
 
54
54
  >>> from differt.geometry import (
@@ -1006,10 +1006,10 @@ class SizedIterator(Iterator[_T], Sized):
1006
1006
 
1007
1007
  The main purpose of this class is to be able to use
1008
1008
  `tqdm <https://github.com/tqdm/tqdm>`_ utilities
1009
- on iterators and have some meaningful information about how iterations are left.
1009
+ on iterators and have some meaningful information about how many iterations are left.
1010
1010
 
1011
1011
  Args:
1012
- iter_: The iterator.
1012
+ iter: The iterator.
1013
1013
  size: The size, i.e., length, of the iterator, or a callable that returns its current length.
1014
1014
 
1015
1015
  Examples:
@@ -1217,7 +1217,7 @@ def ray_intersect_triangle(
1217
1217
  *,
1218
1218
  epsilon: Float[ArrayLike, ""] | None = ...,
1219
1219
  smoothing_factor: Float[ArrayLike, ""],
1220
- ) -> tuple[Float[Array, " *batch"], Bool[Array, " *batch"]]: ...
1220
+ ) -> tuple[Float[Array, " *batch"], Float[Array, " *batch"]]: ...
1221
1221
 
1222
1222
 
1223
1223
  @overload
@@ -1228,7 +1228,7 @@ def ray_intersect_triangle(
1228
1228
  *,
1229
1229
  epsilon: Float[ArrayLike, ""] | None = ...,
1230
1230
  smoothing_factor: None = ...,
1231
- ) -> tuple[Float[Array, " *batch"], Float[Array, " *batch"]]: ...
1231
+ ) -> tuple[Float[Array, " *batch"], Bool[Array, " *batch"]]: ...
1232
1232
 
1233
1233
 
1234
1234
  @eqx.filter_jit
@@ -951,35 +951,36 @@ def _trace_path_candidates(
951
951
  on_edge_segment = (on_edge_segment | ~active_for_edge_check).all(axis=-1)
952
952
  inside_triangles = inside_triangles & on_edge_segment
953
953
 
954
- # 3.2 - Check if consecutive path vertices are on the same side of mirrors
955
- # (does not apply to DIFFRACTION, which is not a mirror reflection, nor
956
- # to TRANSMISSION, which passes through by design).
954
+ # 3.2 - Check if consecutive path vertices are on the expected side of
955
+ # surfaces: same side for REFLECTION/SCATTERING, opposite sides for
956
+ # TRANSMISSION (does not apply to DIFFRACTION, which is not a surface
957
+ # interaction).
957
958
 
958
959
  # [num_path_candidates order]
959
- active_for_mirror_check = active & ~is_diffraction & ~is_transmission
960
+ active_for_surface_check = active & ~is_diffraction
960
961
 
961
962
  # [num_tx_vertices num_rx_vertices num_path_candidates]
962
963
  if smoothing_factor is not None:
963
- valid_reflections = consecutive_vertices_are_on_same_side_of_mirror(
964
+ valid_sides = consecutive_vertices_are_on_same_side_of_mirror(
964
965
  full_paths,
965
966
  mirror_vertices,
966
967
  mirror_normals,
967
968
  smoothing_factor=smoothing_factor,
968
969
  )
969
- valid_reflections = jnp.where(
970
- active_for_mirror_check, valid_reflections, 1.0
971
- ).min(
970
+ valid_sides = jnp.where(is_transmission, 1.0 - valid_sides, valid_sides)
971
+ valid_sides = jnp.where(active_for_surface_check, valid_sides, 1.0).min(
972
972
  axis=-1, initial=1.0
973
- ) # Reduce on 'order', ignoring placeholder/diffraction/transmission interactions
973
+ ) # Reduce on 'order', ignoring placeholder/diffraction interactions
974
974
  else:
975
- valid_reflections = consecutive_vertices_are_on_same_side_of_mirror(
975
+ valid_sides = consecutive_vertices_are_on_same_side_of_mirror(
976
976
  full_paths,
977
977
  mirror_vertices,
978
978
  mirror_normals,
979
979
  )
980
- valid_reflections = (valid_reflections | ~active_for_mirror_check).all(
980
+ valid_sides = jnp.where(is_transmission, ~valid_sides, valid_sides)
981
+ valid_sides = (valid_sides | ~active_for_surface_check).all(
981
982
  axis=-1
982
- ) # Reduce on 'order', ignoring placeholder/diffraction/transmission interactions
983
+ ) # Reduce on 'order', ignoring placeholder/diffraction interactions
983
984
 
984
985
  # 3.3 - Identify paths that are blocked by other objects
985
986
 
@@ -1033,7 +1034,7 @@ def _trace_path_candidates(
1033
1034
  mask = jnp.stack(
1034
1035
  (
1035
1036
  inside_triangles,
1036
- valid_reflections,
1037
+ valid_sides,
1037
1038
  1.0 - blocked,
1038
1039
  1.0 - too_small,
1039
1040
  is_finite.astype(inside_triangles.dtype),
@@ -1043,7 +1044,7 @@ def _trace_path_candidates(
1043
1044
  if active_rays is not None:
1044
1045
  mask *= active_rays
1045
1046
  else:
1046
- mask = inside_triangles & valid_reflections & ~blocked & ~too_small & is_finite
1047
+ mask = inside_triangles & valid_sides & ~blocked & ~too_small & is_finite
1047
1048
  if active_rays is not None:
1048
1049
  mask &= active_rays
1049
1050
 
@@ -45,7 +45,7 @@ class ExhaustivePathTracer(AbstractPathTracer):
45
45
  min_len: Float[ArrayLike, ""] | None = None
46
46
  """Minimal (squared) length that each path segment must have for a path to be valid."""
47
47
  smoothing_factor: Float[ArrayLike, ""] | None = None
48
- """Parameters for slope of the smoothing function."""
48
+ """Parameter for the slope of the smoothing function."""
49
49
  confidence_threshold: Float[ArrayLike, ""] = 0.5
50
50
  """Confidence threshold for valid paths."""
51
51
  batch_size: int | None = 512
@@ -55,7 +55,7 @@ class HybridPathTracer(AbstractPathTracer):
55
55
  min_len: Float[ArrayLike, ""] | None = None
56
56
  """Minimal (squared) length that each path segment must have for a path to be valid."""
57
57
  smoothing_factor: Float[ArrayLike, ""] | None = None
58
- """Parameters for slope of the smoothing function."""
58
+ """Parameter for the slope of the smoothing function."""
59
59
  confidence_threshold: Float[ArrayLike, ""] = 0.5
60
60
  """Confidence threshold for valid paths."""
61
61
  batch_size: int | None = 512
@@ -4,7 +4,7 @@ Plotting utilities for DiffeRT objects.
4
4
  .. tip::
5
5
 
6
6
  Unlike in other modules, plotting utilities also work
7
- with NumPy arrays (:class:`np.ndarray<numpy.ndarray>`)
7
+ with NumPy arrays (:class:`np.ndarray<numpy.ndarray>`).
8
8
 
9
9
 
10
10
  .. note::
@@ -36,7 +36,7 @@ can later add data.
36
36
  It is also possible to pass an existing view
37
37
  on which data will be plotted: ``draw_*(..., view=view)``.
38
38
 
39
- If the ``jupyter_rfb`` module is installed, VisPy's canvas integrate
39
+ If the ``jupyter_rfb`` module is installed, VisPy's canvas integrates
40
40
  nicely within Jupyter notebooks.
41
41
 
42
42
  Matplotlib
@@ -63,7 +63,7 @@ on which data will be plotted: ``draw_*(..., ax=ax)``.
63
63
  it is your responsibility to ensure that it can plot 3D data
64
64
  when needed.
65
65
 
66
- By default, Matpotlib displays static images in Jupyter notebooks.
66
+ By default, Matplotlib displays static images in Jupyter notebooks.
67
67
  To make them interactive, install ``ipympl`` and load the corresponding
68
68
  extension with ``%matplotlib widget``.
69
69
 
@@ -1102,8 +1102,8 @@ def draw_surface(
1102
1102
 
1103
1103
  In the Plotly backend, the default is to use the values in ``z``.
1104
1104
  kwargs: Keyword arguments passed to
1105
- :class:`Isocurve<vispy.scene.visuals.SurfacePlot>`,
1106
- :meth:`contour<mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface>`,
1105
+ :class:`SurfacePlot<vispy.scene.visuals.SurfacePlot>`,
1106
+ :meth:`plot_surface<mpl_toolkits.mplot3d.axes3d.Axes3D.plot_surface>`,
1107
1107
  or :class:`Surface<plotly.graph_objects.Surface>`, depending on the
1108
1108
  backend.
1109
1109
 
@@ -20,7 +20,7 @@ from typing import (
20
20
  )
21
21
 
22
22
  if TYPE_CHECKING:
23
- from collections.abc import Callable, Iterator, MutableMapping
23
+ from collections.abc import Callable, Generator, MutableMapping
24
24
 
25
25
  from matplotlib.figure import Figure as MplFigure
26
26
  from mpl_toolkits.mplot3d import Axes3D
@@ -53,7 +53,7 @@ class _Config:
53
53
  self.defaults = replace(self.defaults, **defaults)
54
54
 
55
55
  @contextmanager
56
- def with_defaults(self, /, **defaults: Any) -> Iterator[None]:
56
+ def with_defaults(self, /, **defaults: Any) -> Generator[None, None, None]:
57
57
  old_defaults = self.defaults
58
58
  with self.lock:
59
59
  try:
@@ -231,7 +231,9 @@ def update_defaults(backend: str | None = None, **kwargs: Any) -> BackendName:
231
231
 
232
232
 
233
233
  @contextmanager
234
- def use(backend: str | None = None, **kwargs: Any) -> Iterator[BackendName]:
234
+ def use(
235
+ backend: str | None = None, **kwargs: Any
236
+ ) -> Generator[BackendName, None, None]:
235
237
  """
236
238
  Create a context manager that updates plotting defaults and returns the current default backend.
237
239
 
@@ -248,7 +250,7 @@ def use(backend: str | None = None, **kwargs: Any) -> Iterator[BackendName]:
248
250
  The name of the default backend used in this context.
249
251
 
250
252
  Examples:
251
- The following example shows how set plot defaults in a context.
253
+ The following example shows how to set plot defaults in a context.
252
254
 
253
255
  >>> import differt.plotting as dplt
254
256
  >>>
@@ -678,7 +680,7 @@ def process_kwargs(
678
680
  @contextmanager
679
681
  def reuse(
680
682
  backend: LiteralString | None = None, pass_all_kwargs: bool = False, **kwargs: Any
681
- ) -> Iterator[Canvas | MplFigure | Figure]:
683
+ ) -> Generator[Canvas | MplFigure | Figure, None, None]:
682
684
  """Create a context manager that will automatically reuse the current canvas / figure.
683
685
 
684
686
  Args:
@@ -694,7 +696,7 @@ def reuse(
694
696
  The canvas or figure that is reused for this context.
695
697
 
696
698
  Examples:
697
- The following example show how the same figure is reused
699
+ The following example shows how the same figure is reused
698
700
  for multiple plots.
699
701
 
700
702
  .. plotly::
@@ -90,9 +90,9 @@ class DeepMIMO(eqx.Module, Generic[ArrayType]):
90
90
 
91
91
  _: KW_ONLY
92
92
  power: Float[ArrayType, "num_tx num_rx num_paths"]
93
- r"""Tap power. Received power in dBW for each path, assuming 0 dBW transmitted power. :math:`10\log10(|a|^2)`, where :math:`a` is the complex channel amplitude"""
93
+ r"""Tap power. Received power in dBW for each path, assuming 0 dBW transmitted power. :math:`10\log_{10}(|a|^2)`, where :math:`a` is the complex channel amplitude."""
94
94
  phase: Float[ArrayType, "num_tx num_rx num_paths"]
95
- r"""Tap phase. Phase of received signal for each path in degrees. :math:`\angle a` (angle of :math:`a`), where :math:`a` is the complex channel amplitude"""
95
+ r"""Tap phase. Phase of received signal for each path in degrees. :math:`\angle a` (angle of :math:`a`), where :math:`a` is the complex channel amplitude."""
96
96
  delay: Float[ArrayType, "num_tx num_rx num_paths"]
97
97
  """Tap delay. Propagation delay for each path in seconds."""
98
98
  aoa_az: Float[ArrayType, "num_tx num_rx num_paths"]
@@ -276,7 +276,7 @@ class DeepMIMO(eqx.Module, Generic[ArrayType]):
276
276
  Return a new instance of this class with arrays converted to JAX arrays.
277
277
 
278
278
  Returns:
279
- A new instance of this with JAX arrays.
279
+ A new instance of this class with JAX arrays.
280
280
  """
281
281
  return jax.tree.map(jnp.asarray, self)
282
282
 
@@ -285,7 +285,7 @@ class DeepMIMO(eqx.Module, Generic[ArrayType]):
285
285
  Return a new instance of this class with arrays converted to NumPy arrays.
286
286
 
287
287
  Returns:
288
- A new instance of this with NumPy arrays.
288
+ A new instance of this class with NumPy arrays.
289
289
  """
290
290
  return jax.tree.map(np.asarray, self)
291
291
 
@@ -48,7 +48,7 @@ def safe_divide(
48
48
  The result of ``num / den``, except that division by zero returns 0.
49
49
 
50
50
  Examples:
51
- The following examples shows how division by zero is handled.
51
+ The following example shows how division by zero is handled.
52
52
 
53
53
  >>> from differt.utils import safe_divide
54
54
  >>>
@@ -72,7 +72,7 @@ def smoothing_function(
72
72
  x: Float[ArrayLike, " *#batch"],
73
73
  /,
74
74
  smoothing_factor: Float[ArrayLike, " *#batch"] = 1.0,
75
- ) -> Float[ArrayLike, " *batch"]:
75
+ ) -> Float[Array, " *batch"]:
76
76
  r"""
77
77
  Return a smoothed approximation of the Heaviside step function.
78
78
 
File without changes
File without changes
File without changes