yasfpy.functions.misc ===================== .. py:module:: yasfpy.functions.misc Functions --------- .. autoapisummary:: yasfpy.functions.misc.jmult_max yasfpy.functions.misc.multi2single_index yasfpy.functions.misc.single_index2multi yasfpy.functions.misc.transformation_coefficients yasfpy.functions.misc.mutual_lookup Module Contents --------------- .. py:function:: 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. :rtype: (int) .. py:function:: multi2single_index(j_s, tau, l, m, lmax) Converts the multi-index (j_s, tau, l, m) to a single index. :param j_s: Particle index. :type j_s: int :param tau: Polarization value (1 or 2). :type tau: int :param l: The value of l (between 0 and lmax). :type l: int :param m: The value of m (between -l and l). :type m: int :param lmax: Cutoff value for the field expansion. :type lmax: int :returns: The single index corresponding to the multi-index (j_s, tau, l, m). :rtype: (int) .. py:function:: single_index2multi(idx, lmax) Convert a single index to multi-indices (j_s, tau, l, m) for spherical harmonics. :param idx: The single index. :type idx: int :param lmax: Cutoff value for the field expansion. :type lmax: int :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). :rtype: j_s (int) .. py:function:: transformation_coefficients(pilm, taulm, tau, l, m, pol, dagger = False) Calculate the transformation coefficients for spherical harmonics. :param pilm: Array of spherical harmonics. :type pilm: ndarray :param taulm: Array of spherical harmonics. :type taulm: ndarray :param tau: Polarization state. :type tau: int :param l: Degree of the spherical harmonics. :type l: int :param m: Order of the spherical harmonics. :type m: int :param pol: Polarization state. :type pol: int :param dagger: Whether to apply the dagger operation. Defaults to False. :type dagger: bool, optional :returns: The transformation coefficient. :rtype: (float) .. py:function:: mutual_lookup(lmax, positions_1, positions_2, refractive_index, derivatives = False, parallel = False) Calculate mutual lookup tables for scattering calculations. :param lmax: The maximum degree of the spherical harmonics expansion. :type lmax: int :param positions_1: The positions of the first set of particles. :type positions_1: np.ndarray :param positions_2: The positions of the second set of particles. :type positions_2: np.ndarray :param refractive_index: The refractive indices of the particles. :type refractive_index: np.ndarray :param derivatives: Whether to calculate the derivatives of the lookup tables. Defaults to False. :type derivatives: bool, optional :param parallel: Whether to use parallel computation. Defaults to False. :type parallel: bool, optional :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. :rtype: spherical_bessel (np.ndarray)