Skip to content

Commit

Permalink
Merge pull request #266 from HEXRD/Peak-Profile
Browse files Browse the repository at this point in the history
whole powder pattern fitting update
  • Loading branch information
joelvbernier authored Jun 8, 2021
2 parents 3687f33 + 8087248 commit ab052ce
Show file tree
Hide file tree
Showing 13 changed files with 6,429 additions and 4,288 deletions.
4,273 changes: 0 additions & 4,273 deletions hexrd/WPPF.py

This file was deleted.

2 changes: 1 addition & 1 deletion hexrd/imageutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def snip1d_quad(y, w=4, numiter=2):
# quadratic kernel
kern2 = np.zeros(N)
kern2[0] = kern2[-1] = -1./6.
kern2[int(p/2)] = kern2[int(3*p/2)] = 4./6.
kern2[int(p/2.)] = kern2[int(3.*p/2.)] = 4./6.
kernels.append([kern1, kern2])

z = b = _scale_image_snip(y, min_val, invert=False)
Expand Down
24 changes: 14 additions & 10 deletions hexrd/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@
from hexrd.utils.concurrent import distribute_tasks
from hexrd.utils.decorators import memoize
from hexrd.valunits import valWUnit
from hexrd.WPPF import LeBail
from hexrd.wppf import LeBail

from skimage.draw import polygon
from skimage.util import random_noise
from hexrd.wppf import wppfsupport

try:
from fast_histogram import histogram1d
Expand Down Expand Up @@ -1142,14 +1143,16 @@ def simulate_powder_pattern(self,
eta1, eta2, eta3 : Mixing parameters
'''
if(params is None):
params = {'zero_error': [0.0, -1., 1., True],
'U': [2e-1, -1., 1., True],
'V': [2e-2, -1., 1., True],
'W': [2e-2, -1., 1., True],
'X': [2e-1, -1., 1., True],
'Y': [2e-1, -1., 1., True]
}

# params = {'zero_error': [0.0, -1., 1., True],
# 'U': [2e-1, -1., 1., True],
# 'V': [2e-2, -1., 1., True],
# 'W': [2e-2, -1., 1., True],
# 'X': [2e-1, -1., 1., True],
# 'Y': [2e-1, -1., 1., True]
# }
params = wppfsupport._generate_default_parameters_LeBail(
mat_list,
1)
'''
use the material list to obtain the dictionary of initial intensities
we need to make sure that the intensities are properly scaled by the
Expand Down Expand Up @@ -1220,7 +1223,8 @@ def simulate_powder_pattern(self,
'synchrotron': wavelength
},
'bkgmethod': bkgmethod,
'intensity_init': intensity
'intensity_init': intensity,
'peakshape': 'pvtch'
}

self.WPPFclass = LeBail(**kwargs)
Expand Down
8 changes: 4 additions & 4 deletions hexrd/unitcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ def CalcWavelength(self):

def calcBetaij(self):

self.betaij = np.zeros([self.atom_ntype, 3, 3])
self.betaij = np.zeros([3, 3, self.atom_ntype])
for i in range(self.U.shape[0]):
U = self.U[i, :]
self.betaij[i, :, :] = np.array([[U[0], U[3], U[4]],
self.betaij[:, :, i] = np.array([[U[0], U[3], U[4]],
[U[3], U[1], U[5]],
[U[4], U[5], U[2]]])

self.betaij[i, :, :] *= 2. * np.pi**2 * self._aij
self.betaij[:, :, i] *= 2. * np.pi**2 * self._aij

def calcmatrices(self):

Expand Down Expand Up @@ -761,7 +761,7 @@ def CalcXRSF(self, hkl):
ff = self.CalcXRFormFactor(Z, charge, s)

if(self.aniU):
T = np.exp(-np.dot(hkl, np.dot(self.betaij[i, :, :], hkl)))
T = np.exp(-np.dot(hkl, np.dot(self.betaij[:, :, i], hkl)))
else:
T = np.exp(-8.0*np.pi**2 * self.U[i]*s)

Expand Down
Loading

0 comments on commit ab052ce

Please sign in to comment.