TMatrices (M,N) order option

Former-commit-id: 4daecc846b571ee64bc2f48923a1659d23b05286
This commit is contained in:
Marek Nečada 2019-02-14 00:07:53 +02:00
parent bca248e6d5
commit 2cd30acd50
1 changed files with 10 additions and 4 deletions

View File

@ -165,11 +165,12 @@ def _scuffTMatrixConvert_EM_01(EM):
else: else:
return None return None
def loadScuffTMatrices(fileName, normalisation = 1, version = 'old', freqscale = None): def loadScuffTMatrices(fileName, normalisation = 1, version = 'old', freqscale = None, order = None):
""" """
TODO doc TODO doc
version describes version of scuff-em. It is either 'old' or 'new' version describes version of scuff-em. It is either 'old' or 'new'.
default order is ('N','M') with 'old' version, ('M','N') with 'new'
""" """
oldversion = (version == 'old') oldversion = (version == 'old')
μm = 1e-6 μm = 1e-6
@ -203,10 +204,15 @@ def loadScuffTMatrices(fileName, normalisation = 1, version = 'old', freqscale =
# Second, M-waves come first, so they have now 0-valued index, and E-waves have 1-valued index, # Second, M-waves come first, so they have now 0-valued index, and E-waves have 1-valued index,
# which we want to be inverted. # which we want to be inverted.
TMatrices = np.zeros((len(freqs),2,nelem,2,nelem),dtype=complex) TMatrices = np.zeros((len(freqs),2,nelem,2,nelem),dtype=complex)
for inc_type in [0,1]: reorder = (0,1)
for outc_type in [0,1]: if ((order == ('N', 'M')) and not oldversion): # reverse order for the new version
reorder = (1,0)
# TODO reverse order for the old version...
for inc_type in reorder:
for outc_type in reorder:
TMatrices[:,outc_type,:,inc_type,:] = TMatrices_tmp_real[:,:,outc_type,:,inc_type]+1j*TMatrices_tmp_imag[:,:,outc_type,:,inc_type] TMatrices[:,outc_type,:,inc_type,:] = TMatrices_tmp_real[:,:,outc_type,:,inc_type]+1j*TMatrices_tmp_imag[:,:,outc_type,:,inc_type]
# IMPORTANT: now we are going from Reid's/Kristensson's/Jackson's/whoseever convention to Taylor's convention # IMPORTANT: now we are going from Reid's/Kristensson's/Jackson's/whoseever convention to Taylor's convention
# TODO make these consistent with what is defined in qpms_types.h (implement all possibilities)
if normalisation == 1: if normalisation == 1:
TMatrices[:,:,:,:,:] = TMatrices[:,:,:,:,:] * np.sqrt(ny*(ny+1))[ň,ň,ň,ň,:] / np.sqrt(ny*(ny+1))[ň,ň,:,ň,ň] TMatrices[:,:,:,:,:] = TMatrices[:,:,:,:,:] * np.sqrt(ny*(ny+1))[ň,ň,ň,ň,:] / np.sqrt(ny*(ny+1))[ň,ň,:,ň,ň]
elif normalisation == 2: # Kristensson? elif normalisation == 2: # Kristensson?