QPMS
Electromagnetic multiple scattering library and toolkit.
Data Structures | Functions | Variables
qpms.tmatrices Namespace Reference

Data Structures

class  TMatrix
 

Functions

def WignerD_mm (l, quat)
 
def WignerD_mm_fromvector (l, vect)
 
def WignerD_yy (lmax, quat)
 
def WignerD_yy_fromvector (lmax, vect)
 
def identity_yy (lmax)
 
def identity_tyty (lmax)
 
def xflip_yy (lmax)
 
def xflip_tyy (lmax)
 
def xflip_tyty (lmax)
 
def yflip_yy (lmax)
 
def yflip_tyy (lmax)
 
def yflip_tyty (lmax)
 
def zflip_yy (lmax)
 
def zflip_tyy (lmax)
 
def zflip_tyty (lmax)
 
def zrotN_yy (N, lMax)
 
def op_yy2tyty (yyop)
 
def zrotN_tyty (N, lMax)
 
def parity_yy (lmax)
 
def loadScuffTMatrices (fileName, normalisation=1, version='old', freqscale=None, order=None)
 
def apply_matrix_left (matrix, tensor, axis)
 
def apply_ndmatrix_left (matrix, tensor, axes)
 
def apply_ndmatrix_right (tensor, matrix, axes)
 
def ndmatrix_Hconj (matrix)
 
def symz_indexarrays (lMax, npart=1)
 
def get_TMatrix_fromspec (tmatrix_spec)
 
def perform_tmspecs (tmspecs)
 

Variables

bool use_moble_quaternion = False
 
 ň = np.newaxis
 
 reCN = re.compile('(\d*)C(\d+)')
 

Detailed Description

Mostly legacy code, but still kept for reference.
Might be removed in future versions.

Function Documentation

◆ apply_matrix_left()

def qpms.tmatrices.apply_matrix_left (   matrix,
  tensor,
  axis 
)
TODO doc
Apply square matrix to a given axis of a tensor, so that the result retains the shape
of the original tensor. The summation goes over the second index of the matrix and the
given tensor axis.

◆ apply_ndmatrix_left()

def qpms.tmatrices.apply_ndmatrix_left (   matrix,
  tensor,
  axes 
)
Generalized apply_matrix_left, the matrix can have more (2N) abstract dimensions,
like M[i,j,k,...z,i,j,k,...,z]. N axes have to be specified in a tuple, corresponding
to the axes 0,1,...N-1 of the matrix

◆ apply_ndmatrix_right()

def qpms.tmatrices.apply_ndmatrix_right (   tensor,
  matrix,
  axes 
)
Right-side analogue of apply_ndmatrix_lift.
Multiplies a tensor with a 2N-dimensional matrix, conserving the axis order.

◆ get_TMatrix_fromspec()

def qpms.tmatrices.get_TMatrix_fromspec (   tmatrix_spec)
 TODO doc 
returns (TMatrices, freqs, lMax)

◆ identity_tyty()

def qpms.tmatrices.identity_tyty (   lmax)
TODO doc

◆ identity_yy()

def qpms.tmatrices.identity_yy (   lmax)
TODO doc

◆ loadScuffTMatrices()

def qpms.tmatrices.loadScuffTMatrices (   fileName,
  normalisation = 1,
  version = 'old',
  freqscale = None,
  order = None 
)
TODO doc

version describes version of scuff-em. It is either 'old' or 'new'. 
default order is ('N','M') with 'old' version, ('M','N') with 'new'

◆ ndmatrix_Hconj()

def qpms.tmatrices.ndmatrix_Hconj (   matrix)
For 2N-dimensional matrix, swap the first N and last N matrix, and complex conjugate.

◆ op_yy2tyty()

def qpms.tmatrices.op_yy2tyty (   yyop)
Broadcasts an yy operator to tyty operator without considering mirroring effects.
Good (maybe only) for rotations.

◆ parity_yy()

def qpms.tmatrices.parity_yy (   lmax)
Parity operator (flip in x,y,z)
parity = (-1)**l

◆ perform_tmspecs()

def qpms.tmatrices.perform_tmspecs (   tmspecs)
Takes a sequence of TMatrixSpec or TMatrix instances and returns
a list of corresponding TMatrix instances

◆ symz_indexarrays()

def qpms.tmatrices.symz_indexarrays (   lMax,
  npart = 1 
)
Returns indices that are used for separating the in-plane E ('TE' in the photonic crystal
jargon) and perpendicular E ('TM' in the photonic crystal jargon) modes
in the z-mirror symmetric systems.

Parameters
----------
lMax : int
    The maximum degree cutoff for the T-matrix to which these indices will be applied.

npart : int
    Number of particles (TODO better description)

Returns
-------
TEč, TMč : (npart * 2 * nelem)-shaped bool ndarray
    Mask arrays corresponding to the 'TE' and 'TM' modes, respectively.

◆ WignerD_mm()

def qpms.tmatrices.WignerD_mm (   l,
  quat 
)
Calculates Wigner D matrix (as an numpy (2*l+1,2*l+1)-shaped array) 
for order l, and a rotation given by quaternion quat.

This represents the rotation of spherical vector basis
TODO doc

◆ WignerD_mm_fromvector()

def qpms.tmatrices.WignerD_mm_fromvector (   l,
  vect 
)
TODO doc

◆ WignerD_yy()

def qpms.tmatrices.WignerD_yy (   lmax,
  quat 
)
TODO doc

◆ WignerD_yy_fromvector()

def qpms.tmatrices.WignerD_yy_fromvector (   lmax,
  vect 
)
TODO doc

◆ xflip_yy()

def qpms.tmatrices.xflip_yy (   lmax)
TODO doc
xflip = δ(m + m') δ(l - l')  
(i.e. ones on the (m' m) antidiagonal

◆ yflip_yy()

def qpms.tmatrices.yflip_yy (   lmax)
TODO doc
yflip = rot(z,pi/2) * xflip * rot(z,-pi/2)
      = δ(m + m') δ(l - l') * (-1)**m

◆ zflip_yy()

def qpms.tmatrices.zflip_yy (   lmax)
TODO doc
zflip = (-1)^(l+m)