beamax.geometry
Domain and sensor geometry primitives used by forward and inverse solvers.
Key Objects
Domain: grid size, spacing, wave-speed model, CFL/time grid helpers, and mesh generation.Sensor: sensor masks/positions tied to a domain.
API Reference
beamax.geometry
Domain
Bases: Module
Axis-aligned rectangular domain with physical spacing and medium fields.
Attributes:
| Name | Type | Description |
|---|---|---|
N |
Tuple[int, ...]
|
Grid shape per axis. |
dx |
Tuple[float, ...]
|
Physical spacing per axis (same length as |
periodic |
Tuple[bool, ...]
|
Per-axis periodicity flags. |
cfl |
float
|
CFL number used to pick |
c |
Callable | float
|
Speed of sound |
density |
Callable | float | None
|
Density |
alpha_coeff |
Callable | float | None
|
Absorption prefactor |
lam |
float
|
Absorption coefficient for GB ODEs (default 0.0). |
alpha_power |
Callable | float | None
|
Absorption exponent |
Notes
- All callable fields are evaluated lazily on accessors (pure, JAX-friendly).
N,periodicare static; others can be traced.- Derived arrays (
grid,sound_speed_array,density_array,alpha_coeff_array,alpha_power_array) andndimare available as properties.
c_fn: FieldFn
property
Callable sound speed, wrapping scalars into a JAX-friendly function.
Returns:
| Type | Description |
|---|---|
Callable[[ndarray], ndarray]
|
If |
grid_size: Float[Array, ' d']
property
Physical size of the domain per axis.
Returns:
| Type | Description |
|---|---|
(ndarray, shape(d))
|
|
xmax: Float[Array, '']
property
Max extent (Euclidean norm of grid_size).
Returns:
| Type | Description |
|---|---|
float
|
|
k_max: Float[Array, '']
property
Max wavenumber given sampling.
Returns:
| Type | Description |
|---|---|
float
|
π * min(1/dx). |
ndim: int
property
Number of spatial dimensions.
Returns:
| Type | Description |
|---|---|
int
|
|
grid: Float[Array, '*N d']
property
Stacked spatial coordinates.
Returns:
| Type | Description |
|---|---|
(ndarray, shape(*N, d))
|
Meshgrid stacked along last axis. |
sound_speed_array: Float[Array, '*N']
property
Speed of sound evaluated on grid.
Returns:
| Type | Description |
|---|---|
(ndarray, shape(*N))
|
|
density_array: Optional[Float[Array, '*N']]
property
Density evaluated on grid.
Returns:
| Type | Description |
|---|---|
ndarray | None
|
|
alpha_coeff_array: Optional[Float[Array, '*N']]
property
Absorption prefactor evaluated on grid.
Returns:
| Type | Description |
|---|---|
ndarray | None
|
|
alpha_power_array: Optional[Float[Array, '*N']]
property
Absorption exponent evaluated on grid.
Returns:
| Type | Description |
|---|---|
ndarray | None
|
|
compute_max_speed() -> Float[Array, '']
Maximum sound speed on grid.
Returns:
| Type | Description |
|---|---|
ndarray
|
Scalar (0-D array) with |
compute_min_speed() -> Float[Array, '']
Minimum sound speed on grid.
Returns:
| Type | Description |
|---|---|
ndarray
|
Scalar (0-D array) with |
generate_meshgrid() -> Tuple[list[Float[Array, '*N']], list[Int[Array, '*N']]]
Spatial and Fourier meshgrids.
Returns:
| Type | Description |
|---|---|
(spatial_meshgrid, fourier_meshgrid)
|
Each a tuple of length |
compute_max_freq() -> Float[Array, '']
Max frequency allowed by grid / CFL proxy.
Returns:
| Type | Description |
|---|---|
ndarray
|
Scalar |
generate_time_domain() -> Float[Array, ' Nt']
CFL-based uniform time grid covering one diameter-crossing.
Returns:
| Type | Description |
|---|---|
(ndarray, shape(Nt))
|
With |
Sensor(domain: Domain, positions: Optional[Float[Array, 'Ns d']] = None, binary_mask: Optional[Num[Array, '*N']] = None)
Bases: Module
Sampling geometry for receivers or sources.
Construct with exactly one of positions or binary_mask. The other
representation is derived deterministically from whatever you provided and
is available via the :attr:positions / :attr:binary_mask properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
domain
|
Domain
|
The spatial domain the sensor lives on. |
required |
positions
|
(ndarray, shape(Ns, d))
|
Cartesian positions in physical units. |
None
|
binary_mask
|
(ndarray, shape(*(N)))
|
Mask with 1 at sensor voxels, 0 elsewhere. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither or both of |
Notes
positions are converted to the nearest integer grid index when the mask
is derived; sub-pixel positions are quantised to grid voxels.
Construct from positions or mask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
domain
|
Domain
|
Spatial domain the sensor belongs to. |
required |
positions
|
(ndarray, shape(Ns, d))
|
Physical sensor positions. |
None
|
binary_mask
|
(ndarray, shape(*(N)))
|
Binary sensor mask. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither or both of |
positions: Float[Array, 'Ns d']
property
Sensor positions (physical units).
Returns:
| Type | Description |
|---|---|
(ndarray, shape(Ns, d))
|
|
binary_mask: Num[Array, '*N']
property
Sensor mask aligned to domain.N.
Returns:
| Type | Description |
|---|---|
jnp.ndarray, shape (*N,), dtype=int
|
|