From 232fd3146e78f2e55356da2ea89752b4e2c999bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Tue, 12 Jul 2016 03:40:57 +0300 Subject: [PATCH] Function for reading scuff-matrix output files Former-commit-id: 08c8f4bfc3786d6cd6e011bbce324ab661971736 --- qpms/qpms_p.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/qpms/qpms_p.py b/qpms/qpms_p.py index 4d907e9..df71f49 100644 --- a/qpms/qpms_p.py +++ b/qpms/qpms_p.py @@ -838,3 +838,52 @@ def yflip_yy(lmax): return elems # BTW parity (xyz-flip) is simply (-1)**ny + + + +#----------------------------------------------------# +# Loading T-matrices from scuff-tmatrix output files # +#----------------------------------------------------# + +# We don't really need this particular function anymore, but... +def _scuffTMatrixConvert_EM_01(EM): + #print(EM) + if (EM == b'E'): + return 0 + elif (EM == b'M'): + return 1 + else: + return None + +def loadScuffTMatrices(fileName): + """ + TODO doc + """ + μm = 1e-6 + table = np.genfromtxt(fileName, + converters={1: _scuffTMatrixConvert_EM_01, 4: _scuffTMatrixConvert_EM_01}, + dtype=[('freq', '