pyemaps 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyemaps/COPYING +798 -0
- pyemaps/CifFile/CifFile_module.py +3117 -0
- pyemaps/CifFile/StarFile.py +2496 -0
- pyemaps/CifFile/TypeContentsParser.py +82 -0
- pyemaps/CifFile/YappsStarParser_1_0.py +289 -0
- pyemaps/CifFile/YappsStarParser_1_1.py +288 -0
- pyemaps/CifFile/YappsStarParser_2_0.py +369 -0
- pyemaps/CifFile/YappsStarParser_STAR2.py +382 -0
- pyemaps/CifFile/__init__.py +7 -0
- pyemaps/CifFile/drel/__init__.py +1 -0
- pyemaps/CifFile/drel/drel_ast_yacc.py +582 -0
- pyemaps/CifFile/drel/drel_lex.py +228 -0
- pyemaps/CifFile/drel/drel_runtime.py +126 -0
- pyemaps/CifFile/drel/parsetab.py +185 -0
- pyemaps/CifFile/drel/py_from_ast.py +628 -0
- pyemaps/CifFile/parsetab.py +185 -0
- pyemaps/CifFile/yapps3_compiled_rt.py +390 -0
- pyemaps/README.md +201 -0
- pyemaps/__config__.py +91 -0
- pyemaps/__init__.py +233 -0
- pyemaps/__main__.py +219 -0
- pyemaps/__version__.py +1 -0
- pyemaps/cdata/Aluminium.xtl +4 -0
- pyemaps/cdata/AluminiumOxide.xtl +5 -0
- pyemaps/cdata/Aluminium_FCC.xtl +4 -0
- pyemaps/cdata/BariumTitanate_180k.xtl +6 -0
- pyemaps/cdata/BariumTitanate_270k.xtl +7 -0
- pyemaps/cdata/BariumTitanate_Tetra.xtl +7 -0
- pyemaps/cdata/BiMnO3.xtl +27 -0
- pyemaps/cdata/Boron_Tetra.xtl +8 -0
- pyemaps/cdata/CadmiumSelenide_Hex.xtl +5 -0
- pyemaps/cdata/CadmiumSulfide_Cubic.xtl +5 -0
- pyemaps/cdata/CadmiumSulfide_Hex.xtl +5 -0
- pyemaps/cdata/Chromium_BCC.xtl +4 -0
- pyemaps/cdata/CoSb3_Skutterudite.xtl +5 -0
- pyemaps/cdata/CopperOxide.xtl +5 -0
- pyemaps/cdata/Copper_FCC.xtl +4 -0
- pyemaps/cdata/Cu2O_Cuprite.xtl +5 -0
- pyemaps/cdata/Diamond.xtl +4 -0
- pyemaps/cdata/ErbiumPyrogermanate.xtl +9 -0
- pyemaps/cdata/FePd_Tetra.xtl +5 -0
- pyemaps/cdata/FeS2_Pyrite.xtl +15 -0
- pyemaps/cdata/GalliumAntimonide.xtl +5 -0
- pyemaps/cdata/GalliumArsenide.xtl +5 -0
- pyemaps/cdata/GalliumNitride.xtl +5 -0
- pyemaps/cdata/Germanium.xtl +4 -0
- pyemaps/cdata/Gold_FCC.xtl +4 -0
- pyemaps/cdata/IndiumArsenide.xtl +5 -0
- pyemaps/cdata/LaMnO3.xtl +7 -0
- pyemaps/cdata/LeadZirconateTitanate.xtl +8 -0
- pyemaps/cdata/Li2MnO3.xtl +13 -0
- pyemaps/cdata/NaFeO2.xtl +6 -0
- pyemaps/cdata/Nb3Sn.xtl +5 -0
- pyemaps/cdata/Pentacene.xtl +39 -0
- pyemaps/cdata/Silicon.xtl +4 -0
- pyemaps/cdata/StrontiumTitanate.xtl +6 -0
- pyemaps/cdata/TelluriumDioxide.xtl +5 -0
- pyemaps/cdata/TinDioxide_RT.xtl +5 -0
- pyemaps/cdata/TitaniumDioxide_Anatase.xtl +5 -0
- pyemaps/cdata/TitaniumDioxide_Rutile.xtl +5 -0
- pyemaps/cdata/TungstenDiselenide.xtl +5 -0
- pyemaps/cdata/VanadiumDioxide_RT.xtl +6 -0
- pyemaps/cdata/ZincOxide.xtl +5 -0
- pyemaps/cdata/Zinc_HCP.xtl +4 -0
- pyemaps/cdata/ZirconiumNitride.xtl +5 -0
- pyemaps/cdata/limno2.xtl +6 -0
- pyemaps/crystals.py +1415 -0
- pyemaps/ddiffs.py +147 -0
- pyemaps/diffract/__init__.py +70 -0
- pyemaps/diffract/bloch_dec.py +779 -0
- pyemaps/diffract/csf_dec.py +242 -0
- pyemaps/diffract/dif_dec.py +519 -0
- pyemaps/diffract/dpgen_dec.py +175 -0
- pyemaps/diffract/mxtal_dec.py +201 -0
- pyemaps/diffract/powder_dec.py +137 -0
- pyemaps/diffract/stereo_dec.py +111 -0
- pyemaps/display.py +791 -0
- pyemaps/emcontrols.py +1017 -0
- pyemaps/errors.py +266 -0
- pyemaps/fileutils.py +1001 -0
- pyemaps/kdiffs.py +1221 -0
- pyemaps/license.txt +42 -0
- pyemaps/samples/adf.py +137 -0
- pyemaps/samples/al.img +0 -0
- pyemaps/samples/al_dpgen.py +57 -0
- pyemaps/samples/al_ediom.py +94 -0
- pyemaps/samples/convert_image.py +88 -0
- pyemaps/samples/dm_diff.py +225 -0
- pyemaps/samples/mask.im3 +0 -0
- pyemaps/samples/powder.py +51 -0
- pyemaps/samples/raw.img +0 -0
- pyemaps/samples/si_bloch.py +120 -0
- pyemaps/samples/si_constructor.py +51 -0
- pyemaps/samples/si_csf.py +59 -0
- pyemaps/samples/si_dif.py +134 -0
- pyemaps/samples/si_lacbed.py +59 -0
- pyemaps/samples/si_pyemaps.py +80 -0
- pyemaps/samples/si_scm.py +156 -0
- pyemaps/samples/si_stereo.py +116 -0
- pyemaps/scattering/__init__.py +26 -0
- pyemaps/scattering/sct_dec.py +31 -0
- pyemaps/spg/__init__.py +25 -0
- pyemaps/spg/spg_dec.py +60 -0
- pyemaps/stackimg.py +1031 -0
- pyemaps/xtal.py +222 -0
- pyemaps-2.0.0.dist-info/METADATA +231 -0
- pyemaps-2.0.0.dist-info/RECORD +112 -0
- pyemaps-2.0.0.dist-info/WHEEL +5 -0
- pyemaps-2.0.0.dist-info/entry_points.txt +2 -0
- pyemaps-2.0.0.dist-info/licenses/COPYING +798 -0
- pyemaps-2.0.0.dist-info/licenses/license.txt +42 -0
- pyemaps-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#Attempt to implement dREL using PLY (Python Lex Yacc)
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
import ply.lex as lex
|
|
4
|
+
import re #for multiline flag
|
|
5
|
+
|
|
6
|
+
states = (
|
|
7
|
+
('paren','inclusive'),
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
tokens = (
|
|
11
|
+
'SHORTSTRING',
|
|
12
|
+
'LONGSTRING',
|
|
13
|
+
'INTEGER',
|
|
14
|
+
'BININT',
|
|
15
|
+
'HEXINT',
|
|
16
|
+
'OCTINT',
|
|
17
|
+
'REAL',
|
|
18
|
+
'POWER',
|
|
19
|
+
'ISEQUAL',
|
|
20
|
+
'NEQ',
|
|
21
|
+
'GTE',
|
|
22
|
+
'LTE',
|
|
23
|
+
'IMAGINARY',
|
|
24
|
+
'ID', #variable name
|
|
25
|
+
'ITEM_TAG', #cif item as variable
|
|
26
|
+
'COMMENT',
|
|
27
|
+
'STRPREFIX',
|
|
28
|
+
'ELLIPSIS',
|
|
29
|
+
'AND',
|
|
30
|
+
'BADAND',
|
|
31
|
+
'OR',
|
|
32
|
+
'BADOR',
|
|
33
|
+
'IN',
|
|
34
|
+
'NOT',
|
|
35
|
+
'DO',
|
|
36
|
+
'FOR',
|
|
37
|
+
'LOOP',
|
|
38
|
+
'REPEAT',
|
|
39
|
+
'AS',
|
|
40
|
+
'WITH',
|
|
41
|
+
'WHERE',
|
|
42
|
+
'ELSEIF',
|
|
43
|
+
'ELSE',
|
|
44
|
+
'BREAK',
|
|
45
|
+
'NEXT',
|
|
46
|
+
'IF',
|
|
47
|
+
'SWITCH',
|
|
48
|
+
'CASE',
|
|
49
|
+
'DEFAULT',
|
|
50
|
+
'AUGOP',
|
|
51
|
+
'PRINT',
|
|
52
|
+
'FUNCTION',
|
|
53
|
+
'NEWLINE',
|
|
54
|
+
'ESCAPE_NEWLINE',
|
|
55
|
+
'OPEN_PAREN',
|
|
56
|
+
'CLOSE_PAREN'
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
literals = '+*-/;[],:^<>{}=.`&|' #'&' and '|' are pycifrw extensions
|
|
60
|
+
t_INITIAL_ignore = ' \t'
|
|
61
|
+
t_paren_ignore = ' \t\n'
|
|
62
|
+
|
|
63
|
+
def t_error(t):
|
|
64
|
+
print('Illegal character %s' % repr(t.value[0]))
|
|
65
|
+
|
|
66
|
+
t_POWER = r'\*\*'
|
|
67
|
+
t_ISEQUAL = r'=='
|
|
68
|
+
t_NEQ = r'!='
|
|
69
|
+
t_GTE = r'>='
|
|
70
|
+
t_LTE = r'<='
|
|
71
|
+
t_ELLIPSIS = r'\.\.\.'
|
|
72
|
+
t_BADOR = r'\|\|'
|
|
73
|
+
t_BADAND = r'&&'
|
|
74
|
+
|
|
75
|
+
def t_AUGOP(t):
|
|
76
|
+
r'(\+\+=)|(\+=)|(-=)|(--=)|(\*=)|(/=)'
|
|
77
|
+
return t
|
|
78
|
+
|
|
79
|
+
# We do not have this as a literal so that we can switch to ignoring newlines
|
|
80
|
+
def t_INITIAL_OPEN_PAREN(t):
|
|
81
|
+
r'\('
|
|
82
|
+
t.lexer.paren_level = 1
|
|
83
|
+
t.lexer.begin('paren')
|
|
84
|
+
return t
|
|
85
|
+
|
|
86
|
+
def t_paren_OPEN_PAREN(t):
|
|
87
|
+
r'\('
|
|
88
|
+
t.lexer.paren_level +=1
|
|
89
|
+
return t
|
|
90
|
+
|
|
91
|
+
def t_paren_CLOSE_PAREN(t):
|
|
92
|
+
r'\)'
|
|
93
|
+
t.lexer.paren_level -=1
|
|
94
|
+
if t.lexer.paren_level == 0:
|
|
95
|
+
t.lexer.begin('INITIAL')
|
|
96
|
+
return t
|
|
97
|
+
|
|
98
|
+
# Do the reals before the integers, otherwise the integer will
|
|
99
|
+
# match the first part of the real
|
|
100
|
+
#
|
|
101
|
+
def t_IMAGINARY(t):
|
|
102
|
+
r'(((([0-9]+[.][0-9]*)|([.][0-9]+))([Ee][+-]?[0-9]+)?)|([0-9]+))[jJ]'
|
|
103
|
+
return t
|
|
104
|
+
|
|
105
|
+
def t_REAL(t):
|
|
106
|
+
r'(([0-9]+[.][0-9]*)|([.][0-9]+))([Ee][+-]?[0-9]+)?'
|
|
107
|
+
try:
|
|
108
|
+
value = float(t.value)
|
|
109
|
+
except ValueError:
|
|
110
|
+
print('Error converting %s to real' % t.value)
|
|
111
|
+
return t
|
|
112
|
+
|
|
113
|
+
# Do the binary,octal etc before decimal integer otherwise the 0 at
|
|
114
|
+
# the front will match the decimal integer 0
|
|
115
|
+
#
|
|
116
|
+
def t_BININT(t):
|
|
117
|
+
r'0[bB][0-1]+'
|
|
118
|
+
try:
|
|
119
|
+
t.value = repr(int(t.value[2:],base=2))
|
|
120
|
+
except ValueError:
|
|
121
|
+
print('Unable to convert binary value %s' % t.value)
|
|
122
|
+
return t
|
|
123
|
+
|
|
124
|
+
def t_OCTINT(t):
|
|
125
|
+
r'0[oO][0-7]+'
|
|
126
|
+
try:
|
|
127
|
+
t.value = repr(int(t.value[2:],base=8))
|
|
128
|
+
except ValueError:
|
|
129
|
+
print('Unable to convert octal value %s' % t.value)
|
|
130
|
+
return t
|
|
131
|
+
|
|
132
|
+
def t_HEXINT(t):
|
|
133
|
+
r'0[xX][0-9a-fA-F]+'
|
|
134
|
+
try:
|
|
135
|
+
t.value = repr(int(t.value,base=16))
|
|
136
|
+
except ValueError:
|
|
137
|
+
print('Unable to convert hex value %s' % t.value)
|
|
138
|
+
return t
|
|
139
|
+
|
|
140
|
+
def t_INTEGER(t):
|
|
141
|
+
r'[0-9]+'
|
|
142
|
+
try:
|
|
143
|
+
value = int(t.value)
|
|
144
|
+
except ValueError:
|
|
145
|
+
print('Incorrect integer value %s' % t.value)
|
|
146
|
+
return t
|
|
147
|
+
|
|
148
|
+
def t_STRPREFIX(t):
|
|
149
|
+
r'r(?=["\'])|u(?=["\'])|R(?=["\'])|U(?=["\'])|ur(?=["\'])|UR(?=["\'])|Ur(?=["\'])|uR(?=["\'])'
|
|
150
|
+
return t
|
|
151
|
+
|
|
152
|
+
# try longstring first as otherwise the '' will match a shortstring
|
|
153
|
+
def t_LONGSTRING(t):
|
|
154
|
+
r"('''([^\\]|(\\.))*''')|(\"\"\"([^\\]|(\\.))*\"\"\")"
|
|
155
|
+
return t
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def t_SHORTSTRING(t):
|
|
159
|
+
r"('([^'\n]|(\\.))*')|(\"([^\"\n]|(\\.))*\")"
|
|
160
|
+
return t
|
|
161
|
+
|
|
162
|
+
# special to avoid any ambiguity
|
|
163
|
+
def t_ELSEIF(t):
|
|
164
|
+
r"(?i)ELSE\s+IF"
|
|
165
|
+
return t
|
|
166
|
+
|
|
167
|
+
reserved = {
|
|
168
|
+
'and': 'AND',
|
|
169
|
+
'or': 'OR',
|
|
170
|
+
'in': 'IN',
|
|
171
|
+
'not': 'NOT',
|
|
172
|
+
'do': 'DO',
|
|
173
|
+
'Do': 'DO',
|
|
174
|
+
'for': 'FOR',
|
|
175
|
+
'For': 'FOR',
|
|
176
|
+
'loop': 'LOOP',
|
|
177
|
+
'Loop': 'LOOP',
|
|
178
|
+
'as': 'AS',
|
|
179
|
+
'with': 'WITH',
|
|
180
|
+
'With': 'WITH',
|
|
181
|
+
'where': 'WHERE',
|
|
182
|
+
'Where': 'WHERE',
|
|
183
|
+
'else': 'ELSE',
|
|
184
|
+
'Else': 'ELSE',
|
|
185
|
+
'Next': 'NEXT',
|
|
186
|
+
'next' : 'NEXT',
|
|
187
|
+
'break': 'BREAK',
|
|
188
|
+
'Break': 'BREAK',
|
|
189
|
+
'if': 'IF',
|
|
190
|
+
'If': 'IF',
|
|
191
|
+
'switch': 'SWITCH',
|
|
192
|
+
'case' : 'CASE',
|
|
193
|
+
'Function' : 'FUNCTION',
|
|
194
|
+
'function' : 'FUNCTION',
|
|
195
|
+
'Print' : 'PRINT',
|
|
196
|
+
'print' : 'PRINT',
|
|
197
|
+
'Repeat': 'REPEAT',
|
|
198
|
+
'repeat': 'REPEAT',
|
|
199
|
+
'default' : 'DEFAULT'
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
def t_ID(t):
|
|
203
|
+
r'[a-zA-Z][a-zA-Z0-9_$]*'
|
|
204
|
+
t.type = reserved.get(t.value,'ID')
|
|
205
|
+
return t
|
|
206
|
+
|
|
207
|
+
# Item tags can have underscores and digits inside, and must have
|
|
208
|
+
# at least one underscore at the front
|
|
209
|
+
def t_ITEM_TAG(t):
|
|
210
|
+
r'_[a-zA-Z_0-9]+'
|
|
211
|
+
return t
|
|
212
|
+
|
|
213
|
+
def t_ESCAPE_NEWLINE(t):
|
|
214
|
+
r'\\\n'
|
|
215
|
+
t.lexer.lineno += 1
|
|
216
|
+
|
|
217
|
+
def t_INITIAL_NEWLINE(t):
|
|
218
|
+
r'\n[\n \t]*'
|
|
219
|
+
t.lexer.lineno+=len(t.value)
|
|
220
|
+
return t
|
|
221
|
+
|
|
222
|
+
def t_COMMENT(t):
|
|
223
|
+
r'\#.*'
|
|
224
|
+
pass
|
|
225
|
+
|
|
226
|
+
lexer = lex.lex(reflags=re.MULTILINE)
|
|
227
|
+
if __name__ == "__main__":
|
|
228
|
+
lex.runmain(lexer)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import numpy
|
|
2
|
+
from numpy.linalg import eig
|
|
3
|
+
|
|
4
|
+
# Python3 compatibility
|
|
5
|
+
if isinstance(u"abc",str): #Python 3
|
|
6
|
+
unicode = str
|
|
7
|
+
|
|
8
|
+
def aug_append(current,extra):
|
|
9
|
+
"""Add the contents of extra to current"""
|
|
10
|
+
have_list = isinstance(current,list)
|
|
11
|
+
if have_list:
|
|
12
|
+
if not isinstance(extra, list):
|
|
13
|
+
#append a single element
|
|
14
|
+
return current + [extra]
|
|
15
|
+
else:
|
|
16
|
+
newlist = current[:]
|
|
17
|
+
newlist.append(extra)
|
|
18
|
+
return newlist
|
|
19
|
+
elif isinstance(current,numpy.ndarray):
|
|
20
|
+
if current.ndim == extra.ndim + 1:
|
|
21
|
+
extra = numpy.expand_dims(extra,axis=0)
|
|
22
|
+
elif current.ndim == extra.ndim:
|
|
23
|
+
extra = numpy.expand_dims(extra,axis=0)
|
|
24
|
+
current = numpy.expand_dims(current,axis=0)
|
|
25
|
+
else:
|
|
26
|
+
raise ValueError('Arrays have mismatching sizes for concatenating: %d and %d' % (current.ndim,extra.ndim))
|
|
27
|
+
return numpy.concatenate((current,extra))
|
|
28
|
+
raise ValueError("Cannot append %s to %s" % (repr(extra),repr(current)))
|
|
29
|
+
|
|
30
|
+
def aug_add(current,extra):
|
|
31
|
+
"""Sum the contents of extra to current"""
|
|
32
|
+
have_list = isinstance(current,list)
|
|
33
|
+
if have_list:
|
|
34
|
+
if isinstance(extra, (float,int)):
|
|
35
|
+
# requires numpy
|
|
36
|
+
return numpy.array(current) + extra
|
|
37
|
+
elif isinstance(extra, list):
|
|
38
|
+
return numpy.array(current) + numpy.array(extra)
|
|
39
|
+
else:
|
|
40
|
+
return current + extra
|
|
41
|
+
|
|
42
|
+
def aug_sub(current,extra):
|
|
43
|
+
have_list = isinstance(current,(list,numpy.ndarray))
|
|
44
|
+
if have_list:
|
|
45
|
+
if isinstance(extra, (float,int)):
|
|
46
|
+
# requires numpy
|
|
47
|
+
return numpy.array(current) - extra
|
|
48
|
+
elif isinstance(extra, (list,numpy.ndarray)):
|
|
49
|
+
return numpy.array(current) - numpy.array(extra)
|
|
50
|
+
else:
|
|
51
|
+
return current - extra
|
|
52
|
+
|
|
53
|
+
def aug_remove(current,extra):
|
|
54
|
+
"""Remove extra from current. Not in formal
|
|
55
|
+
specifications. Allowed to fail silently."""
|
|
56
|
+
have_list = isinstance(current,list)
|
|
57
|
+
if have_list:
|
|
58
|
+
if extra in current:
|
|
59
|
+
# not efficient as we modify in place here
|
|
60
|
+
current.remove(extra)
|
|
61
|
+
return current
|
|
62
|
+
else:
|
|
63
|
+
print('Removal Warning: %s not in %s' % (repr(extra),repr(current)))
|
|
64
|
+
return current
|
|
65
|
+
else:
|
|
66
|
+
raise ValueError("Cannot remove %s from %s" % (repr(extra),repr(current)))
|
|
67
|
+
|
|
68
|
+
def drel_dot(first_arg,second_arg):
|
|
69
|
+
"""Perform a multiplication on two unknown types"""
|
|
70
|
+
print("Multiply %s and %s" % (repr(first_arg),repr(second_arg)))
|
|
71
|
+
def make_numpy(input_arg):
|
|
72
|
+
if hasattr(input_arg,'__iter__'):
|
|
73
|
+
try:
|
|
74
|
+
return numpy.matrix(input_arg),True
|
|
75
|
+
except ValueError:
|
|
76
|
+
raise ValueError('Attempt to multiply non-matrix object %s' % (repr(input_arg)))
|
|
77
|
+
return input_arg,False
|
|
78
|
+
fa,first_matrix = make_numpy(first_arg)
|
|
79
|
+
sa,second_matrix = make_numpy(second_arg)
|
|
80
|
+
if first_matrix and second_matrix: #mult of 2 non-scalars
|
|
81
|
+
if sa.shape[0] == 1: #is a row vector
|
|
82
|
+
as_column = sa.T
|
|
83
|
+
result = (fa * as_column).T
|
|
84
|
+
else:
|
|
85
|
+
result = fa * sa
|
|
86
|
+
# detect scalars
|
|
87
|
+
if result.size == 1:
|
|
88
|
+
return result.item(0)
|
|
89
|
+
# remove extra dimension
|
|
90
|
+
elif result.ndim == 2 and 1 in result.shape: #vector
|
|
91
|
+
return numpy.array(result).squeeze()
|
|
92
|
+
else:
|
|
93
|
+
return result
|
|
94
|
+
return fa * sa
|
|
95
|
+
|
|
96
|
+
def drel_add(first_arg,second_arg):
|
|
97
|
+
"""Separate string addition from the rest"""
|
|
98
|
+
if isinstance(first_arg,(unicode,str)) and isinstance(second_arg,(unicode,str)):
|
|
99
|
+
return first_arg+second_arg
|
|
100
|
+
else:
|
|
101
|
+
result = numpy.add(first_arg,second_arg)
|
|
102
|
+
return result
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def drel_eigen(in_matrix):
|
|
106
|
+
"""Return 3 lists of form [a,v1,v2,v3], corresponding to the 3 eigenvalues
|
|
107
|
+
and eigenvector components of a 3x3 matrix"""
|
|
108
|
+
vals,vects = eig(in_matrix)
|
|
109
|
+
move = list(numpy.argsort(vals))
|
|
110
|
+
move.reverse()
|
|
111
|
+
vals = vals[move]
|
|
112
|
+
vects = vects[move]
|
|
113
|
+
vects = list([[a]+list(numpy.asarray(v).ravel()) for a,v in zip(vals,vects)]) #Eigen returns 4-list
|
|
114
|
+
return vects
|
|
115
|
+
|
|
116
|
+
def drel_int(in_val):
|
|
117
|
+
"""Return in_val as an integer"""
|
|
118
|
+
try:
|
|
119
|
+
return in_val.astype('int')
|
|
120
|
+
except:
|
|
121
|
+
return int(in_val)
|
|
122
|
+
|
|
123
|
+
def drel_strip(in_list,element):
|
|
124
|
+
"""Return the nth element from the list"""
|
|
125
|
+
return [a[element] for a in in_list]
|
|
126
|
+
|