differt-core 0.0.16__tar.gz → 0.0.18__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 (75) hide show
  1. {differt_core-0.0.16 → differt_core-0.0.18}/Cargo.lock +26 -1
  2. {differt_core-0.0.16 → differt_core-0.0.18}/Cargo.toml +5 -0
  3. {differt_core-0.0.16 → differt_core-0.0.18}/PKG-INFO +2 -2
  4. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/Cargo.toml +6 -2
  5. differt_core-0.0.18/differt-core/README.md +33 -0
  6. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/benches/benchmarks/graph_iterators.rs +1 -1
  7. differt_core-0.0.18/differt-core/python/differt_core/__init__.py +18 -0
  8. differt_core-0.0.18/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +16 -0
  9. {differt_core-0.0.16 → differt_core-0.0.18/differt-core}/python/differt_core/_lowlevel/rt/graph.pyi +30 -6
  10. {differt_core-0.0.16 → differt_core-0.0.18/differt-core}/python/differt_core/_lowlevel/scene/sionna.pyi +9 -2
  11. differt_core-0.0.18/differt-core/python/differt_core/_lowlevel/scene/triangle_scene.pyi +7 -0
  12. differt_core-0.0.18/differt-core/python/differt_core/geometry/__init__.py +1 -0
  13. differt_core-0.0.18/differt-core/python/differt_core/geometry/triangle_mesh.py +7 -0
  14. differt_core-0.0.18/differt-core/python/differt_core/rt/__init__.py +1 -0
  15. {differt_core-0.0.16 → differt_core-0.0.18/differt-core}/python/differt_core/rt/graph.py +6 -6
  16. differt_core-0.0.18/differt-core/python/differt_core/scene/__init__.py +1 -0
  17. differt_core-0.0.18/differt-core/python/differt_core/scene/sionna.py +20 -0
  18. differt_core-0.0.18/differt-core/python/differt_core/scene/triangle_scene.py +7 -0
  19. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/geometry/mod.rs +1 -0
  20. differt_core-0.0.18/differt-core/src/geometry/triangle_mesh.rs +499 -0
  21. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/lib.rs +1 -0
  22. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/rt/graph.rs +86 -45
  23. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/rt/mod.rs +1 -0
  24. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/scene/mod.rs +1 -0
  25. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/scene/sionna.rs +81 -64
  26. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/src/scene/triangle_scene.rs +25 -28
  27. differt_core-0.0.18/differt-core/tests/rt/test_graph.py +154 -0
  28. {differt_core-0.0.16 → differt_core-0.0.18}/pyproject.toml +1 -4
  29. differt_core-0.0.18/python/differt_core/__init__.py +18 -0
  30. differt_core-0.0.18/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +16 -0
  31. {differt_core-0.0.16/differt-core → differt_core-0.0.18}/python/differt_core/_lowlevel/rt/graph.pyi +30 -6
  32. {differt_core-0.0.16/differt-core → differt_core-0.0.18}/python/differt_core/_lowlevel/scene/sionna.pyi +9 -2
  33. differt_core-0.0.18/python/differt_core/_lowlevel/scene/triangle_scene.pyi +7 -0
  34. differt_core-0.0.18/python/differt_core/geometry/__init__.py +1 -0
  35. differt_core-0.0.18/python/differt_core/geometry/triangle_mesh.py +7 -0
  36. differt_core-0.0.18/python/differt_core/rt/__init__.py +1 -0
  37. {differt_core-0.0.16/differt-core → differt_core-0.0.18}/python/differt_core/rt/graph.py +6 -6
  38. differt_core-0.0.18/python/differt_core/scene/__init__.py +1 -0
  39. differt_core-0.0.18/python/differt_core/scene/sionna.py +20 -0
  40. differt_core-0.0.18/python/differt_core/scene/triangle_scene.py +7 -0
  41. differt_core-0.0.16/differt-core/python/differt_core/__init__.py +0 -10
  42. differt_core-0.0.16/differt-core/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +0 -11
  43. differt_core-0.0.16/differt-core/python/differt_core/_lowlevel/scene/triangle_scene.pyi +0 -8
  44. differt_core-0.0.16/differt-core/python/differt_core/geometry/__init__.py +0 -1
  45. differt_core-0.0.16/differt-core/python/differt_core/geometry/triangle_mesh.py +0 -7
  46. differt_core-0.0.16/differt-core/python/differt_core/rt/__init__.py +0 -1
  47. differt_core-0.0.16/differt-core/python/differt_core/scene/__init__.py +0 -1
  48. differt_core-0.0.16/differt-core/python/differt_core/scene/sionna.py +0 -9
  49. differt_core-0.0.16/differt-core/python/differt_core/scene/triangle_scene.py +0 -7
  50. differt_core-0.0.16/differt-core/src/geometry/triangle_mesh.rs +0 -242
  51. differt_core-0.0.16/differt-core/tests/benchmarks/conftest.py +0 -20
  52. differt_core-0.0.16/differt-core/tests/benchmarks/test_graph.py +0 -84
  53. differt_core-0.0.16/differt-core/tests/rt/__init__.py +0 -0
  54. differt_core-0.0.16/differt-core/tests/rt/test_graph.py +0 -58
  55. differt_core-0.0.16/python/differt_core/__init__.py +0 -10
  56. differt_core-0.0.16/python/differt_core/_lowlevel/geometry/triangle_mesh.pyi +0 -11
  57. differt_core-0.0.16/python/differt_core/_lowlevel/scene/triangle_scene.pyi +0 -8
  58. differt_core-0.0.16/python/differt_core/geometry/__init__.py +0 -1
  59. differt_core-0.0.16/python/differt_core/geometry/triangle_mesh.py +0 -7
  60. differt_core-0.0.16/python/differt_core/rt/__init__.py +0 -1
  61. differt_core-0.0.16/python/differt_core/scene/__init__.py +0 -1
  62. differt_core-0.0.16/python/differt_core/scene/sionna.py +0 -9
  63. differt_core-0.0.16/python/differt_core/scene/triangle_scene.py +0 -7
  64. {differt_core-0.0.16/differt-core → differt_core-0.0.18}/README.md +0 -0
  65. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/LICENSE.md +0 -0
  66. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/benches/bench_main.rs +0 -0
  67. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/benches/benchmarks/mod.rs +0 -0
  68. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/python/differt_core/_lowlevel/__init__.pyi +0 -0
  69. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/python/differt_core/_lowlevel/rt/__init__.pyi +0 -0
  70. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/python/differt_core/py.typed +0 -0
  71. {differt_core-0.0.16 → differt_core-0.0.18}/differt-core/tests/__init__.py +0 -0
  72. {differt_core-0.0.16/differt-core/tests/benchmarks → differt_core-0.0.18/differt-core/tests/rt}/__init__.py +0 -0
  73. {differt_core-0.0.16 → differt_core-0.0.18}/python/differt_core/_lowlevel/__init__.pyi +0 -0
  74. {differt_core-0.0.16 → differt_core-0.0.18}/python/differt_core/_lowlevel/rt/__init__.pyi +0 -0
  75. {differt_core-0.0.16 → differt_core-0.0.18}/python/differt_core/py.typed +0 -0
@@ -238,9 +238,10 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
238
238
 
239
239
  [[package]]
240
240
  name = "differt-core"
241
- version = "0.0.16"
241
+ version = "0.0.18"
242
242
  dependencies = [
243
243
  "criterion",
244
+ "indexmap",
244
245
  "log",
245
246
  "nalgebra",
246
247
  "ndarray",
@@ -260,6 +261,12 @@ version = "1.11.0"
260
261
  source = "registry+https://github.com/rust-lang/crates.io-index"
261
262
  checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
262
263
 
264
+ [[package]]
265
+ name = "equivalent"
266
+ version = "1.0.1"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
269
+
263
270
  [[package]]
264
271
  name = "errno"
265
272
  version = "0.3.8"
@@ -396,6 +403,12 @@ dependencies = [
396
403
  "crunchy",
397
404
  ]
398
405
 
406
+ [[package]]
407
+ name = "hashbrown"
408
+ version = "0.14.5"
409
+ source = "registry+https://github.com/rust-lang/crates.io-index"
410
+ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
411
+
399
412
  [[package]]
400
413
  name = "heck"
401
414
  version = "0.4.1"
@@ -408,6 +421,17 @@ version = "0.3.9"
408
421
  source = "registry+https://github.com/rust-lang/crates.io-index"
409
422
  checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
410
423
 
424
+ [[package]]
425
+ name = "indexmap"
426
+ version = "2.5.0"
427
+ source = "registry+https://github.com/rust-lang/crates.io-index"
428
+ checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5"
429
+ dependencies = [
430
+ "equivalent",
431
+ "hashbrown",
432
+ "serde",
433
+ ]
434
+
411
435
  [[package]]
412
436
  name = "indoc"
413
437
  version = "2.0.5"
@@ -765,6 +789,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
765
789
  checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
766
790
  dependencies = [
767
791
  "cfg-if",
792
+ "indexmap",
768
793
  "indoc",
769
794
  "libc",
770
795
  "memoffset",
@@ -2,6 +2,11 @@
2
2
  debug = true
3
3
  strip = false
4
4
 
5
+ [profile.profiling]
6
+ debug = true
7
+ inherits = "release"
8
+ strip = false
9
+
5
10
  [profile.release]
6
11
  codegen-units = 1
7
12
  lto = "fat"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: differt-core
3
- Version: 0.0.16
3
+ Version: 0.0.18
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Python :: 3.9
6
6
  Classifier: Programming Language :: Python :: 3.10
@@ -12,7 +12,7 @@ Classifier: Topic :: Scientific/Engineering
12
12
  Classifier: Programming Language :: Rust
13
13
  Classifier: Programming Language :: Python :: Implementation :: CPython
14
14
  Classifier: Programming Language :: Python :: Implementation :: PyPy
15
- Requires-Dist: numpy >=1.20
15
+ Requires-Dist: numpy >=1.20, <2
16
16
  License-File: LICENSE.md
17
17
  Summary: Core backend of DifffeRT implemented in Rust
18
18
  Keywords: ray tracing,differentiable,propagation,radio,jax
@@ -3,13 +3,14 @@ harness = false
3
3
  name = "bench_main"
4
4
 
5
5
  [dependencies]
6
+ indexmap = {version = "2.5.0", features = ["serde"]}
6
7
  log = "0.4.21"
7
8
  nalgebra = "0.32.3"
8
9
  ndarray = {version = "0.15", features = ["rayon"]}
9
10
  numpy = "0.21"
10
11
  obj-rs = "0.7.1"
11
12
  ply-rs = "0.1.3"
12
- pyo3 = "0.21"
13
+ pyo3 = {version = "0.21", features = ["indexmap"]}
13
14
  pyo3-log = "0.10"
14
15
  quick-xml = {version = "0.31.0", features = ["serialize"]}
15
16
  serde = {version = "1.0.197", features = ["derive"]}
@@ -28,8 +29,11 @@ crate-type = ["cdylib", "rlib"]
28
29
  doctest = false
29
30
  name = "differt_core"
30
31
 
32
+ [lints.rust]
33
+ unexpected_cfgs = {level = "warn", check-cfg = ['cfg(tarpaulin_include)']}
34
+
31
35
  [package]
32
36
  edition = "2021"
33
37
  name = "differt-core"
34
38
  rust-version = "1.75.0"
35
- version = "0.0.16"
39
+ version = "0.0.18"
@@ -0,0 +1,33 @@
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/jeertmans/DiffeRT/main/static/logo_250px.png" alt="DiffeRT logo"></img>
3
+ </div>
4
+
5
+ <div align="center">
6
+
7
+ # DiffeRT-core
8
+
9
+ [![Latest Release][pypi-version-badge]][pypi-version-url]
10
+ [![Python version][pypi-python-version-badge]][pypi-version-url]
11
+ [![Documentation][documentation-badge]][documentation-url]
12
+
13
+ </div>
14
+
15
+ This package contains the core backend of
16
+ [DiffeRT](https://pypi.org/project/DiffeRT/),
17
+ implemented in Rust for performances.
18
+
19
+ As a result, both `differt` and `differt-core` will
20
+ share the same version, and `differt` directly depends on `differt-core`.
21
+
22
+ However, you can decide to only install `differt-core`
23
+ if you want to use features that are specific to this package.
24
+
25
+ The installation procedure, contributing guidelines, and documentation,
26
+ are shared with the
27
+ [main DiffeRT package](https://github.com/jeertmans/DiffeRT).
28
+
29
+ [pypi-version-badge]: https://img.shields.io/pypi/v/DiffeRT-core?label=DiffeRT-core&color=blueviolet
30
+ [pypi-version-url]: https://pypi.org/project/DiffeRT-core/
31
+ [pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/DiffeRT-core?color=orange
32
+ [documentation-badge]: https://readthedocs.org/projects/differt/badge/?version=latest
33
+ [documentation-url]: https://differt.readthedocs.io/latest/?badge=latest
@@ -1,4 +1,4 @@
1
- use criterion::{black_box, criterion_group, Criterion, Throughput};
1
+ use criterion::{Criterion, Throughput, black_box, criterion_group};
2
2
  use differt_core::rt::graph::{complete::CompleteGraph, directed::DiGraph};
3
3
 
4
4
  const NUM_NODES: usize = 1000;
@@ -0,0 +1,18 @@
1
+ """
2
+ Core package written in Rust and re-exported here.
3
+
4
+ The present package only provides lower-level utilities with
5
+ a focus on performances.
6
+
7
+ Currently, Rust uses NumPy's C API to communicate between Python
8
+ and Rust, hence casting NumPy arrays to JAX arrays in the process,
9
+ thus making it impossible to trace variables used in Rust code.
10
+
11
+ In the future, we plan on providing XLA-compatible functions,
12
+ so that one can use :mod:`differt_core` and still be able to differentiate
13
+ its code. We welcome any contribution on that topic!
14
+ """
15
+
16
+ __all__ = ("__version__",)
17
+
18
+ from differt_core._lowlevel import __version__
@@ -0,0 +1,16 @@
1
+ import numpy as np
2
+ from jaxtyping import Float, Int, UInt
3
+
4
+ class TriangleMesh:
5
+ vertices: Float[np.ndarray, "num_vertices 3"]
6
+ triangles: UInt[np.ndarray, "num_triangles 3"]
7
+ face_colors: Float[np.ndarray, "num_triangles 3"] | None
8
+ face_materials: Int[np.ndarray, " num_triangles"] | None
9
+ material_names: list[str]
10
+ object_bounds: UInt[np.ndarray, "num_objects 2"] | None
11
+
12
+ def append(self, other: TriangleMesh) -> None: ...
13
+ @classmethod
14
+ def load_obj(cls, file: str) -> TriangleMesh: ...
15
+ @classmethod
16
+ def load_ply(cls, file: str) -> TriangleMesh: ...
@@ -6,10 +6,20 @@ from jaxtyping import Bool, UInt
6
6
  class CompleteGraph:
7
7
  def __init__(self, num_nodes: int) -> None: ...
8
8
  def all_paths(
9
- self, from_: int, to: int, depth: int, *, include_from_and_to: bool = True
9
+ self,
10
+ from_: int,
11
+ to: int,
12
+ depth: int,
13
+ *,
14
+ include_from_and_to: bool = True,
10
15
  ) -> AllPathsFromCompleteGraphIter: ...
11
16
  def all_paths_array(
12
- self, from_: int, to: int, depth: int, *, include_from_and_to: bool = True
17
+ self,
18
+ from_: int,
19
+ to: int,
20
+ depth: int,
21
+ *,
22
+ include_from_and_to: bool = True,
13
23
  ) -> UInt[np.ndarray, "num_paths path_depth"]: ...
14
24
  def all_paths_array_chunks(
15
25
  self,
@@ -24,18 +34,32 @@ class CompleteGraph:
24
34
  class DiGraph:
25
35
  @classmethod
26
36
  def from_adjacency_matrix(
27
- cls, adjacency_matrix: Bool[np.ndarray, "num_nodes num_nodes"]
37
+ cls,
38
+ adjacency_matrix: Bool[np.ndarray, "num_nodes num_nodes"],
28
39
  ) -> DiGraph: ...
29
40
  @classmethod
30
41
  def from_complete_graph(cls, graph: CompleteGraph) -> DiGraph: ...
31
42
  def insert_from_and_to_nodes(
32
- self, *, direct_path: bool = True
43
+ self,
44
+ *,
45
+ direct_path: bool = True,
33
46
  ) -> tuple[int, int]: ...
47
+ def disconnect_nodes(self, *nodes: int, fast_mode: bool = True) -> None: ...
34
48
  def all_paths(
35
- self, from_: int, to: int, depth: int, *, include_from_and_to: bool = True
49
+ self,
50
+ from_: int,
51
+ to: int,
52
+ depth: int,
53
+ *,
54
+ include_from_and_to: bool = True,
36
55
  ) -> AllPathsFromDiGraphIter: ...
37
56
  def all_paths_array(
38
- self, from_: int, to: int, depth: int, *, include_from_and_to: bool = True
57
+ self,
58
+ from_: int,
59
+ to: int,
60
+ depth: int,
61
+ *,
62
+ include_from_and_to: bool = True,
39
63
  ) -> UInt[np.ndarray, "num_paths path_depth"]: ...
40
64
  def all_paths_array_chunks(
41
65
  self,
@@ -5,5 +5,12 @@ class SionnaScene:
5
5
  @classmethod
6
6
  def load_xml(cls, file: str) -> SionnaScene: ...
7
7
 
8
- class Material: ...
9
- class Shape: ...
8
+ class Material:
9
+ id: str
10
+ rgb: tuple[float, float, float]
11
+
12
+ class Shape:
13
+ type: str
14
+ id: str
15
+ file: str
16
+ material_id: str
@@ -0,0 +1,7 @@
1
+ from differt_core.geometry.triangle_mesh import TriangleMesh
2
+
3
+ class TriangleScene:
4
+ mesh: list[TriangleMesh]
5
+
6
+ @classmethod
7
+ def load_xml(cls, file: str) -> TriangleScene: ...
@@ -0,0 +1 @@
1
+ """Geometry utilities used by :mod:`differt.geometry`."""
@@ -0,0 +1,7 @@
1
+ """Triangle mesh utilities used by :mod:`differt.geometry.triangle_mesh`."""
2
+
3
+ __all__ = ("TriangleMesh",)
4
+
5
+ from differt_core import _lowlevel
6
+
7
+ TriangleMesh = _lowlevel.geometry.triangle_mesh.TriangleMesh
@@ -0,0 +1 @@
1
+ """Ray Tracing utilities used by :mod:`differt.rt`."""
@@ -1,15 +1,15 @@
1
- """TODO."""
1
+ """Graph utilities to generate path candidates, as used by exhaustive Ray Tracing methods, e.g., the Image Method."""
2
2
 
3
3
  __all__ = (
4
- "CompleteGraph",
5
- "DiGraph",
6
- "AllPathsFromCompleteGraphIter",
7
4
  "AllPathsFromCompleteGraphChunksIter",
8
- "AllPathsFromDiGraphIter",
5
+ "AllPathsFromCompleteGraphIter",
9
6
  "AllPathsFromDiGraphChunksIter",
7
+ "AllPathsFromDiGraphIter",
8
+ "CompleteGraph",
9
+ "DiGraph",
10
10
  )
11
11
 
12
- from .. import _lowlevel
12
+ from differt_core import _lowlevel
13
13
 
14
14
  AllPathsFromCompleteGraphChunksIter = (
15
15
  _lowlevel.rt.graph.AllPathsFromCompleteGraphChunksIter
@@ -0,0 +1 @@
1
+ """Scene utilities used by :mod:`differt.scene`."""
@@ -0,0 +1,20 @@
1
+ """Fast and low-memory functions to read Sionna scenes.
2
+
3
+ Fast because written in Rust and uses the extremely performant
4
+ `quick_xml <https://github.com/tafia/quick-xml>`_ library.
5
+
6
+ Low-memory because it only stores the minimal amount of information
7
+ to reproduce Sionna scenes, and skips the rest (e.g., display information).
8
+
9
+ As filepaths to shapes are relative to the initial XML config file,
10
+ it is preferred to directly use ``load_xml`` from another scene
11
+ class, like :meth:`TriangleScene<differt_core.scene.triangle_scene.TriangleScene>`.
12
+ """
13
+
14
+ __all__ = ("Material", "Shape", "SionnaScene")
15
+
16
+ from differt_core import _lowlevel
17
+
18
+ Material = _lowlevel.scene.sionna.Material
19
+ Shape = _lowlevel.scene.sionna.Shape
20
+ SionnaScene = _lowlevel.scene.sionna.SionnaScene
@@ -0,0 +1,7 @@
1
+ """Triangle scene utilities used by :mod:`differt.scene.triangle_scene`."""
2
+
3
+ __all__ = ("TriangleScene",)
4
+
5
+ from differt_core import _lowlevel
6
+
7
+ TriangleScene = _lowlevel.scene.triangle_scene.TriangleScene
@@ -2,6 +2,7 @@ use pyo3::{prelude::*, wrap_pymodule};
2
2
 
3
3
  pub mod triangle_mesh;
4
4
 
5
+ #[cfg(not(tarpaulin_include))]
5
6
  #[pymodule]
6
7
  pub(crate) fn geometry(m: Bound<'_, PyModule>) -> PyResult<()> {
7
8
  m.add_wrapped(wrap_pymodule!(triangle_mesh::triangle_mesh))?;