differt.em.utils module#
Utilities for working with EM fields.
- lengths_to_delays(lengths, speed=299792458.0)[source]#
Compute the delay, in seconds, corresponding to each length.
- Parameters:
- Return type:
Float[Array, '*#batch']
- Returns:
The array of path delays.
Examples
The following example shows how to compute a delay from a length.
>>> from differt.em.constants import c >>> from differt.em.utils import ( ... lengths_to_delays, ... ) >>> >>> lengths = jnp.array([1.0, 2.0, 4.0]) >>> lengths_to_delays(lengths) * c Array([1., 2., 4.], dtype=float32) >>> lengths_to_delays(lengths, speed=2.0) Array([0.5, 1. , 2. ], dtype=float32)
- path_delays(paths, **kwargs)[source]#
Compute the path delay, in seconds, of each path.
Each path is exactly made of
path_length
vertices.- Parameters:
paths (
Float[Array, '*batch path_length 3']
) – The array of path vertices.kwargs (
Any
) – Keyword arguments passed tolengths_to_delays
.
- Return type:
Float[Array, '*batch']
- Returns:
The array of path delays.
Examples
The following example shows how to compute the delay of a very simple path.
>>> from differt.em.constants import c >>> from differt.em.utils import ( ... path_delays, ... ) >>> >>> path = jnp.array([[1.0, 0.0, 0.0], [1.0, 1.0, 0.0]]) >>> path_delays(path) * c Array(1., dtype=float32) >>> path_delays(path, speed=2.0) Array(0.5, dtype=float32)