diffpy.mpdf 1.0.2__tar.gz → 1.0.3__tar.gz
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.
- {diffpy.mpdf-1.0.2/diffpy.mpdf.egg-info → diffpy_mpdf-1.0.3}/PKG-INFO +1 -1
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/visualize3D.py +42 -19
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3/diffpy.mpdf.egg-info}/PKG-INFO +1 -1
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/pyproject.toml +1 -1
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/setup.py +1 -1
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/AUTHORS.txt +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/LICENSE.txt +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/MANIFEST.in +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/README.md +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/__init__.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/__init__.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/gitarchive.cfg +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/magstructure.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/magutils.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mciftools.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mpdf3Dcalculator.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mpdfcalculator.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mpdftransformer.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/simpleparser.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/MnO_cubic.cif +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/__init__.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/run.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testbasicmpdf.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testdata/MnO_cubic.cif +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testdata/testdata.fgr +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testdata.fgr +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testformfactor.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testgetdiffdata.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testmpdffromcif.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testmpdffromselfcreated.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testspinsatoms.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/version.cfg +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/version.py +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy.mpdf.egg-info/SOURCES.txt +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy.mpdf.egg-info/dependency_links.txt +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy.mpdf.egg-info/top_level.txt +0 -0
- {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/setup.cfg +0 -0
|
@@ -29,15 +29,13 @@ class Visualizer:
|
|
|
29
29
|
y (numpy array): y-dimension coordinates (1D)
|
|
30
30
|
z (numpy array): z-dimension coordinates (1D)
|
|
31
31
|
"""
|
|
32
|
-
def __init__(self, m=None, x=None, y=None, z=None
|
|
32
|
+
def __init__(self, m=None, x=None, y=None, z=None):
|
|
33
33
|
|
|
34
34
|
self.m = m
|
|
35
35
|
self.x = x
|
|
36
36
|
self.y = y
|
|
37
37
|
self.z = z
|
|
38
|
-
self.
|
|
39
|
-
self.b = None
|
|
40
|
-
self.slice = None # this will become the data slice
|
|
38
|
+
self.dataslice = None # this will become the data slice
|
|
41
39
|
if m is None:
|
|
42
40
|
self.m = np.array([])
|
|
43
41
|
if x is None:
|
|
@@ -46,8 +44,25 @@ class Visualizer:
|
|
|
46
44
|
self.y = np.array([])
|
|
47
45
|
if z is None:
|
|
48
46
|
self.z = np.array([])
|
|
49
|
-
self.
|
|
47
|
+
self._sliceAvailable = False
|
|
48
|
+
self._a = None # these two instance attributes will construct an arbitrary grid
|
|
49
|
+
self._b = None
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def sliceAvailable(self):
|
|
53
|
+
"""whether or not a data slice has been made"""
|
|
54
|
+
return self._sliceAvailable
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def a(self):
|
|
58
|
+
"""internally used grid coordinate"""
|
|
59
|
+
return self._a
|
|
50
60
|
|
|
61
|
+
@property
|
|
62
|
+
def b(self):
|
|
63
|
+
"""internally used grid coordinate"""
|
|
64
|
+
return self._b
|
|
65
|
+
|
|
51
66
|
def three_points(self, p1, p2, p3):
|
|
52
67
|
"""find normal vector to the plane created by the three given points
|
|
53
68
|
"""
|
|
@@ -128,16 +143,16 @@ class Visualizer:
|
|
|
128
143
|
# we now have 2 vectors to form our plane
|
|
129
144
|
|
|
130
145
|
# now create and normalize Q, which will rotate an arbitrary
|
|
131
|
-
|
|
146
|
+
# slice to the orientation we desire
|
|
132
147
|
Q = np.column_stack((v1, v2, np.zeros_like(v1)))
|
|
133
148
|
Q[:,:2] /= np.linalg.norm(Q[:,:2], axis = 0)
|
|
134
149
|
|
|
135
150
|
# now create an arbitrary slice
|
|
136
|
-
self.
|
|
137
|
-
self.
|
|
138
|
-
self.
|
|
139
|
-
self.
|
|
140
|
-
A,B = np.meshgrid(self.
|
|
151
|
+
self._a = np.arange(-len_a / 2, len_a / 2, dr)
|
|
152
|
+
self._b = np.arange(-len_b / 2, len_b / 2, dr)
|
|
153
|
+
self._a = np.append(self._a, len_a / 2)
|
|
154
|
+
self._b = np.append(self._b, len_b / 2)
|
|
155
|
+
A,B = np.meshgrid(self._a, self._b)
|
|
141
156
|
locations = np.array([A.reshape(-1), B.reshape(-1), np.zeros(A.size)]) # the slice starts on the x-y plane
|
|
142
157
|
# now move locations onto our two vectors, and add cen_pt to move slice into position
|
|
143
158
|
locations = Q.dot(locations).T + (cen_pt)
|
|
@@ -145,25 +160,33 @@ class Visualizer:
|
|
|
145
160
|
# now we need to interpolate our 3Dmpdf function over this slice
|
|
146
161
|
points = (self.x, self.y, self.z)
|
|
147
162
|
interp = interpn(points, self.m, locations) # list of values of 3Dmpdf at locations
|
|
148
|
-
self.
|
|
163
|
+
self.dataslice = interp.reshape(len(self._b),len(self._a))
|
|
149
164
|
|
|
150
|
-
self.
|
|
165
|
+
self._sliceAvailable = True
|
|
151
166
|
|
|
152
167
|
if returnSlice:
|
|
153
|
-
return self.
|
|
168
|
+
return self.dataslice, self._a, self._b
|
|
154
169
|
|
|
155
|
-
def visualize(self):
|
|
170
|
+
def visualize(self, cmap='bwr'):
|
|
156
171
|
"""Visualize the current slice.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
cmap (str): Name of matplotlib colormap to be used for visualization.
|
|
175
|
+
See https://matplotlib.org/stable/users/explain/colors/colormaps.html
|
|
176
|
+
for complete list. Default is 'bwr', which works well for
|
|
177
|
+
3D-PDF data.
|
|
178
|
+
|
|
157
179
|
"""
|
|
158
180
|
if self.sliceAvailable:
|
|
159
181
|
fig = plt.figure()
|
|
160
182
|
ax = fig.add_subplot(111)
|
|
161
183
|
ax.set_xlabel(r'$\mathdefault{\AA}$')
|
|
162
184
|
ax.set_ylabel(r'$\mathdefault{\AA}$')
|
|
163
|
-
amin, amax = min(self.
|
|
164
|
-
bmin, bmax = min(self.
|
|
165
|
-
im = ax.imshow(self.
|
|
166
|
-
extent=[amin, amax, bmin, bmax]
|
|
185
|
+
amin, amax = min(self._a), max(self._a)
|
|
186
|
+
bmin, bmax = min(self._b), max(self._b)
|
|
187
|
+
im = ax.imshow(self.dataslice,
|
|
188
|
+
extent=[amin, amax, bmin, bmax],
|
|
189
|
+
cmap=cmap)
|
|
167
190
|
colorbar(im)
|
|
168
191
|
plt.tight_layout()
|
|
169
192
|
plt.show()
|
|
@@ -88,7 +88,7 @@ def getversioncfg():
|
|
|
88
88
|
setup_args = dict(
|
|
89
89
|
name = "diffpy.mpdf",
|
|
90
90
|
#version = versiondata.get('DEFAULT', 'version'),
|
|
91
|
-
version = '1.0.
|
|
91
|
+
version = '1.0.3',
|
|
92
92
|
#namespace_packages = ['diffpy'],
|
|
93
93
|
packages = find_packages(),
|
|
94
94
|
#test_suite = 'diffpy.mpdf.tests',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|