differt 0.2.0__py3-none-any.whl → 0.3.0__py3-none-any.whl

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.
@@ -832,12 +832,12 @@ def cartesian_to_spherical(
832
832
  xyz: Float[ArrayLike, "*batch 3"],
833
833
  ) -> Float[Array, "*batch 3"]:
834
834
  """
835
- Transform cartesian coordinates to spherical coordinates.
835
+ Transform Cartesian coordinates to spherical coordinates.
836
836
 
837
837
  See :ref:`conventions` for details.
838
838
 
839
839
  Args:
840
- xyz: The array of cartesian coordinates.
840
+ xyz: The array of Cartesian coordinates.
841
841
 
842
842
  Returns:
843
843
  The array of corresponding spherical coordinates.
@@ -860,7 +860,7 @@ def spherical_to_cartesian(
860
860
  rpa: Float[ArrayLike, "*batch 3"] | Float[ArrayLike, "*batch 2"],
861
861
  ) -> Float[Array, "*batch 3"]:
862
862
  """
863
- Transform spherical coordinates to cartisian coordinates.
863
+ Transform spherical coordinates to Cartesian coordinates.
864
864
 
865
865
  See :ref:`conventions` for details.
866
866
 
@@ -870,7 +870,7 @@ def spherical_to_cartesian(
870
870
  If the radial component is missing, a radius of 1 is assumed.
871
871
 
872
872
  Returns:
873
- The array of corresponding cartesian coordinates.
873
+ The array of corresponding Cartesian coordinates.
874
874
 
875
875
  .. seealso::
876
876
 
differt/plotting/_core.py CHANGED
@@ -544,7 +544,7 @@ def _(
544
544
 
545
545
  xs, ys, zs = np.asarray(markers).reshape(-1, 3).T
546
546
 
547
- ax.scatter(xs, ys, zs=zs, **kwargs) # type: ignore[reportArgumentType]
547
+ ax.scatter(xs, ys, zs=zs, **kwargs)
548
548
 
549
549
  return fig
550
550
 
@@ -770,7 +770,7 @@ def draw_contour( # noqa: PLR0917
770
770
 
771
771
  Warning:
772
772
  VisPy does not support filling the contour.
773
- Plotly does not support 3D contours, and will draw the coontour on
773
+ Plotly does not support 3D contours, and will draw the contour on
774
774
  a 2D figure instead.
775
775
 
776
776
  Examples:
@@ -6,4 +6,7 @@ import numpy as np
6
6
  from jaxtyping import Array
7
7
 
8
8
  # NOTE: we declare this is another module to be able to patch it when building the docs
9
- ArrayType = TypeVar("ArrayType", bound=Array | np.ndarray)
9
+ ArrayType = TypeVar(
10
+ "ArrayType",
11
+ bound=Array | np.ndarray, # type: ignore[reportMissingTypeArgument]
12
+ )
@@ -171,7 +171,7 @@ class DeepMIMO(eqx.Module, Generic[ArrayType]):
171
171
  """
172
172
  return jax.tree.map(jnp.asarray, self)
173
173
 
174
- def numpy(self) -> "DeepMIMO[np.ndarray]":
174
+ def numpy(self) -> "DeepMIMO[np.ndarray]": # type: ignore[reportMissingTypeArgument]
175
175
  """
176
176
  Return a copy of this class with arrays converted to NumPy arrays.
177
177
 
differt/utils.py CHANGED
@@ -1,23 +1,15 @@
1
1
  """General purpose utilities."""
2
2
 
3
- import warnings
4
- from collections.abc import Callable
5
3
  from functools import partial
6
4
  from typing import (
7
- Any,
8
- Concatenate,
9
5
  Literal,
10
- NamedTuple,
11
- ParamSpec,
12
6
  overload,
13
7
  )
14
8
 
15
- import chex
16
9
  import equinox as eqx
17
10
  import jax
18
11
  import jax.numpy as jnp
19
- import optax
20
- from jaxtyping import Array, ArrayLike, Float, Inexact, Num, PRNGKeyArray, Shaped
12
+ from jaxtyping import Array, ArrayLike, Float, Num, PRNGKeyArray, Shaped
21
13
 
22
14
 
23
15
  @overload
@@ -138,129 +130,6 @@ def sorted_array2(array: Shaped[ArrayLike, "m n"]) -> Shaped[Array, "m n"]:
138
130
  return array[jnp.lexsort(array.T[::-1])]
139
131
 
140
132
 
141
- # Redefined here, because chex uses deprecated type hints
142
- # TODO: fixme when google/chex#361 is resolved.
143
- # TODO: changme because beartype>=0.20 complains that it cannot import ArrayTree,
144
- # and I don't see how to fix it.
145
- OptState = Any
146
- # TODO: fixme when Python >= 3.11
147
- P = ParamSpec("P")
148
-
149
-
150
- class OptimizeResult(NamedTuple):
151
- """
152
- A class to hold the result of an optimization, akin to :class:`scipy.optimize.OptimizeResult`.
153
-
154
- .. deprecated:: 0.1.2
155
- This class is deprecated and will be removed in the v0.2.0 release.
156
- See `#283 <https://github.com/jeertmans/DiffeRT/issues/283>`_ for motivation
157
- and alternatives.
158
- """
159
-
160
- x: Inexact[Array, "*batch n"]
161
- """The solution of the optimization."""
162
- fun: Inexact[Array, " *batch"]
163
- """Value of objective function at :attr:`x`."""
164
-
165
-
166
- @eqx.filter_jit
167
- def minimize(
168
- fun: Callable[Concatenate[Inexact[Array, " n"], P], Inexact[Array, " "]],
169
- x0: Inexact[ArrayLike, "*batch n"],
170
- args: tuple[Any, ...] = (),
171
- steps: int = 1000,
172
- optimizer: optax.GradientTransformation | None = None,
173
- ) -> OptimizeResult:
174
- """
175
- Minimize a scalar function of one or more variables.
176
-
177
- .. deprecated:: 0.1.2
178
- This function is deprecated and will be removed in the v0.2.0 release.
179
- See `#283 <https://github.com/jeertmans/DiffeRT/issues/283>`_ for motivation
180
- and alternatives.
181
-
182
- The minimization is achieved by computing the
183
- gradient of the objective function, and performing
184
- a fixed number of iterations (i.e., ``steps``).
185
-
186
- Args:
187
- fun: The objective function to be minimized.
188
- x0: The initial guess.
189
- args: Positional arguments passed to ``fun``.
190
-
191
- Those arguments are also expected have
192
- batch dimensions similar to ``x0``.
193
-
194
- .. note::
195
-
196
- If your function has static arguments,
197
- please wrap the function with :func:`functools.partial`:
198
-
199
- .. code-block:: python
200
-
201
- fun_p = partial(fun, static_arg=static_value)
202
-
203
- If your function has keyword-only
204
- arguments, create a wrapper function that
205
- maps positional arguments to keyword only arguments:
206
-
207
- .. code-block:: python
208
-
209
- fun_p = lambda x, kw_only_value: fun(x, kw_only_arg=kw_only_value)
210
-
211
- steps: The number of steps to perform.
212
- optimizer: The optimizer to use. If not provided,
213
- uses :func:`optax.adam` with a learning rate of ``0.1``.
214
-
215
- Returns:
216
- The optimization result.
217
- """
218
- msg = (
219
- "This function is deprecated and will be removed in the v0.2.0 release. "
220
- "See https://github.com/jeertmans/DiffeRT/issues/283 for motivation and alternatives."
221
- )
222
- warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
223
-
224
- x0 = jnp.asarray(x0)
225
- if x0.ndim > 1 and args:
226
- chex.assert_tree_has_only_ndarrays(args, exception_type=TypeError)
227
-
228
- def shape_str(arr_or_shape: Array | tuple[int, ...]) -> str:
229
- if isinstance(arr_or_shape, tuple):
230
- shape = arr_or_shape
231
- else:
232
- shape = arr_or_shape.shape
233
- return str(shape).replace(" ", "")
234
-
235
- msg = f"{shape_str(x0.shape[:-1])} is expected to be the shape prefix of all arguments, got {', '.join(shape_str(arr) for arr in args)}."
236
- chex.assert_tree_shape_prefix(
237
- args,
238
- x0.shape[:-1],
239
- exception_type=TypeError,
240
- custom_message=msg,
241
- )
242
-
243
- optimizer = optax.adam(learning_rate=0.1) if optimizer is None else optimizer
244
-
245
- f_and_df = jax.value_and_grad(fun)
246
- for _ in x0.shape[:-1]:
247
- f_and_df = jax.vmap(f_and_df)
248
-
249
- def update(
250
- state: tuple[Inexact[Array, " *batch n"], OptState],
251
- _: None,
252
- ) -> tuple[tuple[Inexact[Array, " *batch n"], OptState], Inexact[Array, " *batch"]]:
253
- x, opt_state = state
254
- loss, grads = f_and_df(x, *args)
255
- updates, opt_state = optimizer.update(grads, opt_state, x)
256
- x = optax.apply_updates(x, updates)
257
- return (x, opt_state), loss # type: ignore[reportReturnType]
258
-
259
- (x, _), losses = jax.lax.scan(update, init=(x0, optimizer.init(x0)), length=steps)
260
-
261
- return OptimizeResult(x, losses[-1])
262
-
263
-
264
133
  @partial(jax.jit, static_argnames=("shape",))
265
134
  def sample_points_in_bounding_box(
266
135
  bounding_box: Float[ArrayLike, "2 3"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DiffeRT
3
- Version: 0.2.0
3
+ Version: 0.3.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
@@ -20,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Topic :: Scientific/Engineering
21
21
  Requires-Python: >=3.10
22
22
  Requires-Dist: chex>=0.1.86
23
- Requires-Dist: differt-core==0.2.0
23
+ Requires-Dist: differt-core==0.3.0
24
24
  Requires-Dist: equinox>=0.12.2
25
25
  Requires-Dist: filelock>=3.15.4
26
26
  Requires-Dist: jax>=0.4.32
@@ -139,7 +139,7 @@ If you use this software, please cite it as:
139
139
  author = {Eertmans, Jérome},
140
140
  url = {https://github.com/jeertmans/DiffeRT},
141
141
  license = {MIT},
142
- version = {v0.2.0}
142
+ version = {v0.3.0}
143
143
  }
144
144
  ```
145
145
 
@@ -1,7 +1,7 @@
1
1
  differt/__init__.py,sha256=-iUJotwHLuv1X6IU32sCC7p88LRWbOkvatffBk1VNZU,175
2
2
  differt/_version.py,sha256=uTz7aW-bhAtOT1i_I_nRAWjijPXAkbcmUKBOnMbDiT4,153
3
3
  differt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- differt/utils.py,sha256=KiNGYTX44M65fknSX_O95fOshnr7C8-S-xZW_B6Qvao,10079
4
+ differt/utils.py,sha256=7UfKIUVSfXatQ313rIXR2VB1_3485Fn363LPsQXScbI,5624
5
5
  differt/em/__init__.py,sha256=eoAfwZRa9-RsWrDxM2UGRrncJvkFkgtrIPSWOsdy7jM,1265
6
6
  differt/em/_antenna.py,sha256=wKbAZn5VH89i6EnwHiQZvg6NmZltfuPVbKBNK2BT89I,21562
7
7
  differt/em/_constants.py,sha256=pEhxuuprbXmuAINmVe4y-tc8fekBnCuh5_btv6RGTCo,304
@@ -13,13 +13,13 @@ differt/em/_utils.py,sha256=VRZpTiOJDGt6PyHfPDAe-2a458KIR1YtLNQCn-5n1rI,12732
13
13
  differt/geometry/__init__.py,sha256=Blx_3_VgkKgRmSQ5zQvi6rjrnY6XmA3K4CeUla-g330,1177
14
14
  differt/geometry/_paths.py,sha256=ueFEHL365UL0geCQ7tvPfOPQuFo1knxxXT0thifZ5_A,22598
15
15
  differt/geometry/_triangle_mesh.py,sha256=PL-XGnS6winIjbVZb4PpOQ_x4miN2aolXNobXnQYLUA,58345
16
- differt/geometry/_utils.py,sha256=_IycOPL1Ft0EN065OdH4G12OZb-6Eqkcusp--c_YvUU,27387
16
+ differt/geometry/_utils.py,sha256=_AnLdaOiT5f_iT8AJyPivizTCIgroXZ9g9KpdFsXUWE,27387
17
17
  differt/plotting/__init__.py,sha256=pcvMZw-MlJhK9l1ypx3MHrNSP8oaKN8rx_RQg54S7zE,3276
18
- differt/plotting/_core.py,sha256=pjeph3n9zkCWVeZteavMDlmI-nCrjV3S1441zFsso80,33646
18
+ differt/plotting/_core.py,sha256=0b_BOhKTsMMHxFiWc6bQ0pSXlNa32VqYjttidCKGc58,33609
19
19
  differt/plotting/_utils.py,sha256=vn45Crjmy8-D-39ehPCABuo_tfxXrkm2BDLrKDgXIW8,21498
20
20
  differt/plugins/__init__.py,sha256=OfF7mDh2N9O8mvBQti0x9RDE-MRObFFLFyeEZMI5wM8,140
21
- differt/plugins/_deepmimo_types.py,sha256=_eTNYGFjI8LutfaqdsXLOSjW4Le09LsvUiHZJ3_-61U,249
22
- differt/plugins/deepmimo.py,sha256=PsKLv_LO7G6oC68uD1WkiYacxVZjpenSVn_otXbu_Qs,21430
21
+ differt/plugins/_deepmimo_types.py,sha256=ztPx1n3J9UWUhbhp7pS-pO1h8oZEP8DmVk5g-KGco_g,303
22
+ differt/plugins/deepmimo.py,sha256=iRk9EfjinzLz2mwE1xheHMVXScrhpJLTFG3S_Dg_MXQ,21473
23
23
  differt/rt/__init__.py,sha256=CVJ1MLDl4wt7q0TNODJwgMMG_pQ_Ac_r7sY8q_kE4pk,1136
24
24
  differt/rt/_fermat.py,sha256=U63rb5_3PMKVmt6umCY5M4TQeLO2ZdKY7cr9IDHZVtU,14442
25
25
  differt/rt/_image_method.py,sha256=mihtcj3r74-wrz10CuZT4d_-cQi5N-YyJpDZ54zU6D4,17117
@@ -27,7 +27,7 @@ differt/rt/_utils.py,sha256=_pqv-lBznVDlaQlTsCzUvyRIeEwqyB9X8bWv86xcdjc,25205
27
27
  differt/scene/__init__.py,sha256=3Rsd46SitJpdmwqe3hWrSctrLM6bmt-BzSUf0zL6Bt4,265
28
28
  differt/scene/_sionna.py,sha256=gmR4mtSEUG9p_UFV73SP1s8iz8l4AF-uCQ9wharjhHU,8720
29
29
  differt/scene/_triangle_scene.py,sha256=3WgR1SJJvJSTZYrCmLqz9Fp8rrqNOaZR09Ys0fO8Efg,44300
30
- differt-0.2.0.dist-info/METADATA,sha256=li9-nlX1BFXmAzChFCk30bAb0-lc41uvDINYmsBT9nQ,5957
31
- differt-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
- differt-0.2.0.dist-info/entry_points.txt,sha256=hWDguBZsyxba8dw_h5wfvSr-57UxXJLYNqVqikSGAE8,70
33
- differt-0.2.0.dist-info/RECORD,,
30
+ differt-0.3.0.dist-info/METADATA,sha256=9mcXzca4likQDtFOvPhA1fbh8E7AEZktFZ2JSDqAl08,5957
31
+ differt-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
+ differt-0.3.0.dist-info/entry_points.txt,sha256=hWDguBZsyxba8dw_h5wfvSr-57UxXJLYNqVqikSGAE8,70
33
+ differt-0.3.0.dist-info/RECORD,,