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
pyemaps/__init__.py
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
|
|
2
|
+
"""
|
|
3
|
+
.. This file is part of pyEMAPS
|
|
4
|
+
|
|
5
|
+
.. ----
|
|
6
|
+
|
|
7
|
+
.. pyEMAPS is free software. You can redistribute it and/or modify
|
|
8
|
+
.. it under the terms of the GNU General Public License as published
|
|
9
|
+
.. by the Free Software Foundation, either version 3 of the License,
|
|
10
|
+
.. or (at your option) any later version..
|
|
11
|
+
|
|
12
|
+
.. pyEMAPS is distributed in the hope that it will be useful,
|
|
13
|
+
.. but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
.. GNU General Public License for more details.
|
|
16
|
+
|
|
17
|
+
.. You should have received a copy of the GNU General Public License
|
|
18
|
+
.. along with pyEMAPS. If not, see `<https://www.gnu.org/licenses/>`_.
|
|
19
|
+
|
|
20
|
+
.. Contact supprort@emlabsoftware.com for any questions and comments.
|
|
21
|
+
|
|
22
|
+
.. ----
|
|
23
|
+
|
|
24
|
+
.. Author: EMLab Solutions, Inc.
|
|
25
|
+
.. Date: May 07, 2022
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
from . import __config__
|
|
31
|
+
# explicit numberic representation of pyEMAPS package type
|
|
32
|
+
# TYPE_FREE, TYPE_FULL, TYPE_UIUC defiend by the backend module emaps
|
|
33
|
+
from emaps import PKG_TYPE, TYPE_FREE, TYPE_FULL, TYPE_UIUC
|
|
34
|
+
|
|
35
|
+
#--------------from diffraction extension module------------------------
|
|
36
|
+
try:
|
|
37
|
+
from emaps import dif
|
|
38
|
+
except ImportError:
|
|
39
|
+
raise Exception('No diffraction module found')
|
|
40
|
+
else:
|
|
41
|
+
PKG_TYPE = dif.get_pkgtype()
|
|
42
|
+
#--------------defaults from the backend for simulation control parameters
|
|
43
|
+
# Default excitation from backend: DEF_EXCITATION (low, high)
|
|
44
|
+
# Default gmax from backend: DEF_GMAX
|
|
45
|
+
# Default bmin from backend: DEF_BMIN
|
|
46
|
+
# Default intensity from backend: DEF_INTENSITY (low, high)
|
|
47
|
+
# Default gctl from backend: DEF_GCTL
|
|
48
|
+
# Default zctl from backend: DEF_ZCTL
|
|
49
|
+
#------------------------------------------------------------------------
|
|
50
|
+
(sgmn,
|
|
51
|
+
sgmx,
|
|
52
|
+
DEF_GMAX,
|
|
53
|
+
DEF_BMIN,
|
|
54
|
+
intc,
|
|
55
|
+
intz,
|
|
56
|
+
DEF_GCTL,
|
|
57
|
+
DEF_ZCTL,
|
|
58
|
+
DEF_MODE) = dif.get_sim_defs()
|
|
59
|
+
|
|
60
|
+
DEF_EXCITATION= (sgmn, sgmx)
|
|
61
|
+
DEF_INTENSITY = (intz, intc)
|
|
62
|
+
XMAX = 75 # set in dif backend as constant for now, may need to change to variable that can be set by users
|
|
63
|
+
YMAX = 75 # set in dif backend, same as the above
|
|
64
|
+
|
|
65
|
+
#-------------- defaults from backend for sample controls---------------
|
|
66
|
+
# Default starting zone setting: DEF_ZONE
|
|
67
|
+
# Default tilt: DEF_TILT (x, y)
|
|
68
|
+
# Default xaxis: DEF_XAXIS
|
|
69
|
+
#------------------------------------------------------------------------
|
|
70
|
+
zn0, zn1, zn2, tlt0, xax0 = dif.get_sam_defs()
|
|
71
|
+
DEF_ZONE= (zn0, zn1, zn2)
|
|
72
|
+
DEF_TILT =(tlt0, tlt0)
|
|
73
|
+
DEF_XAXIS = (xax0, xax0, xax0)
|
|
74
|
+
|
|
75
|
+
#-------------- defaults from backend for microscope controls-----------
|
|
76
|
+
# Default hight voltage setting: DEF_KV
|
|
77
|
+
# Default camera length: DEF_CL (x, y)
|
|
78
|
+
# Default deflection: DEF_DEFL
|
|
79
|
+
# Default normal disk size: DEF_NORM_DSIZE
|
|
80
|
+
# Default CBED disk size: DEF_CBED_DS
|
|
81
|
+
# Default disk size: DEF_DS_LIMITS (min, max)
|
|
82
|
+
#------------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
DEF_DEFL = (tlt0, tlt0)
|
|
85
|
+
(DEF_CL,
|
|
86
|
+
DEF_KV,
|
|
87
|
+
DEF_NORM_DSIZE,
|
|
88
|
+
DEF_CBED_DSIZE,
|
|
89
|
+
dmin,
|
|
90
|
+
dmax) = dif.get_mic_defs()
|
|
91
|
+
|
|
92
|
+
DEF_DSIZE_LIMITS = (dmin, dmax)
|
|
93
|
+
|
|
94
|
+
#------------------------Pyemaps Helper Modules---------------------------------
|
|
95
|
+
|
|
96
|
+
from emaps import spgseek
|
|
97
|
+
from emaps import sct
|
|
98
|
+
|
|
99
|
+
#------------------------Crystal Structure Factor Module------------------------
|
|
100
|
+
try:
|
|
101
|
+
from emaps import csf
|
|
102
|
+
|
|
103
|
+
except ImportError as e:
|
|
104
|
+
pass
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
#------------------------Powder Diffraction Module------------------------------
|
|
108
|
+
try:
|
|
109
|
+
from emaps import powder
|
|
110
|
+
|
|
111
|
+
except ImportError as e:
|
|
112
|
+
pass
|
|
113
|
+
|
|
114
|
+
#------------------------Dynamic Diffraction Module----------------------------
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
from emaps import bloch
|
|
118
|
+
|
|
119
|
+
except ImportError as e:
|
|
120
|
+
raise Exception('No diffraction module found')
|
|
121
|
+
else:
|
|
122
|
+
|
|
123
|
+
TY_NORMAL = 0 # Normal Bloch Image type
|
|
124
|
+
TY_LACBED = 1 # Large angle Bloch image type
|
|
125
|
+
th_start, th_end, th_step = bloch.get_sam_defs()
|
|
126
|
+
|
|
127
|
+
DEF_THICKNESS = (th_start, th_end, th_step)
|
|
128
|
+
|
|
129
|
+
(DEF_SAMPLING,
|
|
130
|
+
DEF_PIXSIZE,
|
|
131
|
+
DEF_DETSIZE,
|
|
132
|
+
MAX_DEPTH,
|
|
133
|
+
DEF_OMEGA) = bloch.get_sim_defs()
|
|
134
|
+
DEF_APERTURE = bloch.get_mic_defs()
|
|
135
|
+
|
|
136
|
+
#------------------------Stereodiagram Module--------------------------------
|
|
137
|
+
try:
|
|
138
|
+
from emaps import stereo
|
|
139
|
+
|
|
140
|
+
except ImportError as e:
|
|
141
|
+
raise Exception('No stereo module found')
|
|
142
|
+
else:
|
|
143
|
+
pass
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
#------------------Crystal Constructor Module--------------------------------
|
|
147
|
+
try:
|
|
148
|
+
from emaps import mxtal
|
|
149
|
+
|
|
150
|
+
except ImportError as e:
|
|
151
|
+
raise Exception('No mxtal module found')
|
|
152
|
+
else:
|
|
153
|
+
|
|
154
|
+
ID_MATRIX = [[1,0,0], [0,1,0], [0,0,1]]
|
|
155
|
+
MLEN = 10
|
|
156
|
+
DEF_TRSHIFT = [0,0,0]
|
|
157
|
+
DEF_CELLBOX = [[0,0,0], [3,3,3]]
|
|
158
|
+
DEF_XZ = [[1,0,0], [0,0,1]]
|
|
159
|
+
DEF_ORSHIFT = [0, 0, 0] # Origin shift
|
|
160
|
+
DEF_LOCASPACE = [0, 0, 0] # location in A Space
|
|
161
|
+
|
|
162
|
+
#--------------Wrapper classes around diffraction extensions---------------
|
|
163
|
+
from .errors import *
|
|
164
|
+
|
|
165
|
+
#---------Microscope control data classes handling data properties----------
|
|
166
|
+
from .emcontrols import EMControl as EMC
|
|
167
|
+
from .emcontrols import SIMControl as SIMC
|
|
168
|
+
|
|
169
|
+
#---------Diffraction classes handling diffraction pattern data-------------
|
|
170
|
+
from .kdiffs import diffPattern as DP
|
|
171
|
+
from .kdiffs import Diffraction as DPList
|
|
172
|
+
from .ddiffs import BlochImgs as BImgList
|
|
173
|
+
|
|
174
|
+
#--------------Crystal Classes and subclasses-------------------------------
|
|
175
|
+
from .crystals import Cell, Atom, SPG, Crystal
|
|
176
|
+
try:
|
|
177
|
+
from .kdiffs import XMAX, YMAX
|
|
178
|
+
except ImportError as e:
|
|
179
|
+
print(f'Error importing kinematic constants: {e}')
|
|
180
|
+
|
|
181
|
+
#--------------Pyemaps Display Functions-------------------------------------
|
|
182
|
+
from .display import showDif, showBloch, showStereo, plot2Powder
|
|
183
|
+
|
|
184
|
+
if PKG_TYPE != TYPE_FREE:
|
|
185
|
+
#------------------Diffraction Database Generator - paid package only---------------------------
|
|
186
|
+
try:
|
|
187
|
+
from emaps import dpgen
|
|
188
|
+
from emaps import stem4d
|
|
189
|
+
|
|
190
|
+
except ImportError as e:
|
|
191
|
+
print(f'Failure to import 4DSTEM modules: {e}')
|
|
192
|
+
print(f'4DSTEM feature are not available. Contact support@emlabsoftware if issue persistes')
|
|
193
|
+
else:
|
|
194
|
+
E_INT = stem4d.E_INT
|
|
195
|
+
EM_INT = stem4d.EM_INT
|
|
196
|
+
|
|
197
|
+
E_FLOAT = stem4d.E_FLOAT
|
|
198
|
+
EM_FLOAT = stem4d.EM_FLOAT
|
|
199
|
+
|
|
200
|
+
E_DOUBLE = stem4d.E_DOUBLE
|
|
201
|
+
EM_DOUBLE = stem4d.EM_DOUBLE
|
|
202
|
+
|
|
203
|
+
MAX_IMAGESIZE = stem4d.MAX_IMAGESIZE
|
|
204
|
+
MIN_IMAGESIZE = stem4d.MIN_IMAGESIZE
|
|
205
|
+
MAX_IMAGESTACK = stem4d.MAX_IMAGESTACK
|
|
206
|
+
MIN_IMAGESTACK = 1
|
|
207
|
+
DEF_FILTER_THRESHOLD = 0.2
|
|
208
|
+
DEF_SEARCH_THRESHOLD = 0.825
|
|
209
|
+
DEF_RMIN = 7
|
|
210
|
+
DEF_BOXSIZE = 10
|
|
211
|
+
DEF_CC = stem4d.cvar.edc.cc #default value from backend
|
|
212
|
+
DEF_SIGMA = stem4d.cvar.edc.sigma
|
|
213
|
+
DEF_ICENTER = stem4d.cvar.edc.get_center()
|
|
214
|
+
DEF_XSCALE = 1
|
|
215
|
+
DEF_TSCALE = 2
|
|
216
|
+
|
|
217
|
+
E_SH = 0
|
|
218
|
+
E_RAW = 1
|
|
219
|
+
E_NPY = 2
|
|
220
|
+
|
|
221
|
+
# --------image loading mode -------
|
|
222
|
+
# allowing users to handle memory needs depending on size of the images
|
|
223
|
+
EL_ONE = 1 #STEM4D image loading one stack at a time - designed for processing single image at a time
|
|
224
|
+
EL_MORE = 2 #STEM4D image loading all stacks at once - designed for processing large amount of images
|
|
225
|
+
|
|
226
|
+
# -------image handling class for 4dstem or 4DSTEM features ------
|
|
227
|
+
# "stem4d" for programming purposes - so named due to the fact that
|
|
228
|
+
# python not allowing numeric starting letter for variables such as 4dstem
|
|
229
|
+
from emaps.stem4d import send, ediom
|
|
230
|
+
try:
|
|
231
|
+
from .stackimg import StackImage
|
|
232
|
+
except ImportError as e:
|
|
233
|
+
print(f'Error importing image module: {e}. The 4D STEM module not available')
|
pyemaps/__main__.py
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'''
|
|
2
|
+
.. This file is part of pyEMAPS
|
|
3
|
+
|
|
4
|
+
.. ----
|
|
5
|
+
|
|
6
|
+
.. pyEMAPS is free software. You can redistribute it and/or modify
|
|
7
|
+
.. it under the terms of the GNU General Public License as published
|
|
8
|
+
.. by the Free Software Foundation, either version 3 of the License,
|
|
9
|
+
.. or (at your option) any later version..
|
|
10
|
+
|
|
11
|
+
.. pyEMAPS is distributed in the hope that it will be useful,
|
|
12
|
+
.. but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
.. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
.. GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
.. You should have received a copy of the GNU General Public License
|
|
17
|
+
.. along with pyEMAPS. If not, see `<https://www.gnu.org/licenses/>`_.
|
|
18
|
+
|
|
19
|
+
.. Contact supprort@emlabsoftware.com for any questions and comments.
|
|
20
|
+
|
|
21
|
+
.. ----
|
|
22
|
+
|
|
23
|
+
.. Author: EMLab Solutions, Inc.
|
|
24
|
+
.. Date: May 07, 2022
|
|
25
|
+
|
|
26
|
+
'''
|
|
27
|
+
|
|
28
|
+
rel_stage = 'Stable'
|
|
29
|
+
pyemaps_samples_dir = 'pyemaps_samples'
|
|
30
|
+
|
|
31
|
+
def copy_samples():
|
|
32
|
+
'''
|
|
33
|
+
Copies sample code from package directory to current diretory
|
|
34
|
+
for easy access.
|
|
35
|
+
'''
|
|
36
|
+
import os, sys
|
|
37
|
+
import shutil
|
|
38
|
+
|
|
39
|
+
curr_dir = os.getcwd()
|
|
40
|
+
|
|
41
|
+
q = str(f"Copy pyemaps samples into {pyemaps_samples_dir} in current directory?\n ")
|
|
42
|
+
|
|
43
|
+
inp = input(q +"[Y/n] ")
|
|
44
|
+
|
|
45
|
+
if inp and not inp.lower().strip()[:1] == "y":
|
|
46
|
+
print("No sample code is copied!")
|
|
47
|
+
sys.exit(1)
|
|
48
|
+
|
|
49
|
+
curr_samples_dir = os.path.join(curr_dir, pyemaps_samples_dir)
|
|
50
|
+
|
|
51
|
+
if not os.path.exists(curr_samples_dir):
|
|
52
|
+
os.makedirs(curr_samples_dir)
|
|
53
|
+
|
|
54
|
+
pyemaps_pkgdir = os.path.dirname(os.path.abspath(__file__))
|
|
55
|
+
pkg_samples_dir = os.path.join(pyemaps_pkgdir, "samples")
|
|
56
|
+
|
|
57
|
+
for file_name in os.listdir(pkg_samples_dir):
|
|
58
|
+
|
|
59
|
+
if file_name == 'si_pyemaps.py':
|
|
60
|
+
continue
|
|
61
|
+
source = os.path.join(pkg_samples_dir, file_name)
|
|
62
|
+
destination = os.path.join(curr_samples_dir, file_name)
|
|
63
|
+
|
|
64
|
+
if os.path.isfile(source):
|
|
65
|
+
shutil.copy(source, destination)
|
|
66
|
+
print(f'Copied sample code: {file_name} in pyemaps package to {destination}')
|
|
67
|
+
|
|
68
|
+
print(f'Run sample code by typing: \"python pyemaps_samples\\<sample>\"')
|
|
69
|
+
|
|
70
|
+
def is_alphanumeric_with_dash(s, slen):
|
|
71
|
+
"""
|
|
72
|
+
For paid package with full version of simulation backend module with 4DSTEM features,
|
|
73
|
+
license token validation done here. More validation in the backend as well.
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
import re
|
|
77
|
+
|
|
78
|
+
pattern = r'^[A-Za-z0-9-]+$'
|
|
79
|
+
return bool(re.match(pattern, s) and len(s) == slen)
|
|
80
|
+
|
|
81
|
+
def main():
|
|
82
|
+
"""
|
|
83
|
+
Liveness test and other information of pemaps package run on command line.
|
|
84
|
+
|
|
85
|
+
Usage:
|
|
86
|
+
pyemaps -s (--sample)
|
|
87
|
+
pyemaps -c (--copyright)
|
|
88
|
+
pyemaps -cp (--copysamples)
|
|
89
|
+
pyemaps -v (--version)
|
|
90
|
+
pyemaps -l (--license) <trial|info|license token>
|
|
91
|
+
|
|
92
|
+
To get help on all options, use:
|
|
93
|
+
pyemaps -h (--help)
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
from .samples.si_pyemaps import run_si_sample
|
|
98
|
+
|
|
99
|
+
from emaps import PKG_TYPE, TYPE_FREE, TYPE_FULL, TYPE_UIUC
|
|
100
|
+
|
|
101
|
+
except ImportError as e:
|
|
102
|
+
print(f"Error: importing built-in sample and pyemaps constants from backend: {e}")
|
|
103
|
+
|
|
104
|
+
import argparse
|
|
105
|
+
import datetime
|
|
106
|
+
from importlib.metadata import version as dist_version
|
|
107
|
+
|
|
108
|
+
parser = argparse.ArgumentParser(description="pyEMAPS command line tool.",
|
|
109
|
+
formatter_class=argparse.RawTextHelpFormatter)
|
|
110
|
+
|
|
111
|
+
parser.add_argument("-c",
|
|
112
|
+
"--copyright",
|
|
113
|
+
default=False,
|
|
114
|
+
action='store_true',
|
|
115
|
+
help="display pyEMAPS copyrights.",
|
|
116
|
+
required=False)
|
|
117
|
+
parser.add_argument("-cp",
|
|
118
|
+
"--copysamples",
|
|
119
|
+
default=False,
|
|
120
|
+
action='store_true',
|
|
121
|
+
help="copy sample code into current working directory.",
|
|
122
|
+
required=False)
|
|
123
|
+
|
|
124
|
+
if PKG_TYPE != TYPE_FREE:
|
|
125
|
+
parser.add_argument("-l",
|
|
126
|
+
"--license",
|
|
127
|
+
nargs='?',
|
|
128
|
+
const='info',
|
|
129
|
+
default=None,
|
|
130
|
+
metavar='trial|info|<LICENSE_ACTIVATION_TOKEN>',
|
|
131
|
+
help="""activate license for full package with 4D STEM features. Options are:
|
|
132
|
+
- trial: to activate a trial license, this option requires internet connection.
|
|
133
|
+
- info: to display current license details, no internet connection is needed.
|
|
134
|
+
- <LICENSE_ACTIVATION_TOKEN>: to activate license with license token with or without internet**.
|
|
135
|
+
The token is obtained from EMLab Solutions, Inc. by writing to support@emlabsoftware.com.
|
|
136
|
+
**No internet is required after license is activated, as all functions including license check are local.""",
|
|
137
|
+
required=False
|
|
138
|
+
)
|
|
139
|
+
parser.add_argument("-s",
|
|
140
|
+
"--sample",
|
|
141
|
+
default=False,
|
|
142
|
+
action='store_true',
|
|
143
|
+
help="run basic pyEMAPS sample code, serving as pyEMAPS liveness test.",
|
|
144
|
+
required=False)
|
|
145
|
+
parser.add_argument("-v",
|
|
146
|
+
"--version",
|
|
147
|
+
default=False,
|
|
148
|
+
help="display pyEMAPS version.",
|
|
149
|
+
action='store_true',
|
|
150
|
+
required=False)
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
args = parser.parse_args()
|
|
154
|
+
except argparse.ArgumentTypeError as e:
|
|
155
|
+
parser.print_help()
|
|
156
|
+
exit(1)
|
|
157
|
+
|
|
158
|
+
ver = dist_version("pyemaps") + str(f" {rel_stage}").lower()
|
|
159
|
+
|
|
160
|
+
copyrit = ['PyEMAPS - Transmission Electron Diffraction Simulations In Python']
|
|
161
|
+
copy1 = '© 2021-' + datetime.date.today().strftime('%Y') + ' EMLab Solutions, Inc. All rights reserved.'
|
|
162
|
+
|
|
163
|
+
vers = 'Version ' + ver
|
|
164
|
+
if PKG_TYPE == TYPE_UIUC:
|
|
165
|
+
vers = "Version " + ver +" for use exclusively at University of Illinois at Urbana Champaign."
|
|
166
|
+
|
|
167
|
+
if PKG_TYPE == TYPE_FULL:
|
|
168
|
+
vers = "Version " + ver +" with 4DSTEM."
|
|
169
|
+
|
|
170
|
+
copyrit.append(copy1)
|
|
171
|
+
scopyrit = '\n'.join(copyrit)
|
|
172
|
+
|
|
173
|
+
if args.version:
|
|
174
|
+
print(f'pyEMAPS {vers.lower()}')
|
|
175
|
+
exit(0)
|
|
176
|
+
elif args.copyright:
|
|
177
|
+
print(scopyrit)
|
|
178
|
+
exit(0)
|
|
179
|
+
else:
|
|
180
|
+
copyrit.append(vers)
|
|
181
|
+
copyrit.append('--------------------------------')
|
|
182
|
+
print('\n'.join(copyrit))
|
|
183
|
+
|
|
184
|
+
if args.copysamples:
|
|
185
|
+
copy_samples()
|
|
186
|
+
exit(0)
|
|
187
|
+
|
|
188
|
+
if args.sample:
|
|
189
|
+
run_si_sample()
|
|
190
|
+
exit(0)
|
|
191
|
+
|
|
192
|
+
if args.license is not None and PKG_TYPE != TYPE_FREE:
|
|
193
|
+
|
|
194
|
+
from emaps import stem4d
|
|
195
|
+
|
|
196
|
+
lic_option = args.license
|
|
197
|
+
if lic_option is not None:
|
|
198
|
+
lic_option_new = lic_option.lower()
|
|
199
|
+
if lic_option_new == 'info':
|
|
200
|
+
ret = stem4d.getLicenseInfo()
|
|
201
|
+
elif lic_option_new == 'trial':
|
|
202
|
+
ret = stem4d.activate_license_once()
|
|
203
|
+
|
|
204
|
+
elif is_alphanumeric_with_dash(lic_option, stem4d.LICENSE_TOKEN_LENGTH):
|
|
205
|
+
ret = stem4d.activate_license_bytoken_once(lic_option)
|
|
206
|
+
else:
|
|
207
|
+
print(f'Error: license activation token: {lic_option} is invalid!')
|
|
208
|
+
exit(1)
|
|
209
|
+
else:
|
|
210
|
+
print(f'Error: license activation token: {lic_option} is invalid!')
|
|
211
|
+
exit(1)
|
|
212
|
+
|
|
213
|
+
if ret != 0:
|
|
214
|
+
exit(1)
|
|
215
|
+
|
|
216
|
+
exit(0)
|
|
217
|
+
|
|
218
|
+
if __name__ == '__main__':
|
|
219
|
+
main()
|
pyemaps/__version__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.0"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
crystal AluminiumOxide: dw = uij
|
|
2
|
+
cell 4.76020 4.76020 12.99300 90.000 90.000 120.000
|
|
3
|
+
atom al#1 0.000000 0.000000 0.352165 0.0027 0.0027 0.0029 0.0014 0.0000 0.0000 1.00000
|
|
4
|
+
atom o#1 0.306258 0.000000 0.250000 0.0033 0.0033 0.0036 0.0016 0.0002 0.0000 1.00000
|
|
5
|
+
spg 167 1
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
crystal BariumTitanate_180k: dw = uij
|
|
2
|
+
cell 4.00430 4.00430 4.00430 89.855 89.855 89.855
|
|
3
|
+
atom ba#0 0.000000 0.000000 0.000000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom ti#0 0.487000 0.487000 0.487000 0.0036 0.0036 0.0036 0.0004 0.0004 0.0004 1.00000
|
|
5
|
+
atom o#0 0.509200 0.509200 0.018900 0.0040 0.0040 0.0012 0.0004 0.0010 0.0010 1.00000
|
|
6
|
+
spg 160 2
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
crystal BariumTitanate_270k: dw = uij
|
|
2
|
+
cell 3.98740 5.67510 5.69010 90.000 90.000 90.000
|
|
3
|
+
atom ba#0 0.000000 0.000000 0.000000 0.0049 0.0106 0.0100 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom ti#0 0.500000 0.000000 0.516900 0.0026 0.0042 0.0035 0.0000 0.0000 0.0000 1.00000
|
|
5
|
+
atom o#1 0.000000 0.000000 0.401000 0.0047 0.0060 0.0055 0.0000 0.0000 0.0000 1.00000
|
|
6
|
+
atom o#2 0.500000 0.256000 0.248600 0.0027 0.0025 0.0063 0.0000 0.0000 0.0031 1.00000
|
|
7
|
+
spg 38 1
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
crystal BariumTitanate_Tetra: dw = uij
|
|
2
|
+
cell 3.99880 3.99880 4.02220 90.000 90.000 90.000
|
|
3
|
+
atom ba#0 0.000000 0.000000 0.000000 0.1960 0.1960 0.1960 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom ti#0 0.500000 0.500000 0.502100 0.0180 0.0180 0.0180 0.0000 0.0000 0.0000 1.00000
|
|
5
|
+
atom o#1 0.500000 0.500000 -0.015300 0.0170 0.0170 0.0170 0.0000 0.0000 0.0000 1.00000
|
|
6
|
+
atom o#2 0.500000 0.000000 0.513000 0.0110 0.0110 0.0110 0.0000 0.0000 0.0000 1.00000
|
|
7
|
+
spg 99 1
|
pyemaps/cdata/BiMnO3.xtl
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
crystal BiMnO3: dw = uij
|
|
2
|
+
cell 15.50300 5.49390 11.11500 90.000 90.000 90.000
|
|
3
|
+
atom bi#1 0.000000 0.017700 0.128490 0.0048 0.0302 0.0096 0.0000 0.0000 0.0125 1.00000
|
|
4
|
+
atom bi#2 0.000000 0.470200 -0.130790 0.0075 0.0075 0.0075 0.0000 0.0000 0.0000 1.00000
|
|
5
|
+
atom bi#3 0.000000 0.526800 -0.624890 0.0090 0.0090 0.0090 0.0000 0.0000 0.0000 1.00000
|
|
6
|
+
atom bi#4 -0.245360 -0.031400 0.118310 0.0040 0.0040 0.0040 0.0000 0.0000 0.0000 1.00000
|
|
7
|
+
atom bi#5 -0.253150 0.477100 -0.120710 0.0140 0.0233 0.0085 0.0029 -0.0065 0.0044 1.00000
|
|
8
|
+
atom bi#6 0.000000 0.977400 -0.365200 0.0093 0.0210 0.0119 0.0001 0.0000 0.0000 1.00000
|
|
9
|
+
atom mn#7 0.123400 0.493700 -0.373300 0.0043 0.0043 0.0043 0.0000 0.0000 0.0000 1.000
|
|
10
|
+
atom mn#8 -0.124300 0.014900 -0.122600 0.0032 0.0032 0.0032 0.0000 0.0000 0.0000 1.000
|
|
11
|
+
atom mn#9 -0.373400 0.009700 -0.124100 0.0049 0.0049 0.0049 0.0000 0.0000 0.0000 1.000
|
|
12
|
+
atom mn#1 -0.125900 -0.492600 0.127900 0.0053 0.0053 0.0053 0.0000 0.0000 0.0000 1.000
|
|
13
|
+
atom o#1 0.153100 0.720000 -0.500500 0.0150 0.0150 0.0150 0.0000 0.0000 0.0000 1.00000
|
|
14
|
+
atom o#2 0.000000 0.554000 -0.404000 0.0120 0.0120 0.0120 0.0000 0.0000 0.0000 1.00000
|
|
15
|
+
atom o#3 0.246700 0.441000 -0.334000 0.0100 0.0100 0.0100 0.0000 0.0000 0.0000 1.00000
|
|
16
|
+
atom o#4 -0.107100 -0.311000 0.270800 0.0190 0.0190 0.0190 0.0000 0.0000 0.0000 1.00000
|
|
17
|
+
atom o#5 -0.154000 0.268000 0.000900 0.0160 0.0160 0.0160 0.0000 0.0000 0.0000 1.00000
|
|
18
|
+
atom o#6 0.000000 -0.528000 0.107000 0.0290 0.0290 0.0290 0.0000 0.0000 0.0000 1.00000
|
|
19
|
+
atom o#7 -0.133200 -0.195000 0.024900 0.0100 0.0100 0.0100 0.0000 0.0000 0.0000 1.00000
|
|
20
|
+
atom o#8 -0.097400 0.763000 -0.240800 0.0130 0.0130 0.0130 0.0000 0.0000 0.0000 1.00000
|
|
21
|
+
atom o#9 -0.098000 0.270000 -0.243000 0.0250 0.0250 0.0250 0.0000 0.0000 0.0000 1.00000
|
|
22
|
+
atom o#10 -0.245400 0.062000 -0.157000 0.0130 0.0130 0.0130 0.0000 0.0000 0.0000 1.00000
|
|
23
|
+
atom o#11 0.000000 0.041000 -0.075000 0.0150 0.0150 0.0150 0.0000 0.0000 0.0000 1.00000
|
|
24
|
+
atom o#12 -0.383500 0.708000 -0.236000 0.0340 0.0340 0.0340 0.0000 0.0000 0.0000 1.00000
|
|
25
|
+
atom o#13 -0.356400 -0.194000 0.012100 0.0110 0.0110 0.0110 0.0000 0.0000 0.0000 1.00000
|
|
26
|
+
atom o#14 -0.500000 0.070000 -0.088000 0.0200 0.0200 0.0200 0.0000 0.0000 0.0000 1.00000
|
|
27
|
+
spg 31 1
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
crystal Boron_Tetra: dw = uij
|
|
2
|
+
cell 8.75000 8.75000 5.06000 90.000 90.000 90.000
|
|
3
|
+
atom b#1 0.325400 0.087900 0.399500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom b#2 0.226800 0.081500 0.088000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
5
|
+
atom b#3 0.122000 0.122000 0.382500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
6
|
+
atom b#4 0.246000 0.246000 0.584000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
7
|
+
atom b#5 0.000000 0.000000 0.000000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
8
|
+
spg 134 1
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
crystal CadmiumSelenide_Hex: dw = uij
|
|
2
|
+
cell 4.29900 4.29900 7.01000 90.000 90.000 120.000
|
|
3
|
+
atom cd#1 0.333300 0.666700 0.000000 0.0202 0.0202 0.0206 0.0101 0.0000 0.0000 1.00000
|
|
4
|
+
atom se#1 0.333300 0.666700 0.375960 0.0161 0.0161 0.0163 0.0081 0.0000 0.0000 1.00000
|
|
5
|
+
spg 186 1
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
crystal CadmiumSulfide_Hex: dw = uij
|
|
2
|
+
cell 4.13600 4.13600 6.71300 90.000 90.000 120.000
|
|
3
|
+
atom cd#1 0.333300 0.666700 0.000000 0.0174 0.0174 0.0181 0.0087 0.0000 0.0000 1.00000
|
|
4
|
+
atom s#1 0.333300 0.666700 0.377150 0.0144 0.0144 0.0143 0.0072 0.0000 0.0000 1.00000
|
|
5
|
+
spg 186 1
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
crystal CoSb3_Skutterudite: dw = uij
|
|
2
|
+
cell 9.03600 9.03600 9.03600 90.000 90.000 90.000
|
|
3
|
+
atom co#1 0.250000 0.250000 0.250000 0.0042 0.0042 0.0042 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom sb#1 0.000000 0.335200 0.157800 0.0042 0.0073 0.0054 0.0000 0.0000 0.0000 1.00000
|
|
5
|
+
spg 204 1
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
crystal Cu2O_Cuprite: dw = uij
|
|
2
|
+
cell 4.26850 4.26850 4.26850 90.000 90.000 90.000
|
|
3
|
+
atom o#1 0.000000 0.000000 0.000000 0.0188 0.0188 0.0188 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom cu#1 0.250000 0.250000 0.250000 0.0192 0.0192 0.0192 -0.0008 -0.0008 -0.0008 1.00000
|
|
5
|
+
spg 224 1
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
crystal ErbiumPyrogermanate: dw = uij
|
|
2
|
+
cell 6.77800 6.77800 12.34000 90.000 90.000 90.000
|
|
3
|
+
atom er#1 0.875590 0.352740 0.135500 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
4
|
+
atom ge#1 0.900370 0.152050 0.619550 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
5
|
+
atom o#1 0.805500 0.194500 0.750000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
6
|
+
atom o#2 0.076400 -0.033100 0.623600 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
7
|
+
atom o#3 0.063800 0.335500 0.575100 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
8
|
+
atom o#4 0.683300 0.144900 0.542700 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 1.00000
|
|
9
|
+
spg 92 1
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
crystal FeS2_Pyrite: dw = iso
|
|
2
|
+
cell 5.4170 5.4170 5.4170 90.0000 90.0000 90.0000
|
|
3
|
+
atom fe 0.001000 0.002000 0.003000 0.7 1.000000
|
|
4
|
+
atom fe 0.496600 0.000100 0.503600 0.7 1.000000
|
|
5
|
+
atom fe 0.500100 0.502000 0.001100 0.7 1.000000
|
|
6
|
+
atom fe -0.000600 0.501300 0.503800 0.7 1.000000
|
|
7
|
+
atom s 0.385700 0.383200 0.384000 0.7 1.000000
|
|
8
|
+
atom s 0.114900 0.611400 0.884600 0.7 1.000000
|
|
9
|
+
atom s 0.885400 0.115700 0.614300 0.7 1.000000
|
|
10
|
+
atom s 0.615300 0.886500 0.114100 0.7 1.000000
|
|
11
|
+
atom s 0.615100 0.613200 0.613700 0.7 1.000000
|
|
12
|
+
atom s 0.885400 0.381800 0.114900 0.7 1.000000
|
|
13
|
+
atom s 0.114700 0.885600 0.384100 0.7 1.000000
|
|
14
|
+
atom s 0.385700 0.116100 0.884200 0.7 1.000000
|
|
15
|
+
spg 1 1
|