yasfpy.functions.misc#

Functions#

jmult_max(num_part, lmax)

Calculate the maximum value of jmult.

multi2single_index(j_s, tau, l, m, lmax)

Converts the multi-index (j_s, tau, l, m) to a single index.

single_index2multi(idx, lmax)

Convert a single index to multi-indices (j_s, tau, l, m) for spherical harmonics.

transformation_coefficients(pilm, taulm, tau, l, m, pol)

Calculate the transformation coefficients for spherical harmonics.

mutual_lookup(lmax, positions_1, positions_2, ...[, ...])

Calculate mutual lookup tables for scattering calculations.

Module Contents#

yasfpy.functions.misc.jmult_max(num_part, lmax)#

Calculate the maximum value of jmult.

Parameters: num_part (int): The number of particles. lmax (int): The maximum value of l.

Returns:

The maximum value of jmult.

Return type:

(int)

yasfpy.functions.misc.multi2single_index(j_s, tau, l, m, lmax)#

Converts the multi-index (j_s, tau, l, m) to a single index.

Parameters:
  • j_s (int) – Particle index.

  • tau (int) – Polarization value (1 or 2).

  • l (int) – The value of l (between 0 and lmax).

  • m (int) – The value of m (between -l and l).

  • lmax (int) – Cutoff value for the field expansion.

Returns:

The single index corresponding to the multi-index (j_s, tau, l, m).

Return type:

(int)

yasfpy.functions.misc.single_index2multi(idx, lmax)#

Convert a single index to multi-indices (j_s, tau, l, m) for spherical harmonics.

Parameters:
  • idx (int) – The single index.

  • lmax (int) – Cutoff value for the field expansion.

Returns:

Particle index. tau (int): Polarization value (1 or 2). l (float): The value of l (between 0 and lmax). m (int): The value of m (between -l and l).

Return type:

j_s (int)

yasfpy.functions.misc.transformation_coefficients(pilm, taulm, tau, l, m, pol, dagger=False)#

Calculate the transformation coefficients for spherical harmonics.

Parameters:
  • pilm (ndarray) – Array of spherical harmonics.

  • taulm (ndarray) – Array of spherical harmonics.

  • tau (int) – Polarization state.

  • l (int) – Degree of the spherical harmonics.

  • m (int) – Order of the spherical harmonics.

  • pol (int) – Polarization state.

  • dagger (bool, optional) – Whether to apply the dagger operation. Defaults to False.

Returns:

The transformation coefficient.

Return type:

(float)

yasfpy.functions.misc.mutual_lookup(lmax, positions_1, positions_2, refractive_index, derivatives=False, parallel=False)#

Calculate mutual lookup tables for scattering calculations.

Parameters:
  • lmax (int) – The maximum degree of the spherical harmonics expansion.

  • positions_1 (np.ndarray) – The positions of the first set of particles.

  • positions_2 (np.ndarray) – The positions of the second set of particles.

  • refractive_index (np.ndarray) – The refractive indices of the particles.

  • derivatives (bool, optional) – Whether to calculate the derivatives of the lookup tables. Defaults to False.

  • parallel (bool, optional) – Whether to use parallel computation. Defaults to False.

Returns:

The spherical Bessel functions. spherical_hankel (np.ndarray): The spherical Hankel functions. e_j_dm_phi (np.ndarray): The exponential term in the scattering calculation. p_lm (np.ndarray): The normalized Legendre polynomials. e_r (np.ndarray): The unit vectors in the radial direction. e_theta (np.ndarray): The unit vectors in the polar direction. e_phi (np.ndarray): The unit vectors in the azimuthal direction. cosine_theta (np.ndarray): The cosine of the polar angle. sine_theta (np.ndarray): The sine of the polar angle. size_parameter (np.ndarray): The size parameter of the particles. spherical_hankel_derivative (np.ndarray): The derivative of the spherical Hankel functions.

Return type:

spherical_bessel (np.ndarray)