Spatial
Discretization of a spatial domain.
- immunowave.spatial.laplacian_kernel_1d = array([ 1., -2., 1.])
1D Laplacian kernel.
- immunowave.spatial.laplacian_kernel_2d = array([[ 0.25, 0.5 , 0.25], [ 0.5 , -3. , 0.5 ], [ 0.25, 0.5 , 0.25]])
2D Laplacian kernel (isotropic 9-point stencil of Oono and Puri).
- immunowave.spatial.laplacian_kernel_3d = array([[[ 0.07692308, 0.11538462, 0.07692308], [ 0.11538462, 0.23076923, 0.11538462], [ 0.07692308, 0.11538462, 0.07692308]], [[ 0.11538462, 0.23076923, 0.11538462], [ 0.23076923, -3.38461538, 0.23076923], [ 0.11538462, 0.23076923, 0.11538462]], [[ 0.07692308, 0.11538462, 0.07692308], [ 0.11538462, 0.23076923, 0.11538462], [ 0.07692308, 0.11538462, 0.07692308]]])
3D Laplacian kernel (isotropic 27-point stencil of O’Reilly and Beck).
- immunowave.spatial.NDFn
Scalar function of 1, 2, or 3 variables.
alias of
Callable
[[float
],float
] |Callable
[[float
,float
],float
] |Callable
[[float
,float
,float
],float
]
- class immunowave.spatial.ScalarField(shape, lb, h, values=0.0, fn=None)[source]
Bases:
Module
A scalar field \(f:\mathbb{R}^d\to\mathbb{R}\) on a \(d\)-dimensional spatial domain \(\mathcal{D}\subset\mathbb{R}^d\) discretized into a regular grid with spacing \(h\).
- Parameters:
lb (Float[list, 'ndim']) – Lower bounds of domain. Must be consistent via broadcasting with the dimension implied by
shape
.h (float) – grid spacing.
values (Float[Array, '#l #m n']) – Values of the discretized function at each grid point. Must be broadcastable to
shape
.fn (Callable[[float], float] | Callable[[float, float], float] | Callable[[float, float, float], float] | None) – Function \(f:\mathbb{R}^d\to\mathbb{R}\) to discretize (overrides
values
). Callable must acceptScalarField.ndim
float
arguments and return a scalarfloat
. It must also be vectorizable withjax.vmap()
.
- values: Float[Array, '#l #m n']
Values of the discretized function at each grid point.
- property domain: tuple[Float[Array, '...'], ...]
Discretized spatial domain \(\mathcal{D}\subset\mathbb{R}^d\).
- check_aligned(other)[source]
Check if another field is spatially aligned with this one (i.e., it has the same domain parameters).
- Parameters:
other (Self) – Other field.
- Raises:
eqx.EquinoxTracetimeError – If
other
is not aligned.- Return type:
None