Skip to content

Commit 003da9d

Browse files
authored
Merge pull request #842 from HEXRD/texture
Add texture model to WPPF
2 parents 8115f87 + 6b673ea commit 003da9d

File tree

10 files changed

+2255
-1089
lines changed

10 files changed

+2255
-1089
lines changed

hexrd/projections/polar.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import warnings
2+
13
import numpy as np
24

35
from hexrd import constants
@@ -428,3 +430,36 @@ def tth_to_pixel(self, tth):
428430
convert two-theta value to pixel value (float) along two-theta axis
429431
"""
430432
return np.degrees(tth - self.tth_min)/self.tth_pixel_size
433+
434+
435+
def bin_polar_view(polar_obj: PolarView,
436+
pv: np.ndarray,
437+
azimuthal_interval: float,
438+
integration_range: float):
439+
'''bin the polar view image into a coarser
440+
grid by integration around +/- "integration_range"
441+
every "azimuthal_interval" degree
442+
'''
443+
eta_mi = np.degrees(polar_obj.eta_min)
444+
eta_ma = np.degrees(polar_obj.eta_max)
445+
446+
nspec = int((eta_ma - eta_mi)/azimuthal_interval)-1
447+
448+
pv_binned = np.zeros((nspec, pv.shape[1]))
449+
450+
tth_step = polar_obj.tth_pixel_size
451+
eta_step = polar_obj.eta_pixel_size
452+
453+
for i in range(nspec):
454+
start = ((i + 1) * azimuthal_interval - integration_range) / eta_step
455+
stop = ((i + 1) * azimuthal_interval + integration_range) / eta_step
456+
457+
start = int(start)
458+
stop = int(stop)
459+
460+
# Ignore any warnings about empty slices
461+
with warnings.catch_warnings():
462+
warnings.simplefilter("ignore", category=RuntimeWarning)
463+
pv_binned[i, :] = np.squeeze(np.nanmean(pv[start:stop, :], axis=0))
464+
465+
return pv_binned

hexrd/resources/surface_harmonics.h5

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)