yasfpy.lookups#

Lookup-table generation for simulations.

This module contains functionality extracted from yasfpy.simulation.Simulation so that simulation.py can stay focused on orchestration.

The lookup tables produced here are used by coupling backends to avoid repeated special-function evaluation and to precompute geometric terms (relative positions, azimuthal phases, and associated Legendre polynomials) for the vector-spherical-wave-function (VSWF) translation operators.

The legacy_* helpers are preserved as-is; they originate from the Matlab CELES framework [Egel et al., 2017] and are not used by YASF in typical runs.

Functions#

legacy_compute_lookup_particle_distances(sim)

Compute distance sampling points for a legacy Hankel lookup table.

legacy_compute_h3_table(sim)

Compute a legacy spherical Hankel lookup table.

compute_idx_lookup(sim)

Create the (particle, n, tau, l, m) index lookup table.

compute_lookups(sim)

Compute pairwise lookup tables used by coupling backends.

Module Contents#

yasfpy.lookups.legacy_compute_lookup_particle_distances(sim)#

Compute distance sampling points for a legacy Hankel lookup table.

Parameters:

sim – Simulation-like object that will receive a lookup_particle_distances attribute.

Notes

This helper exists for parity with legacy CELES-style input generation and YAML/Matlab compatibility [Egel et al., 2017].

The resulting distances include an extra leading 0 to keep the original interpolation scheme stable near the origin.

yasfpy.lookups.legacy_compute_h3_table(sim)#

Compute a legacy spherical Hankel lookup table.

Parameters:

sim – Simulation-like object with lookup_particle_distances and wavelength-dependent medium wavenumbers parameters.k_medium.

Notes

Populates sim.h3_table with values of

\[h_l^{(1)}(k r) = j_l(k r) + i y_l(k r),\]

for l = 0 .. 2*lmax and the configured sampling radii.

This is kept only for compatibility with legacy CELES-derived workflows [Egel et al., 2017].

yasfpy.lookups.compute_idx_lookup(sim)#

Create the (particle, n, tau, l, m) index lookup table.

Parameters:

sim – Simulation-like object that provides numerics.lmax and parameters.particles.number and will receive an idx_lookup attribute.

Notes

The idx_lookup table maps the flattened unknown index j to a tuple (s, n, tau, l, m) (particle index, VSWF mode index, polarization, degree, order). It is used by dense coupling backends to turn the matvec

\[(W x)_j = \sum_k W_{j k} x_k\]

into structured loops over VSWF indices.

yasfpy.lookups.compute_lookups(sim)#

Compute pairwise lookup tables used by coupling backends.

Parameters:

sim – Simulation-like object providing numerics.lmax, particle positions, and medium wavenumbers (parameters.k_medium). The function writes the lookup arrays onto sim.

Notes

This function calls yasfpy.functions.misc.mutual_lookup() to compute a set of geometric and special-function tables for all particle pairs.

The produced attributes:

  • sim.sph_j: spherical Bessel functions j_l(k r).

  • sim.sph_h: spherical Hankel functions h_l^{(1)}(k r).

  • sim.e_j_dm_phi: azimuthal phase factors exp(i (m-m') phi).

  • sim.plm: normalized associated Legendre terms.

These terms are building blocks for VSWF translation operators and are used by the dense coupling implementations (CPU/Numba and CUDA) to assemble or apply inter-particle interaction blocks.

References

The overall CELES-style formulation using VSWFs and pairwise translation is described in [Egel et al., 2017].