differt 0.0.34__tar.gz → 0.0.36__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.0.34 → differt-0.0.36}/PKG-INFO +2 -2
- {differt-0.0.34 → differt-0.0.36}/pyproject.toml +1 -1
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_antenna.py +32 -2
- {differt-0.0.34 → differt-0.0.36}/src/differt/geometry/_triangle_mesh.py +12 -10
- {differt-0.0.34 → differt-0.0.36}/src/differt/plotting/_core.py +1 -1
- {differt-0.0.34 → differt-0.0.36}/.gitignore +0 -0
- {differt-0.0.34 → differt-0.0.36}/LICENSE.md +0 -0
- {differt-0.0.34 → differt-0.0.36}/README.md +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/__init__.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/_version.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/__init__.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_constants.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_fresnel.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_interaction_type.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_material.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_utd.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/em/_utils.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/geometry/__init__.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/geometry/_paths.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/geometry/_utils.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/plotting/__init__.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/plotting/_utils.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/py.typed +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/rt/__init__.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/rt/_fermat.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/rt/_image_method.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/rt/_utils.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/scene/__init__.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/scene/_sionna.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/scene/_triangle_scene.py +0 -0
- {differt-0.0.34 → differt-0.0.36}/src/differt/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: DiffeRT
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
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,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
21
21
|
Classifier: Topic :: Scientific/Engineering
|
|
22
22
|
Requires-Python: >=3.10
|
|
23
23
|
Requires-Dist: chex>=0.1.86
|
|
24
|
-
Requires-Dist: differt-core==0.0.
|
|
24
|
+
Requires-Dist: differt-core==0.0.36
|
|
25
25
|
Requires-Dist: equinox>=0.11.5
|
|
26
26
|
Requires-Dist: filelock>=3.15.4
|
|
27
27
|
Requires-Dist: jax>=0.4.32
|
|
@@ -7,7 +7,11 @@ import jax
|
|
|
7
7
|
import jax.numpy as jnp
|
|
8
8
|
from jaxtyping import Array, ArrayLike, Float, Inexact
|
|
9
9
|
|
|
10
|
-
from differt.geometry import
|
|
10
|
+
from differt.geometry import (
|
|
11
|
+
cartesian_to_spherical,
|
|
12
|
+
normalize,
|
|
13
|
+
spherical_to_cartesian,
|
|
14
|
+
)
|
|
11
15
|
from differt.plotting import PlotOutput, draw_surface
|
|
12
16
|
from differt.utils import dot, safe_divide
|
|
13
17
|
|
|
@@ -253,7 +257,7 @@ class Antenna(BaseAntenna):
|
|
|
253
257
|
|
|
254
258
|
gain = p / p.max()
|
|
255
259
|
|
|
256
|
-
r
|
|
260
|
+
r = self.center + (r - self.center) * gain
|
|
257
261
|
gain = jnp.squeeze(gain, axis=-1)
|
|
258
262
|
|
|
259
263
|
return draw_surface(
|
|
@@ -284,6 +288,9 @@ class Dipole(Antenna):
|
|
|
284
288
|
|
|
285
289
|
If this is provided, this takes precedence over ``current``.
|
|
286
290
|
center: The center position of the antenna, from which the fields are radiated.
|
|
291
|
+
look_at: When provided, re-orient the antenna to look at the given point.
|
|
292
|
+
|
|
293
|
+
This overrides the direction of the dipole moment.
|
|
287
294
|
|
|
288
295
|
Examples:
|
|
289
296
|
The following example shows how to plot the radiation
|
|
@@ -327,6 +334,17 @@ class Dipole(Antenna):
|
|
|
327
334
|
... bbox_to_anchor=(0.5 + jnp.cos(angle) / 2, 0.5 + jnp.sin(angle) / 2),
|
|
328
335
|
... )
|
|
329
336
|
>>> plt.show() # doctest: +SKIP
|
|
337
|
+
|
|
338
|
+
The third example shows how to orient the antenna to look at a given point.
|
|
339
|
+
|
|
340
|
+
.. plotly::
|
|
341
|
+
:fig-vars: fig
|
|
342
|
+
|
|
343
|
+
>>> from differt.em import Dipole
|
|
344
|
+
>>>
|
|
345
|
+
>>> ant = Dipole(frequency=1e9, look_at=jnp.array([0.0, -1.0, -1.0]))
|
|
346
|
+
>>> fig = ant.plot_radiation_pattern(backend="plotly")
|
|
347
|
+
>>> fig # doctest: +SKIP
|
|
330
348
|
"""
|
|
331
349
|
|
|
332
350
|
length: Float[Array, " "] = eqx.field(converter=jnp.asarray)
|
|
@@ -344,6 +362,7 @@ class Dipole(Antenna):
|
|
|
344
362
|
current: Float[ArrayLike, " "] | None = 1.0,
|
|
345
363
|
charge: Float[ArrayLike, " "] | None = None,
|
|
346
364
|
center: Float[ArrayLike, "3"] = jnp.array([0.0, 0.0, 0.0]),
|
|
365
|
+
look_at: Float[ArrayLike, "3"] | None = None,
|
|
347
366
|
) -> None:
|
|
348
367
|
super().__init__(jnp.asarray(frequency), center=center)
|
|
349
368
|
|
|
@@ -363,6 +382,17 @@ class Dipole(Antenna):
|
|
|
363
382
|
/ (jnp.linalg.norm(moment) * self.angular_frequency)
|
|
364
383
|
)
|
|
365
384
|
|
|
385
|
+
if look_at is not None:
|
|
386
|
+
moment = spherical_to_cartesian(
|
|
387
|
+
cartesian_to_spherical(moment)
|
|
388
|
+
+ (
|
|
389
|
+
cartesian_to_spherical(
|
|
390
|
+
normalize(jnp.asarray(look_at) - self.center)[0]
|
|
391
|
+
)
|
|
392
|
+
- cartesian_to_spherical(jnp.array([1.0, 0.0, 0.0]))
|
|
393
|
+
)
|
|
394
|
+
)
|
|
395
|
+
|
|
366
396
|
self.moment = moment # type: ignore[reportAttributeAccessIssue]
|
|
367
397
|
|
|
368
398
|
@property
|
|
@@ -522,7 +522,7 @@ class TriangleMesh(eqx.Module):
|
|
|
522
522
|
return eqx.tree_at(
|
|
523
523
|
lambda m: m.vertices,
|
|
524
524
|
self,
|
|
525
|
-
self.vertices + translation,
|
|
525
|
+
self.vertices + jnp.asarray(translation),
|
|
526
526
|
)
|
|
527
527
|
|
|
528
528
|
@classmethod
|
|
@@ -546,22 +546,24 @@ class TriangleMesh(eqx.Module):
|
|
|
546
546
|
.. note::
|
|
547
547
|
|
|
548
548
|
The following rules are applied when merging two meshes:
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
549
|
+
|
|
550
|
+
* The vertices are concatenated;
|
|
551
|
+
* The triangles are concatenated, and the indices of the second mesh are updated;
|
|
552
|
+
* The face colors are concatenated. If one mesh has colors while the other does not,
|
|
552
553
|
then mesh with no colors will have its face colors set to black (0, 0, 0);
|
|
553
|
-
|
|
554
|
+
* The face materials are concatenated. If ``other`` has face materials not included
|
|
554
555
|
in ``self``, then the face materials from ``other`` are renumbered.
|
|
555
556
|
If one mesh has colors while the other does not,
|
|
556
557
|
then mesh with no colors will have its face materials set to ``-1``;
|
|
557
|
-
|
|
558
|
-
|
|
558
|
+
* The material names are merged, keeping only unique names;
|
|
559
|
+
* The object bounds are concatenated only if both meshes have them set,
|
|
559
560
|
otherwise, the object bounds are set to :data:`None`;
|
|
560
|
-
|
|
561
|
+
* The :attr:`assume_quads` flag is set to :data:`True` if both meshes have it set to :data:`True`.
|
|
561
562
|
|
|
562
563
|
Two important exceptions are:
|
|
563
|
-
|
|
564
|
-
|
|
564
|
+
|
|
565
|
+
* If one mesh is empty, a copy of the other mesh is returned as is;
|
|
566
|
+
* If both meshes are empty, then a copy of ``self`` is returned.
|
|
565
567
|
|
|
566
568
|
Args:
|
|
567
569
|
other: The mesh to append.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|