diffpy.mpdf 1.0.3__tar.gz → 1.0.4__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.3/diffpy.mpdf.egg-info → diffpy_mpdf-1.0.4}/PKG-INFO +3 -2
  2. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/magstructure.py +9 -3
  3. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/magutils.py +21 -9
  4. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/mciftools.py +15 -3
  5. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/mpdftransformer.py +24 -7
  6. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4/diffpy.mpdf.egg-info}/PKG-INFO +3 -2
  7. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy.mpdf.egg-info/SOURCES.txt +0 -1
  8. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/pyproject.toml +1 -1
  9. diffpy_mpdf-1.0.3/setup.py +0 -125
  10. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/AUTHORS.txt +0 -0
  11. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/LICENSE.txt +0 -0
  12. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/MANIFEST.in +0 -0
  13. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/README.md +0 -0
  14. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/__init__.py +0 -0
  15. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/__init__.py +0 -0
  16. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/gitarchive.cfg +0 -0
  17. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/mpdf3Dcalculator.py +0 -0
  18. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/mpdfcalculator.py +0 -0
  19. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/simpleparser.py +0 -0
  20. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/MnO_cubic.cif +0 -0
  21. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/__init__.py +0 -0
  22. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/run.py +0 -0
  23. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testbasicmpdf.py +0 -0
  24. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testdata/MnO_cubic.cif +0 -0
  25. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testdata/testdata.fgr +0 -0
  26. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testdata.fgr +0 -0
  27. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testformfactor.py +0 -0
  28. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testgetdiffdata.py +0 -0
  29. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testmpdffromcif.py +0 -0
  30. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testmpdffromselfcreated.py +0 -0
  31. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/tests/testspinsatoms.py +0 -0
  32. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/version.cfg +0 -0
  33. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/version.py +0 -0
  34. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy/mpdf/visualize3D.py +0 -0
  35. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy.mpdf.egg-info/dependency_links.txt +0 -0
  36. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/diffpy.mpdf.egg-info/top_level.txt +0 -0
  37. {diffpy_mpdf-1.0.3 → diffpy_mpdf-1.0.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: diffpy.mpdf
3
- Version: 1.0.3
3
+ Version: 1.0.4
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
@@ -31,6 +31,7 @@ Requires-Python: >=3.7
31
31
  Description-Content-Type: text/markdown
32
32
  License-File: LICENSE.txt
33
33
  License-File: AUTHORS.txt
34
+ Dynamic: license-file
34
35
 
35
36
  ## diffpy.mpdf
36
37
 
@@ -24,6 +24,12 @@ from diffpy.mpdf.magutils import generateAtomsXYZ, generateFromUnitCell, \
24
24
  generateSpinsXYZ, getFFparams, jCalc, spinsFromAtoms, atomsFromSpins, \
25
25
  findAtomIndices, visualizeSpins
26
26
 
27
+ # neutron magnetic moment in nuclear magnetons
28
+ GAMMA = 1.913
29
+
30
+ # classical electron radius in units of 10^-14 m so square is in barns
31
+ r_0 = 0.281794
32
+
27
33
  class MagSpecies:
28
34
  """Store information for a single species of magnetic atom.
29
35
 
@@ -478,7 +484,7 @@ class MagStructure:
478
484
  else:
479
485
  self.ff = ff
480
486
  if K1 is None:
481
- self.K1 = 0.66667*(1.913*2.81794/2.0)**2*2.0**2*0.5*(0.5+1)
487
+ self.K1 = 0.66667*(GAMMA * r_0/2.0)**2*2.0**2*0.5*(0.5+1)
482
488
  else:
483
489
  self.K1 = K1
484
490
  if K2 is None:
@@ -726,8 +732,8 @@ class MagStructure:
726
732
  K1 += self.fractions[key]*ga*np.sqrt(Ja*(Ja+1))
727
733
  K2 += self.fractions[key]*ga**2*Ja*(Ja+1)
728
734
  K1 = K1**2
729
- K1 *= (1.913*2.81794/2.0)**2*2.0/3.0
730
- K2 *= (1.913*2.81794/2.0)**2*2.0/3.0
735
+ K1 *= (GAMMA * r_0/2.0)**2*2.0/3.0
736
+ K2 *= (GAMMA * r_0/2.0)**2*2.0/3.0
731
737
  self.K1 = K1
732
738
  self.K2 = K2
733
739
 
@@ -27,6 +27,12 @@ from scipy.signal import convolve, fftconvolve, correlate
27
27
  from scipy.optimize import least_squares
28
28
  import periodictable as pt
29
29
 
30
+ # neutron magnetic moment in nuclear magnetons
31
+ GAMMA = 1.913
32
+
33
+ # classical electron radius in units of 10^-14 m so square is in barns
34
+ r_0 = 0.281794
35
+
30
36
  def generateAtomsXYZ(struc, rmax=30.0, strucIdxs=[0], square=False):
31
37
  """Generate array of atomic Cartesian coordinates from a given structure.
32
38
 
@@ -869,7 +875,7 @@ def getStdUnc(fitResult, data, dataErr=None, numConstraints=0):
869
875
  return pUnc, chisq
870
876
 
871
877
 
872
- def optimizedSubtraction(rhigh, dhigh, rlow, dlow):
878
+ def optimizedSubtraction(rhigh, dhigh, rlow, dlow, p0=[0.999, 0.1], print_output=False):
873
879
  '''
874
880
  This routine stretches and broadens a low-temperature atomic PDF fit residual
875
881
  to match a high-temperature fit residual as closely as possible. The idea is
@@ -880,6 +886,10 @@ def optimizedSubtraction(rhigh, dhigh, rlow, dlow):
880
886
  dhigh = high-temperature atomic PDF fit residual
881
887
  rlow = r array for low-temperature atomic PDF fit residual
882
888
  dlow = low-temperature atomic PDF fit residual
889
+ p0 = initial guesses for stretching and broadening factors; [0.999, 0.1]
890
+ by default.
891
+ print_output (bool): True if the optimized stretching and broadening factors
892
+ should be printed. False by default.
883
893
  Note: the high- and low-temperature fits should be over the same r range
884
894
  '''
885
895
 
@@ -900,9 +910,9 @@ def optimizedSubtraction(rhigh, dhigh, rlow, dlow):
900
910
  msk = (x <= x.max() / stretch)
901
911
  return ycomp[msk] - newy[msk]
902
912
 
903
- p0 = [0.999, 0.1] # typical starting guesses
904
913
  opt = least_squares(residual, p0, args=(rlow, dlow, dhigh))
905
- print(opt.x)
914
+ if print_output:
915
+ print(opt.x)
906
916
  stretch = opt.x[0]
907
917
  msk = (rlow <= rlow.max() / stretch)
908
918
  newdllow = dhigh[msk] - residual(opt.x, rlow, dlow, dhigh)
@@ -1083,7 +1093,7 @@ def calculatemPDF(xyz, sxyz, gfactors=np.array([2.0]), calcIdxs=np.array([0]),
1083
1093
  rstep=0.01, rmin=0.0, rmax=20.0, psigma=0.1, qmin=0,
1084
1094
  qmax=-1, qdamp=0.0, extendedrmin=4.0, extendedrmax=4.0,
1085
1095
  orderedScale=1.0,
1086
- K1=0.66667 * (1.913 * 2.81794 / 2.0) ** 2 * 2.0 ** 2 * 0.5 * (0.5 + 1),
1096
+ K1=0.66667 * (GAMMA * r_0 / 2.0) ** 2 * 2.0 ** 2 * 0.5 * (0.5 + 1),
1087
1097
  rho0=0, netMag=0, corrLength=0, linearTermMethod='exact',
1088
1098
  applyEnvelope=False, qwindow=np.array([0]),
1089
1099
  qgrid=np.array([0])):
@@ -1229,7 +1239,7 @@ def calculatemPDF(xyz, sxyz, gfactors=np.array([2.0]), calcIdxs=np.array([0]),
1229
1239
  fr = s1 / r + r * (ss2[-1] - ss2)
1230
1240
 
1231
1241
  ### prefactor
1232
- fr /= len(calcIdxs) * K1 / (1.913 * 2.81794 / 2.0) ** 2
1242
+ fr /= len(calcIdxs) * K1 / (GAMMA * r_0 / 2.0) ** 2
1233
1243
  if applyEnvelope and (corrLength != 0):
1234
1244
  fr *= np.exp(-r/corrLength)
1235
1245
 
@@ -1253,10 +1263,10 @@ def calculatemPDF(xyz, sxyz, gfactors=np.array([2.0]), calcIdxs=np.array([0]),
1253
1263
  else:
1254
1264
  if corrLength == 0:
1255
1265
  linearTerm = 4 * np.pi * r * rho0 * (2.0/3.0) * netMag**2 \
1256
- / ( K1 / (1.913 * 2.81794 / 2.0) ** 2)
1266
+ / ( K1 / (GAMMA * r_0 / 2.0) ** 2)
1257
1267
  else:
1258
1268
  linearTerm = 4 * np.pi * r * rho0 * (2.0 / 3.0) * netMag ** 2 * np.exp(-r/corrLength) \
1259
- / ( K1 / (1.913 * 2.81794 / 2.0) ** 2)
1269
+ / ( K1 / (GAMMA * r_0 / 2.0) ** 2)
1260
1270
  fr -= linearTerm
1261
1271
 
1262
1272
 
@@ -1313,7 +1323,7 @@ def calculateDr(r, fr, q, ff, paraScale=1.0, rmintr=-5.0, rmaxtr=5.0,
1313
1323
  Returns: numpy array for the unnormalized mPDF Dr.
1314
1324
  """
1315
1325
  if K1 is None:
1316
- K1 = 0.66667 * (1.913 * 2.81794 / 2.0) ** 2 * 2.0 ** 2 * 0.5 * (0.5 + 1)
1326
+ K1 = 0.66667 * (GAMMA * r_0 / 2.0) ** 2 * 2.0 ** 2 * 0.5 * (0.5 + 1)
1317
1327
  if K2 is None:
1318
1328
  K2 = K1
1319
1329
  rsr, sr = cosTransform(q, ff, rmintr, rmaxtr, drtr)
@@ -1402,7 +1412,8 @@ def calculate_ordered_moment(mc,nucScale,returnUncertainty=False,inputUnc=[]):
1402
1412
  struc = mstr.struc
1403
1413
  mstr.calcMagneticAtomRatio()
1404
1414
  ns = mstr.magneticAtomRatio # fraction of total atoms that are magnetic
1405
- bAvg = calculateAvgB(struc) # average nuclear scattering length
1415
+ bAvg = calculateAvgB(struc) # average nuclear scattering length in fm
1416
+ bAvg /= 10.0 # convert to units of 10^-14 m
1406
1417
  g = mstr.gfactors[0] # g factor for the magnetic structrue
1407
1418
  vectorMag = np.linalg.norm(mstr.spins[0]) # magnitude of spin vectors used in calculation
1408
1419
  m = g * np.sqrt(mc.ordScale * bAvg**2 / (nucScale * ns)) * vectorMag
@@ -1445,6 +1456,7 @@ def calculate_ordered_scale(magstruc,orderedMoment,nucScale=1.0):
1445
1456
  magstruc.calcMagneticAtomRatio()
1446
1457
  ns = magstruc.magneticAtomRatio # fraction of total atoms that are magnetic
1447
1458
  bAvg = calculateAvgB(struc) # average nuclear scattering length
1459
+ bAvg /= 10.0 # convert to units of 10^-14 m
1448
1460
  g = np.mean(magstruc.gfactors) # g factor for the magnetic structrue
1449
1461
  vectorMag = calculate_avg_spin_magnitude(magstruc) # magnitude of spin vectors used in calculation
1450
1462
  oscl = (orderedMoment / g / vectorMag)**2 * nucScale * ns / bAvg**2 # ordered scale factor
@@ -39,7 +39,7 @@ def create_from_mcif(mcif, ffparamkey=None, rmaxAtoms=20, S=0.5, L=0.0,
39
39
  Creates a MagStructure object from an MCIF file.
40
40
 
41
41
  Note: The only acceptable incommensurate structures at the moment are 1-k
42
- structures with no Fourier harmonics (i.e. only coefficients for
42
+ structures with no Fourier harmonics (i.e. only coefficients for
43
43
  n = 1) and no atoms with nonzero average magnetic moment.
44
44
 
45
45
  Args:
@@ -259,7 +259,17 @@ def create_from_mcif(mcif, ffparamkey=None, rmaxAtoms=20, S=0.5, L=0.0,
259
259
  atom.element = newname
260
260
 
261
261
 
262
- #Creates a separate MagSpecies object for each magnetic atom in the unit cell
262
+ # Determine Lande g factor to convert the moment size (stored in mcif) to momentum size
263
+ if J is None:
264
+ J = S + L
265
+ if gS is None:
266
+ gS = 1.0 + 1.0*(S*(S+1)-L*(L+1))/(J*(J+1))
267
+ if gL is None:
268
+ gL = 0.5 + 1.0*(L*(L+1)-S*(S+1))/(2*J*(J+1))
269
+ if g is None:
270
+ g = gS + gL
271
+
272
+ # Creates a separate MagSpecies object for each magnetic atom in the unit cell
263
273
  for idx in mag_idx:
264
274
  new_mspec = MagSpecies(ffparamkey=ffparamkey, rmaxAtoms=rmaxAtoms,
265
275
  S=S, L=L, J=J, gS=gS, gL=gL, g=g,
@@ -277,7 +287,9 @@ def create_from_mcif(mcif, ffparamkey=None, rmaxAtoms=20, S=0.5, L=0.0,
277
287
  if incomm:
278
288
  new_mspec.kvecs = np.append(new_mspec.kvecs,[-k],axis=0)
279
289
  new_mspec.basisvecs = np.append(new_mspec.basisvecs,[np.conjugate(basis_vecs[idx])],axis=0)
280
- new_mspec.avgmom = all_mom[idx] if incomm else np.array([0, 0, 0])
290
+ new_mspec.basisvecs /= g # convert to angular momentum rather than magnetic moment
291
+ new_mspec.avgmom = np.array(all_mom[idx]) if incomm else np.array([0, 0, 0])
292
+ new_mspec.avgmom = np.array(new_mspec.avgmom) / g
281
293
 
282
294
  mstruc.loadSpecies(new_mspec)
283
295
 
@@ -26,7 +26,7 @@ from diffpy.mpdf.magutils import sinTransformDirectIntegration
26
26
 
27
27
  def resid1(p, ff, iq, diq):
28
28
  """Scale the magnetic form factor to the data."""
29
- return (iq - (p[0] * ff)**2)/diq
29
+ return (iq - p[0] * ff**2)/diq
30
30
 
31
31
  def bkgfunc(p, q):
32
32
  """Generate polynomial to fit to F(Q)."""
@@ -84,11 +84,14 @@ def getmPDF_unnormalized(q, iq, qmin, qmax, rmin=0.05, rmax=100, rstep=0.01):
84
84
  iq = iq[mask]
85
85
  r, dmag = sinTransformDirectIntegration(q, q*iq, rmin=rmin, rmax=rmax,
86
86
  rstep=rstep)
87
+ dmag *= np.sqrt(2.0/np.pi) # sinTransformDirectIntegration carries factor of sqrt(2/pi), but need 2/pi for mPDF
88
+
87
89
  return r, dmag
88
90
 
89
91
  def getmPDF_normalized(q, iq, ff, qmin, qmax, qmaxinst, rpoly,
90
92
  diq=None, qstart=3.0, rmin=0.05, rmax=100, rstep=0.01,
91
- window='None', qmaxwindow=0, windowedgewidth=0.1):
93
+ window='None', qmaxwindow=0, windowedgewidth=0.1,
94
+ ff2scale=0.0):
92
95
  """PDFgetX3-style processing to produce the normalized mPDF.
93
96
 
94
97
  This function is called by an instance of MPDFtransformer to generate
@@ -122,6 +125,12 @@ def getmPDF_normalized(q, iq, ff, qmin, qmax, qmaxinst, rpoly,
122
125
  qmaxwindow (float): Sets the q value where the window goes to 0.
123
126
  windowedgewidth (float): approximate width of Fermi-Dirac window.
124
127
  Not applicable to 'Lorch' or 'None' window options.
128
+ ff2scale (float): scale factor applied to the squared form factor
129
+ before normalizing. If left as 0.0 by default, the scale factor
130
+ is determined via least-squares fit to data over the interval
131
+ from qstart to qmaxinst. Ideally, this scale factor should be
132
+ equal to (2/3)(gamma_n r_0 / 2)^2 g^2 J(J+1),
133
+ where (gamma_n r_0 / 2)^2 = 0.07265 in units of barns.
125
134
 
126
135
  Returns:
127
136
  Dictionary with the following keys and values:
@@ -136,6 +145,7 @@ def getmPDF_normalized(q, iq, ff, qmin, qmax, qmaxinst, rpoly,
136
145
  'fqm': measured (i.e. uncorrected) reduced magnetic structure function.
137
146
  'dfqm': estimated uncertainties for fqm.
138
147
  'windowFunc': the window function used.
148
+ 'ffscale': the scale factor applied to the form factor.
139
149
  'ff2': the scaled, squared magnetic form factor.
140
150
  'bkg': the final polynomial background used.
141
151
  'bkga': the lower-degree polynomial background.
@@ -159,15 +169,18 @@ def getmPDF_normalized(q, iq, ff, qmin, qmax, qmaxinst, rpoly,
159
169
  diq = np.nan_to_num(diq, nan=1000*np.nanmax(diq))
160
170
 
161
171
  mask1 = np.logical_and(q>=qstart, q<=qmaxinst)
162
- opt1 = least_squares(resid1, [1], args=(ff[mask1], iq[mask1], diq[mask1]))
172
+
173
+ if ff2scale == 0.0:
174
+ opt1 = least_squares(resid1, [1], args=(ff[mask1], iq[mask1], diq[mask1]))
163
175
 
164
- scl = opt1.x[0]
176
+ ff2scale = opt1.x[0]
165
177
 
166
- ff = scl * ff
178
+ ff = np.sqrt(ff2scale) * ff
167
179
 
168
180
  # create a dictionary containing the items to be returned and add the
169
181
  # scaled squared form factor and initial mask to it.
170
182
  rv = {}
183
+ rv['ff2scale'] = ff2scale
171
184
  rv['ff2'] = ff**2
172
185
  rv['mask1'] = mask1
173
186
 
@@ -236,6 +249,7 @@ def getmPDF_normalized(q, iq, ff, qmin, qmax, qmaxinst, rpoly,
236
249
 
237
250
  # normalized mPDF
238
251
  r, gmag = sinTransformDirectIntegration(q[mask3], fqc[mask3], rmin=rmin, rmax=rmax, rstep=rstep)
252
+ gmag *= np.sqrt(2.0/np.pi) # sinTransformDirectIntegration carries factor of sqrt(2/pi), but need 2/pi for mPDF
239
253
 
240
254
  rv['r'] = r
241
255
  rv['gmag'] = gmag
@@ -311,7 +325,7 @@ class MPDFtransformer:
311
325
  def __init__(self, q=None, iq=None, ff=None, qmin=0.0, qmax=10.0,
312
326
  qmaxinst=None, rpoly=1.8, diq=None, qstart=3.0, rmin=0.05,
313
327
  rmax=100.0, rstep=0.01, window=None, qmaxwindow=None,
314
- windowedgewidth=0.1):
328
+ windowedgewidth=0.1, ff2scale=0.0):
315
329
  if q is None:
316
330
  self.q = np.array([0])
317
331
  else:
@@ -348,6 +362,7 @@ class MPDFtransformer:
348
362
  else:
349
363
  self.qmaxwindow = qmaxwindow
350
364
  self.windowedgewidth = windowedgewidth
365
+ self.ff2scale = ff2scale
351
366
  self._r = np.array([])
352
367
  self._dmag = np.array([])
353
368
  self._gmag = np.array([])
@@ -499,7 +514,8 @@ class MPDFtransformer:
499
514
  self.qmax, self.qmaxinst, self.rpoly,
500
515
  1.0*self.diq, self.qstart, self.rmin,
501
516
  self.rmax, self.rstep, self.window,
502
- self.qmaxwindow, self.windowedgewidth)
517
+ self.qmaxwindow, self.windowedgewidth,
518
+ 1.0*self.ff2scale)
503
519
  self._r = output['r']
504
520
  self._gmag = output['gmag']
505
521
  self._sqm = output['sqm']
@@ -516,6 +532,7 @@ class MPDFtransformer:
516
532
  self._mask1 = output['mask1']
517
533
  self._mask2 = output['mask2']
518
534
  self._mask3 = output['mask3']
535
+ self.ff2scale = output['ff2scale']
519
536
  self._normalized_done = True
520
537
 
521
538
  def makePlots(self, showuncertainty=True):
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: diffpy.mpdf
3
- Version: 1.0.3
3
+ Version: 1.0.4
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
@@ -31,6 +31,7 @@ Requires-Python: >=3.7
31
31
  Description-Content-Type: text/markdown
32
32
  License-File: LICENSE.txt
33
33
  License-File: AUTHORS.txt
34
+ Dynamic: license-file
34
35
 
35
36
  ## diffpy.mpdf
36
37
 
@@ -3,7 +3,6 @@ LICENSE.txt
3
3
  MANIFEST.in
4
4
  README.md
5
5
  pyproject.toml
6
- setup.py
7
6
  diffpy/__init__.py
8
7
  diffpy.mpdf.egg-info/PKG-INFO
9
8
  diffpy.mpdf.egg-info/SOURCES.txt
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "diffpy.mpdf"
3
- version = "1.0.3"
3
+ version = "1.0.4"
4
4
  authors = [
5
5
  { name="Benjamin Frandsen", email="benfrandsen@byu.edu" },
6
6
  ]
@@ -1,125 +0,0 @@
1
- #!/usr/bin/env python
2
- ##############################################################################
3
- #
4
- # diffpy.mpdf by Frandsen Group
5
- # Benjamin A. Frandsen benfrandsen@byu.edu
6
- # (c) 2022 Benjamin Allen Frandsen
7
- # All rights reserved
8
- #
9
- # File coded by: Benjamin Frandsen
10
- #
11
- # See AUTHORS.txt for a list of people who contributed.
12
- # See LICENSE.txt for license information.
13
- #
14
- ##############################################################################
15
-
16
- # Installation script for diffpy.mpdf
17
-
18
- """mpdf - Tools for magnetic pair distribution function analysis.
19
- Packages: diffpy.mpdf
20
- """
21
-
22
- import os
23
- from setuptools import setup, find_packages
24
-
25
- # Use this version when git data are not available, like in git zip archive.
26
- # Update when tagging a new release.
27
- FALLBACK_VERSION = '1.0.1.post0'
28
-
29
- # versioncfgfile holds version data for git commit hash and date.
30
- # It must reside in the same directory as version.py.
31
- MYDIR = os.path.dirname(os.path.abspath(__file__))
32
- versioncfgfile = os.path.join(MYDIR, 'diffpy/mpdf/version.cfg')
33
- gitarchivecfgfile = versioncfgfile.replace('version.cfg', 'gitarchive.cfg')
34
-
35
- def gitinfo():
36
- from subprocess import Popen, PIPE
37
- kw = dict(stdout=PIPE, cwd=MYDIR)
38
- proc = Popen(['git', 'describe', '--match=v[[:digit:]]*'], **kw)
39
- desc = proc.stdout.read()
40
- proc = Popen(['git', 'log', '-1', '--format=%H %at %ai'], **kw)
41
- glog = proc.stdout.read()
42
- rv = {}
43
- rv['version'] = '.post'.join(desc.strip().split('-')[:2]).lstrip('v')
44
- rv['commit'], rv['timestamp'], rv['date'] = glog.strip().split(None, 2)
45
- return rv
46
-
47
-
48
- def getversioncfg():
49
- import re
50
- try:
51
- from configparser import RawConfigParser
52
- except:
53
- from ConfigParser import RawConfigParser
54
- vd0 = dict(version=FALLBACK_VERSION, commit='', date='', timestamp=0)
55
- # first fetch data from gitarchivecfgfile, ignore if it is unexpanded
56
- g = vd0.copy()
57
- cp0 = RawConfigParser(vd0)
58
- cp0.read(gitarchivecfgfile)
59
- if '$Format:' not in cp0.get('DEFAULT', 'commit'):
60
- g = cp0.defaults()
61
- mx = re.search(r'\btag: v(\d[^,]*)', g.pop('refnames'))
62
- if mx:
63
- g['version'] = mx.group(1)
64
- # then try to obtain version data from git.
65
- gitdir = os.path.join(MYDIR, '.git')
66
- if os.path.exists(gitdir) or 'GIT_DIR' in os.environ:
67
- try:
68
- g = gitinfo()
69
- except OSError:
70
- pass
71
- # finally, check and update the active version file
72
- cp = RawConfigParser()
73
- cp.read(versioncfgfile)
74
- d = cp.defaults()
75
- rewrite = not d or (g['commit'] and (
76
- g['version'] != d.get('version') or g['commit'] != d.get('commit')))
77
- if rewrite:
78
- cp.set('DEFAULT', 'version', g['version'])
79
- cp.set('DEFAULT', 'commit', g['commit'])
80
- cp.set('DEFAULT', 'date', g['date'])
81
- cp.set('DEFAULT', 'timestamp', g['timestamp'])
82
- cp.write(open(versioncfgfile, 'w'))
83
- return cp
84
-
85
- #versiondata = getversioncfg() ### python3 incompatible
86
-
87
- # define distribution
88
- setup_args = dict(
89
- name = "diffpy.mpdf",
90
- #version = versiondata.get('DEFAULT', 'version'),
91
- version = '1.0.3',
92
- #namespace_packages = ['diffpy'],
93
- packages = find_packages(),
94
- #test_suite = 'diffpy.mpdf.tests',
95
- #include_package_data = True,
96
- #zip_safe = False,
97
- #author = 'Benjamin A. Frandsen group',
98
- #author_email = 'benfrandsen@byu.edu',
99
- #maintainer = 'Benjamin Frandsen',
100
- #maintainer_email = 'benfrandsen@byu.edu',
101
- description = "Tools for magnetic PDF analysis.",
102
- license = 'BSD-3-clause',
103
- #url = "https://github.com/FrandsenGroup/diffpy.mpdf",
104
- #keywords = "mPDF magnetic PDF",
105
- classifiers = [
106
- # List of possible values at
107
- # http://pypi.python.org/pypi?:action=list_classifiers
108
- 'Development Status :: 5 - Production/Stable',
109
- 'Environment :: Console',
110
- 'Intended Audience :: Developers',
111
- 'Intended Audience :: Science/Research',
112
- 'License :: OSI Approved :: BSD License',
113
- 'Operating System :: MacOS :: MacOS X',
114
- 'Operating System :: Microsoft :: Windows',
115
- 'Operating System :: POSIX',
116
- 'Operating System :: Unix',
117
- 'Programming Language :: Python :: 3.7',
118
- 'Topic :: Scientific/Engineering :: Physics',
119
- ],
120
- )
121
-
122
- if __name__ == '__main__':
123
- setup(**setup_args)
124
-
125
- # End of file
File without changes
File without changes
File without changes
File without changes
File without changes