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.
Files changed (37) hide show
  1. {diffpy.mpdf-1.0.2/diffpy.mpdf.egg-info → diffpy_mpdf-1.0.3}/PKG-INFO +1 -1
  2. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/visualize3D.py +42 -19
  3. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3/diffpy.mpdf.egg-info}/PKG-INFO +1 -1
  4. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/pyproject.toml +1 -1
  5. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/setup.py +1 -1
  6. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/AUTHORS.txt +0 -0
  7. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/LICENSE.txt +0 -0
  8. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/MANIFEST.in +0 -0
  9. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/README.md +0 -0
  10. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/__init__.py +0 -0
  11. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/__init__.py +0 -0
  12. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/gitarchive.cfg +0 -0
  13. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/magstructure.py +0 -0
  14. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/magutils.py +0 -0
  15. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mciftools.py +0 -0
  16. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mpdf3Dcalculator.py +0 -0
  17. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mpdfcalculator.py +0 -0
  18. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/mpdftransformer.py +0 -0
  19. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/simpleparser.py +0 -0
  20. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/MnO_cubic.cif +0 -0
  21. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/__init__.py +0 -0
  22. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/run.py +0 -0
  23. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testbasicmpdf.py +0 -0
  24. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testdata/MnO_cubic.cif +0 -0
  25. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testdata/testdata.fgr +0 -0
  26. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testdata.fgr +0 -0
  27. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testformfactor.py +0 -0
  28. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testgetdiffdata.py +0 -0
  29. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testmpdffromcif.py +0 -0
  30. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testmpdffromselfcreated.py +0 -0
  31. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/tests/testspinsatoms.py +0 -0
  32. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/version.cfg +0 -0
  33. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy/mpdf/version.py +0 -0
  34. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy.mpdf.egg-info/SOURCES.txt +0 -0
  35. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy.mpdf.egg-info/dependency_links.txt +0 -0
  36. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/diffpy.mpdf.egg-info/top_level.txt +0 -0
  37. {diffpy.mpdf-1.0.2 → diffpy_mpdf-1.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffpy.mpdf
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Tools for magnetic PDF analysis.
5
5
  Author-email: Benjamin Frandsen <benfrandsen@byu.edu>
6
6
  License: Copyright 2022 BENJAMIN ALLEN FRANDSEN
@@ -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, sliceAvailable=False):
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.a = None # these two instance attributes will construct an arbitrary grid
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.sliceAvailable = sliceAvailable
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
- # slice to the orientation we desire
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.a = np.arange(-len_a / 2, len_a / 2, dr)
137
- self.b = np.arange(-len_b / 2, len_b / 2, dr)
138
- self.a = np.append(self.a, len_a / 2)
139
- self.b = np.append(self.b, len_b / 2)
140
- A,B = np.meshgrid(self.a, self.b)
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.slice = interp.reshape(len(self.b),len(self.a))
163
+ self.dataslice = interp.reshape(len(self._b),len(self._a))
149
164
 
150
- self.sliceAvailable = True
165
+ self._sliceAvailable = True
151
166
 
152
167
  if returnSlice:
153
- return self.slice, self.a, self.b
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.a), max(self.a)
164
- bmin, bmax = min(self.b), max(self.b)
165
- im = ax.imshow(self.slice,
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diffpy.mpdf
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: Tools for magnetic PDF analysis.
5
5
  Author-email: Benjamin Frandsen <benfrandsen@byu.edu>
6
6
  License: Copyright 2022 BENJAMIN ALLEN FRANDSEN
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "diffpy.mpdf"
3
- version = "1.0.2"
3
+ version = "1.0.3"
4
4
  authors = [
5
5
  { name="Benjamin Frandsen", email="benfrandsen@byu.edu" },
6
6
  ]
@@ -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.2',
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