yasfpy.lookups ============== .. py:module:: yasfpy.lookups .. autoapi-nested-parse:: 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 :cite:`Egel-2017-ID1` and are not used by YASF in typical runs. Functions --------- .. autoapisummary:: yasfpy.lookups.legacy_compute_lookup_particle_distances yasfpy.lookups.legacy_compute_h3_table yasfpy.lookups.compute_idx_lookup yasfpy.lookups.compute_lookups Module Contents --------------- .. py:function:: legacy_compute_lookup_particle_distances(sim) Compute distance sampling points for a legacy Hankel lookup table. :param sim: Simulation-like object that will receive a ``lookup_particle_distances`` attribute. .. rubric:: Notes This helper exists for parity with legacy CELES-style input generation and YAML/Matlab compatibility :cite:`Egel-2017-ID1`. The resulting distances include an extra leading ``0`` to keep the original interpolation scheme stable near the origin. .. py:function:: legacy_compute_h3_table(sim) Compute a legacy spherical Hankel lookup table. :param sim: Simulation-like object with ``lookup_particle_distances`` and wavelength-dependent medium wavenumbers ``parameters.k_medium``. .. rubric:: Notes Populates ``sim.h3_table`` with values of .. math:: 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 :cite:`Egel-2017-ID1`. .. py:function:: compute_idx_lookup(sim) Create the (particle, n, tau, l, m) index lookup table. :param sim: Simulation-like object that provides ``numerics.lmax`` and ``parameters.particles.number`` and will receive an ``idx_lookup`` attribute. .. rubric:: 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 .. math:: (W x)_j = \sum_k W_{j k} x_k into structured loops over VSWF indices. .. py:function:: compute_lookups(sim) Compute pairwise lookup tables used by coupling backends. :param sim: Simulation-like object providing ``numerics.lmax``, particle positions, and medium wavenumbers (``parameters.k_medium``). The function writes the lookup arrays onto ``sim``. .. rubric:: Notes This function calls :func:`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. .. rubric:: References The overall CELES-style formulation using VSWFs and pairwise translation is described in :cite:`Egel-2017-ID1`.