farfield#
Defines functions related to farfield patterns in the FMM scheme.
These functions are intended for calculations that involve Brillouin zone integration, and batched in-plane wavevectors as generated by basis.brillouin_zone_in_plane_wavevector.
Copyright (c) Meta Platforms, Inc. and affiliates.
- fmmax.farfield.farfield_profile(flux: Array, wavelength: Array, in_plane_wavevector: Array, primitive_lattice_vectors: LatticeVectors, expansion: Expansion, brillouin_grid_axes: Tuple[int, int]) Tuple[Array, Array, Array, Array] [source]#
Computes a farfield profile.
This function effectively “unstacks” the values for each Fourier order and for each point in the Brillouin zone sampling scheme.
- Parameters:
flux – The flux array, with shape (…, num_bz_kx, num_bz_ky, … 2 * num_terms, num_sources).
wavelength – The wavelength, batch-compatible with flux.
in_plane_wavevector – The in-plane wavevector for the zeroth Fourier order, batch-compatible with flux.
primitive_lattice_vectors – The primitive lattice vectors of the unit cell.
expansion – The expansion used for the fields.
brillouin_grid_axes – Specifies the two axes of flux corresponding to the Brillouin zone grid.
- Returns:
The polar and azimuthal angles, solid angle associated with each value, and the farfield power.
- fmmax.farfield.integrated_flux(flux: Array, wavelength: Array, in_plane_wavevector: Array, primitive_lattice_vectors: LatticeVectors, expansion: Expansion, brillouin_grid_axes: Tuple[int, int], angle_bounds_fn: Callable[[Array, Array], Array], upsample_factor: int) Array [source]#
Computes the flux within the bounds defined by angle_bounds_fn.
- Parameters:
flux – The flux array, with shape (…, num_bz_kx, num_bz_ky, … 2 * num_terms, num_sources).
wavelength – The wavelength, batch-compatible with flux.
in_plane_wavevector – The in-plane wavevector for the zeroth Fourier order, batch-compatible with flux.
primitive_lattice_vectors – The primitive lattice vectors of the unit cell.
expansion – The expansion used for the fields.
brillouin_grid_axes – Specifies the two axes of flux corresponding to the Brillouin zone grid.
angle_bounds_fn – A function with signature fn(polar_angle, azimuthal_angle) returning a mask that is True for angles that should be included in the integral.
upsample_factor – Integer factor specifying upsampling performed in the integral, which is used to approximate trapezoidal rule integration.
- Returns:
The integrated flux, with shape equal to the batch dimensions of flux, excluding those for the brillouin zone grid.
- fmmax.farfield.unflatten_flux(flux: Array, expansion: Expansion, brillouin_grid_axes: Tuple[int, int]) Array [source]#
Unflattens a flux for a given expansion and Brillouin integration scheme.
- Parameters:
flux – The flux array, with shape (…, num_bz_kx, num_bz_ky, … 2 * num_terms, num_sources).
expansion – The expansion used for the flux.
brillouin_grid_axes – The axes associated with the Brillouin zone grid.
- Returns:
The unflattened flux, with shape (…, num_kx, num_ky, 2, num_sources).