utils#
Defines several utility functions.
Copyright (c) Meta Platforms, Inc. and affiliates.
- fmmax.utils.absolute_axes(axes: Tuple[int, ...], ndim: int) Tuple[int, ...] [source]#
Returns the absolute axes for given relative axes and array dimensionality.
- fmmax.utils.angular_frequency_for_wavelength(wavelength: Array) Array [source]#
Returns the angular frequency for the specified wavelength.
- fmmax.utils.atleast_nd(x: Array, n: int) Array [source]#
Adds leading dimensions to x, ensuring that it is at least n-dimensional.
- fmmax.utils.batch_compatible_shapes(*shapes: Tuple[int, ...]) bool [source]#
Returns True if all the shapes are batch-compatible.
- fmmax.utils.interpolate_permittivity(permittivity_solid: Array, permittivity_void: Array, density: Array) Array [source]#
Interpolates the permittivity with a scheme that avoids zero crossings.
The interpolation uses the scheme introduced in [2019 Christiansen], which avoids zero crossings that can occur with metals or lossy materials having a negative real component of the permittivity. https://doi.org/10.1016/j.cma.2018.08.034
- Parameters:
permittivity_solid – The permittivity of solid regions.
permittivity_void – The permittivity of void regions.
density – The density, specifying which locations are solid and which are void.
- Returns:
The interpolated permittivity.