Analytical calculations

Analytic calculations relating to diffraction (i.e. not using S4).

rayflare.analytic.diffraction.get_order_directions(wl, size, m_max, incidence, transmission, theta, phi, phi_sym=1.5707963267948966)

Returns analytically-calculated order directions for given incidence and transmission media, incidence angles (polar and azimuthal)

Parameters:
  • wl – wavelength in nm (array)

  • size – tuple of lattice vectors

  • m_max – maximum index of the diffraction orders, results are returned for all combinations up to this value

  • incidence – incidence medium. Can be a Solcore material, constant, or an array/list matching the length of the wavelength array

  • transmission – transmission medium. Can be a Solcore material, constant, or an array/list matching the length of the wavelength array

  • theta – polar incidence angle in radians

  • phi – azimuthal incidence angle in radians

  • phi_sym – phi values for which the grating is unique

Returns:

dictionary containing the diffraction orders (order_index), and the corresponding azimuthal angle (phi), polar angle in reflection (theta_r) and transmission (theta_t), real space in-plane magnitudes (fr_x and fr_y) and reciprocal space in-plane magnitude (kxy)

rayflare.analytic.diffraction.group_diffraction_orders(size, basis_set, per_order=None)

Groups power from equivalent diffraction orders based on the symmetry of the unit cell, and returns the total power in a set of unique order directions.

Parameters:
  • size – tuple with the vectors describing the unit cell: ((x1, y1), (x2, y2))

  • basis_set – list of the diffraction order (m1 and m2) combinations (list of length 2 lists in the format [m1, m2], where m1 and m2 are integers)

  • per_order – optional - if you want to group power across orders in equivalent directions, e.g based on the output of an RCWA calculation giving power per order. Numpy array with dimensions [wavelengths, order] where the second dimension should be in order of the [m1, m2] combinations given in basis_seet

Returns:

a dictionary with entries: ‘k_xy’, which gives the unique components of the k-vector parallel to the interface; ‘reps’, which gives the degeneracy of these directions (how many of the input m1/m2 combinations correspond to this direction), ‘per_order’, which gives the power per unique k_xy (if powers were provided) and ‘degeneracy’, which lists how many different values of power were collapsed into each set of per_order data.

Return type: