API documentation#

pyMieDiff - Mie + auto-diff

Mie theory for core-shell particles, implemted in pytorch.

API#

Particle class#

The pymiediff.Particle class describes core-shell particles and provides high-level access to the main functionalities:

Particle([r_layers, eps_layers, mat_layers, ...])

Spherical particle container used by high-level pymiediff workflows.

Multishell#

This contains the multishell Mie coefficients and observables like cross sections, angular scattering and near-fields

multishell

Vectorized Mie solvers for spherical particles.

Materials#

pymiediff contains pyTorch autodiff classes to interpolate tabulated material permittivities, compatible with the refractiveindex.info format.

materials

material optical properties

Special#

pymiediff contains pyTorch autodiff comptible spherical bessel functions and their derivatives.

special

Special functions used by pymiediff.

Helper#

pyMieDiff contains tools e.g. for truncation critera, interpolation, numerical gradients.

helper

Helper namespace for pymiediff.

Multilayer Mie Coefficients#

pymiediff.multishell.mie_coefficients now accepts optional multilayer inputs:

  • r_layers: layer outer radii, shape (L,) or (N_part, L)

  • eps_layers: layer permittivities, shape (L,), (N_part, L), (L, N_k0), or (N_part, L, N_k0)

  • backend="pena": Peña/Pal (Yang-recursive) multilayer evaluation

The legacy core-shell arguments (r_c, r_s, eps_c, eps_s) remain supported and map internally to the layer representation. The legacy module name pymiediff.coreshell is kept as a compatibility shim and re-exports pymiediff.multishell.

Current limitation:

  • for backend="pena", only external coefficients a_n and b_n are implemented in this phase; return_internal=True is not available yet.