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.
Files changed (112) hide show
  1. pyemaps/COPYING +798 -0
  2. pyemaps/CifFile/CifFile_module.py +3117 -0
  3. pyemaps/CifFile/StarFile.py +2496 -0
  4. pyemaps/CifFile/TypeContentsParser.py +82 -0
  5. pyemaps/CifFile/YappsStarParser_1_0.py +289 -0
  6. pyemaps/CifFile/YappsStarParser_1_1.py +288 -0
  7. pyemaps/CifFile/YappsStarParser_2_0.py +369 -0
  8. pyemaps/CifFile/YappsStarParser_STAR2.py +382 -0
  9. pyemaps/CifFile/__init__.py +7 -0
  10. pyemaps/CifFile/drel/__init__.py +1 -0
  11. pyemaps/CifFile/drel/drel_ast_yacc.py +582 -0
  12. pyemaps/CifFile/drel/drel_lex.py +228 -0
  13. pyemaps/CifFile/drel/drel_runtime.py +126 -0
  14. pyemaps/CifFile/drel/parsetab.py +185 -0
  15. pyemaps/CifFile/drel/py_from_ast.py +628 -0
  16. pyemaps/CifFile/parsetab.py +185 -0
  17. pyemaps/CifFile/yapps3_compiled_rt.py +390 -0
  18. pyemaps/README.md +201 -0
  19. pyemaps/__config__.py +91 -0
  20. pyemaps/__init__.py +233 -0
  21. pyemaps/__main__.py +219 -0
  22. pyemaps/__version__.py +1 -0
  23. pyemaps/cdata/Aluminium.xtl +4 -0
  24. pyemaps/cdata/AluminiumOxide.xtl +5 -0
  25. pyemaps/cdata/Aluminium_FCC.xtl +4 -0
  26. pyemaps/cdata/BariumTitanate_180k.xtl +6 -0
  27. pyemaps/cdata/BariumTitanate_270k.xtl +7 -0
  28. pyemaps/cdata/BariumTitanate_Tetra.xtl +7 -0
  29. pyemaps/cdata/BiMnO3.xtl +27 -0
  30. pyemaps/cdata/Boron_Tetra.xtl +8 -0
  31. pyemaps/cdata/CadmiumSelenide_Hex.xtl +5 -0
  32. pyemaps/cdata/CadmiumSulfide_Cubic.xtl +5 -0
  33. pyemaps/cdata/CadmiumSulfide_Hex.xtl +5 -0
  34. pyemaps/cdata/Chromium_BCC.xtl +4 -0
  35. pyemaps/cdata/CoSb3_Skutterudite.xtl +5 -0
  36. pyemaps/cdata/CopperOxide.xtl +5 -0
  37. pyemaps/cdata/Copper_FCC.xtl +4 -0
  38. pyemaps/cdata/Cu2O_Cuprite.xtl +5 -0
  39. pyemaps/cdata/Diamond.xtl +4 -0
  40. pyemaps/cdata/ErbiumPyrogermanate.xtl +9 -0
  41. pyemaps/cdata/FePd_Tetra.xtl +5 -0
  42. pyemaps/cdata/FeS2_Pyrite.xtl +15 -0
  43. pyemaps/cdata/GalliumAntimonide.xtl +5 -0
  44. pyemaps/cdata/GalliumArsenide.xtl +5 -0
  45. pyemaps/cdata/GalliumNitride.xtl +5 -0
  46. pyemaps/cdata/Germanium.xtl +4 -0
  47. pyemaps/cdata/Gold_FCC.xtl +4 -0
  48. pyemaps/cdata/IndiumArsenide.xtl +5 -0
  49. pyemaps/cdata/LaMnO3.xtl +7 -0
  50. pyemaps/cdata/LeadZirconateTitanate.xtl +8 -0
  51. pyemaps/cdata/Li2MnO3.xtl +13 -0
  52. pyemaps/cdata/NaFeO2.xtl +6 -0
  53. pyemaps/cdata/Nb3Sn.xtl +5 -0
  54. pyemaps/cdata/Pentacene.xtl +39 -0
  55. pyemaps/cdata/Silicon.xtl +4 -0
  56. pyemaps/cdata/StrontiumTitanate.xtl +6 -0
  57. pyemaps/cdata/TelluriumDioxide.xtl +5 -0
  58. pyemaps/cdata/TinDioxide_RT.xtl +5 -0
  59. pyemaps/cdata/TitaniumDioxide_Anatase.xtl +5 -0
  60. pyemaps/cdata/TitaniumDioxide_Rutile.xtl +5 -0
  61. pyemaps/cdata/TungstenDiselenide.xtl +5 -0
  62. pyemaps/cdata/VanadiumDioxide_RT.xtl +6 -0
  63. pyemaps/cdata/ZincOxide.xtl +5 -0
  64. pyemaps/cdata/Zinc_HCP.xtl +4 -0
  65. pyemaps/cdata/ZirconiumNitride.xtl +5 -0
  66. pyemaps/cdata/limno2.xtl +6 -0
  67. pyemaps/crystals.py +1415 -0
  68. pyemaps/ddiffs.py +147 -0
  69. pyemaps/diffract/__init__.py +70 -0
  70. pyemaps/diffract/bloch_dec.py +779 -0
  71. pyemaps/diffract/csf_dec.py +242 -0
  72. pyemaps/diffract/dif_dec.py +519 -0
  73. pyemaps/diffract/dpgen_dec.py +175 -0
  74. pyemaps/diffract/mxtal_dec.py +201 -0
  75. pyemaps/diffract/powder_dec.py +137 -0
  76. pyemaps/diffract/stereo_dec.py +111 -0
  77. pyemaps/display.py +791 -0
  78. pyemaps/emcontrols.py +1017 -0
  79. pyemaps/errors.py +266 -0
  80. pyemaps/fileutils.py +1001 -0
  81. pyemaps/kdiffs.py +1221 -0
  82. pyemaps/license.txt +42 -0
  83. pyemaps/samples/adf.py +137 -0
  84. pyemaps/samples/al.img +0 -0
  85. pyemaps/samples/al_dpgen.py +57 -0
  86. pyemaps/samples/al_ediom.py +94 -0
  87. pyemaps/samples/convert_image.py +88 -0
  88. pyemaps/samples/dm_diff.py +225 -0
  89. pyemaps/samples/mask.im3 +0 -0
  90. pyemaps/samples/powder.py +51 -0
  91. pyemaps/samples/raw.img +0 -0
  92. pyemaps/samples/si_bloch.py +120 -0
  93. pyemaps/samples/si_constructor.py +51 -0
  94. pyemaps/samples/si_csf.py +59 -0
  95. pyemaps/samples/si_dif.py +134 -0
  96. pyemaps/samples/si_lacbed.py +59 -0
  97. pyemaps/samples/si_pyemaps.py +80 -0
  98. pyemaps/samples/si_scm.py +156 -0
  99. pyemaps/samples/si_stereo.py +116 -0
  100. pyemaps/scattering/__init__.py +26 -0
  101. pyemaps/scattering/sct_dec.py +31 -0
  102. pyemaps/spg/__init__.py +25 -0
  103. pyemaps/spg/spg_dec.py +60 -0
  104. pyemaps/stackimg.py +1031 -0
  105. pyemaps/xtal.py +222 -0
  106. pyemaps-2.0.0.dist-info/METADATA +231 -0
  107. pyemaps-2.0.0.dist-info/RECORD +112 -0
  108. pyemaps-2.0.0.dist-info/WHEEL +5 -0
  109. pyemaps-2.0.0.dist-info/entry_points.txt +2 -0
  110. pyemaps-2.0.0.dist-info/licenses/COPYING +798 -0
  111. pyemaps-2.0.0.dist-info/licenses/license.txt +42 -0
  112. pyemaps-2.0.0.dist-info/top_level.txt +1 -0
pyemaps/ddiffs.py ADDED
@@ -0,0 +1,147 @@
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: July 17, 2022
26
+
27
+ '''
28
+
29
+ from . import EMC
30
+ from . import BlochListError
31
+
32
+ BLOCH_TOLERANCE = 1.0e-04
33
+
34
+ class BlochImgs:
35
+
36
+ '''
37
+ list of Bloch image objects and its associated controls
38
+
39
+ '''
40
+ def __init__(self, name):
41
+
42
+ setattr(self, 'name', name)
43
+ setattr(self, 'blochList', [])
44
+
45
+ @property
46
+ def name(self):
47
+ return self._name
48
+
49
+ @property
50
+ def blochList(self):
51
+ return self._blochList
52
+
53
+ @name.setter
54
+ def name(self, n):
55
+ if not isinstance(n, str) or len(n) == 0:
56
+ raise BlochListError('crystal name invalid')
57
+
58
+ self._name = n
59
+
60
+ @blochList.setter
61
+ def blochList(self, bl):
62
+ if not isinstance(bl, list):
63
+ raise BlochListError('invalid input DP list')
64
+
65
+ for emc, b in bl:
66
+ if not isinstance(emc, EMC) or \
67
+ not hasattr(b, "__len__") or \
68
+ b.ndim != 2:
69
+ raise BlochListError('invalid data found in bloch imgage list')
70
+
71
+ self._blochList = bl
72
+
73
+ # Adding new diffraction patterns
74
+ def add(self, emc, b):
75
+ if not isinstance(emc, EMC) or \
76
+ not hasattr(b, "__len__") or \
77
+ b.ndim != 2:
78
+ raise BlochListError('failed to add Bloch image object')
79
+
80
+ self._blochList.append((emc, b))
81
+
82
+ def sort(self):
83
+
84
+ '''
85
+
86
+ Sort the bloch simulation results by controls
87
+
88
+ '''
89
+ self._blochList.sort(key=lambda x: x[0])
90
+
91
+ def __getitem__(self, key):
92
+
93
+ '''
94
+
95
+ Array like method for retrieving DP
96
+
97
+ '''
98
+
99
+ return self._blochList[key]
100
+
101
+ def __contains__(self, emc, b):
102
+ '''
103
+
104
+ Given a dynamic image in 2-d array and corresponding simulation controls,
105
+ test if the pair is part of dynamic diffraction paterns list. Internal
106
+ function used for == operator overload.
107
+
108
+ '''
109
+ if not isinstance(emc, EMC) or \
110
+ not hasattr(b, "__len__") or \
111
+ b.ndim != 2:
112
+ raise BlochListError('invalid Bloch image object')
113
+
114
+ import numpy as np
115
+
116
+ shape_given = b.shape
117
+
118
+ for (e,c) in self._blochList:
119
+ if e != emc or c.shape != shape_given:
120
+ continue
121
+ if np.allclose(c, b, atol=BLOCH_TOLERANCE):
122
+ return True
123
+
124
+ return False
125
+
126
+ def __eq__(self, other):
127
+ '''
128
+
129
+ Overloading == operator for the class
130
+
131
+ '''
132
+ if len(self._blochList) != len(other.blochList):
133
+ print(f'Dimension of bloch image differs')
134
+ return False
135
+
136
+ if self._name != other._name:
137
+ print(f'Name of bloch image differs')
138
+ return False
139
+
140
+ if len(self._blochList) != len(other.blochList):
141
+ return False
142
+
143
+ for (e,b) in self._blochList:
144
+ if not other.__contains__(e,b):
145
+ print(f'Current bloch image differs from baseline')
146
+ return False
147
+ return True
@@ -0,0 +1,70 @@
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
+ '''
24
+
25
+ # import all pyemaps simulation modules
26
+ try:
27
+ from emaps import dif
28
+ except ImportError as e:
29
+ print(f'Failed to find pyemas simulation modules')
30
+ print(f'Please make sure emaps python package is installed')
31
+ raise ValueError('')
32
+
33
+ #check other modules existence
34
+ try:
35
+ from emaps import dpgen
36
+
37
+ except ImportError as e:
38
+ pass
39
+
40
+ try:
41
+ from emaps import csf
42
+
43
+ except ImportError as e:
44
+ pass
45
+
46
+ try:
47
+ from emaps import powder
48
+
49
+ except ImportError as e:
50
+ pass
51
+
52
+ try:
53
+ from emaps import bloch
54
+
55
+ except ImportError as e:
56
+ pass
57
+
58
+ try:
59
+ from emaps import stereo
60
+
61
+ except ImportError as e:
62
+ pass
63
+
64
+
65
+ try:
66
+ from emaps import mxtal
67
+
68
+ except ImportError as e:
69
+ print(f'no mxtal module found in simulation module')
70
+