yasfpy.simulation#

Simulation orchestration.

This module defines Simulation, which orchestrates the major steps of a YASF run: lookup-table generation, Mie/incident-field coefficient computation, linear-system solve for scattering coefficients, and optional field evaluation.

Classes#

Simulation

Run container for the core YASF simulation pipeline.

Module Contents#

class yasfpy.simulation.Simulation(parameters, numerics)#

Run container for the core YASF simulation pipeline.

Parameters:
  • parameters – Physical and material parameters for the run.

  • numerics – Numerical configuration (truncation, sampling, coupling backend, etc.).

Notes

The simulation object owns lookup tables and intermediate arrays that are produced during preprocessing and solver stages.

initial_field_coefficients: numpy.ndarray#
mie_coefficients: numpy.ndarray#
scatter_to_internal: numpy.ndarray#
scattered_field_coefficients: numpy.ndarray#
scattered_field_err_codes: numpy.ndarray#
sampling_points: numpy.ndarray#
initial_field_electric: numpy.ndarray | None#
initial_field_magnetic: numpy.ndarray | None#
scattered_field: numpy.ndarray#
total_field_electric: numpy.ndarray#
lookup_particle_distances: numpy.ndarray#
h3_table: numpy.ndarray#
idx_lookup: numpy.ndarray#
sph_j: numpy.ndarray | None#
sph_h: numpy.ndarray | None#
e_j_dm_phi: numpy.ndarray | None#
plm: numpy.ndarray | None#

This class represents the simulation of YASF (Yet Another Scattering Framework). It contains methods for initializing the simulation, computing lookup tables, and calculating mie coefficients.

parameters#
numerics#
log#
legacy_compute_lookup_particle_distances()#

Compute particle distance lookup for legacy tables.

Delegates to yasfpy.lookups.legacy_compute_lookup_particle_distances.

legacy_compute_h3_table()#

Compute the legacy spherical Hankel lookup table.

Delegates to yasfpy.lookups.legacy_compute_h3_table.

compute_mie_coefficients()#

Compute Mie coefficients, stored on the simulation.

Delegates to yasfpy.mie_coefficients.compute_mie_coefficients.

compute_initial_field_coefficients()#

Computes initial field coefficients $a_{tau ,l,m}$ and $b_{tau ,l,m}$.

Delegates to yasfpy.initial_field_coefficients.compute_initial_field_coefficients.

compute_right_hand_side()#

Computes the right hand side $T \cdot a_I$ of the equation $M \cdot b = T \cdot a_I$.

Variables:

right_hand_side (np.ndarray) – Right hand side of the equation $M \cdot b = T \cdot a_I$

Notes

For more information regarding the equation, please refer to the paper by Celes (https://arxiv.org/abs/1706.02145).

coupling_matrix_multiply(x, idx=None)#

Compute Wx = coupling_matrix @ x.

Delegates to yasfpy.matrix_apply.coupling_matrix_multiply.

master_matrix_multiply(value, idx)#

Apply master operator.

Delegates to yasfpy.matrix_apply.master_matrix_multiply.

compute_scattered_field_coefficients(guess=None)#

Compute scattered field coefficients.

Delegates to yasfpy.scattered_field_coefficients.compute_scattered_field_coefficients.

compute_fields(sampling_points)#

Compute fields at the given sampling points.

This method delegates to yasfpy.fields.compute_fields.