hexrd.wppf.texture module
- hexrd.wppf.texture.Blmn = {'oh': {2: array([[1.]]), 4: array([[-0.45643546, -0.76376262, -0.45643546]]), 6: array([[ 0.66143783, -0.35355339, 0.66143783]]), 8: array([[-0.41142537, -0.27003086, -0.71807033, -0.27003086, -0.41142537]]), 10: array([[-0.49344664, -0.4145781 , 0.41142537, -0.4145781 , -0.49344664]]), 12: array([[-0.40844758, -0.04107687, -0.34173955, -0.65528215, -0.34173955, -0.04107687, -0.40844758], [ 0. , 0.61972161, -0.29796055, 0.2330864 , -0.29796055, 0.61972161, 0. ]]), 14: array([[-0.42168205, -0.34728298, -0.32362992, 0.44009646, -0.32362992, -0.34728298, -0.42168205]]), 16: array([[ 0.40826075, 0.00472499, 0.08080979, 0.37440899, 0.61088219, 0.37440899, 0.08080979, 0.00472499, 0.40826075], [ 0. , -0.51338891, -0.30018124, 0.31746607, -0.30178916, 0.31746607, -0.30018124, -0.51338891, 0. ]])}, 'th': {2: array([[0., 1., 0.]]), 4: array([[0.45643546, 0. , 0.76376262, 0. , 0.45643546]]), 6: array([[-0.39528471, 0. , 0.58630197, 0. , 0.58630197, 0. , -0.39528471], [ 0. , 0.66143783, 0. , -0.35355339, 0. , 0.66143783, 0. ]]), 8: array([[0.41142537, 0. , 0.27003086, 0. , 0.71807033, 0. , 0.27003086, 0. , 0.41142537]]), 10: array([[-0.32179907, -0.30267051, 0.08783983, -0.25429409, 0.44789702, 0.25236027, 0.44789702, -0.25429409, 0.08783983, -0.30267051, -0.32179907], [ 0.24992195, -0.38971803, -0.06821991, -0.32742864, -0.34785463, 0.32493865, -0.34785463, -0.32742864, -0.06821991, -0.38971803, 0.24992195]]), 12: array([[-0.10774661, 0.35440528, 0.04218317, -0.56170293, -0.11564076, 0.14294419, -0.15291919, 0.14294419, -0.11564076, -0.56170293, 0.04218317, 0.35440528, -0.10774661], [ 0.34110005, 0.10028706, -0.26204378, -0.15894666, 0.42787445, 0.04044932, 0.43577422, 0.04044932, 0.42787445, -0.15894666, -0.26204378, 0.10028706, 0.34110005], [ 0.19715691, 0.02017706, 0.56151209, -0.03197896, -0.09548337, 0.00813812, 0.52003895, 0.00813812, -0.09548337, -0.03197896, 0.56151209, 0.02017706, 0.19715691]]), 14: array([[-0.28955063, -0.29723045, 0.01011772, -0.24478887, 0.12465751, -0.22811658, 0.38999832, 0.31021019, 0.38999832, -0.22811658, 0.12465751, -0.24478887, 0.01011772, -0.29723045, -0.28955063], [ 0.28772628, -0.29911506, -0.01005397, -0.24634097, -0.12387209, -0.22956297, -0.38754109, 0.31217709, -0.38754109, -0.22956297, -0.12387209, -0.24634097, -0.01005397, -0.29911506, 0.28772628]]), 16: array([[ 0.16618906, -0.36544385, -0.05921307, 0.17954391, -0.0028519 , 0.46105404, 0.19021432, -0.1780508 , 0.21273106, -0.1780508 , 0.19021432, 0.46105404, -0.0028519 , 0.17954391, -0.05921307, -0.36544385, 0.16618906], [ 0.30796148, 0.16416755, -0.26096265, -0.08065612, -0.09371337, -0.2071183 , 0.44600261, 0.07998537, 0.30530525, 0.07998537, 0.44600261, -0.2071183 , -0.09371337, -0.08065612, -0.26096265, 0.16416755, 0.30796148], [ 0.2102802 , 0.04839014, 0.43815842, -0.02377425, 0.29639276, -0.06105033, -0.07659623, 0.02357654, 0.57077837, 0.02357654, -0.07659623, -0.06105033, 0.29639276, -0.02377425, 0.43815842, 0.04839014, 0.2102802 ]])}}
utility functions for texture computation
quick overview of different laue group symmetries
laue_1 = ‘ci’ # triclinic laue_2 = ‘c2h’ # monoclinic laue_3 = ‘d2h’ # Orthorhombic laue_4 = ‘c4h’ # cyclic tetragonal laue_5 = ‘d4h’ # dihedral tetragonal laue_6 = ‘s6’ # cyclic trigonal + inversion laue_7 = ‘d3d’ # dihedral trigonal laue_8 = ‘c6h’ # cyclic laue_9 = ‘d6h’ # dihedral hexagonal laue_10 = ‘th’ # cubic low laue_11 = ‘oh’ # cubic high
- class hexrd.wppf.texture.HarmonicModel(material=None, ssym='axial', ell_max=10, bvec=array([-0., -0., -1.]), evec=array([1., 0., 0.]), sample_normal=array([-0., -0., -1.]), pfdata=None)[source]
Bases:
objectthis is the abstract class which is used by both the harmonic model as well as the pole figure class
Parameters
- materialmaterial_rietveld class
rietveld material class
- ssymstr
string encoding sample symmetry. four allowed options – ‘monoclinic’, ‘orthorhombic’, ‘axial’ and ‘triclinic’
- ell_max: int
maximum degree of spherical harmonic to use for texture computation
- params: lmfit.Parameters
Parameter class for the refinement
- bvec: numpy.ndarray
unit vector of xray beam in the lab frame. default value is -Z direction
- evec: numpy.ndarray
direction which defines zero azimuth. default value is x direction
- sample_normal: numpy.ndarray
inclination of sample frame about x direction. default value is 0, corresponding to no tilt.
- J(params)[source]
this is the texture index for the harmonic model. A value of 1 is a random texture and any value > 1 is preferred orientation.
- property angs
- property bvec
- calc_new_pfdata(params, hkls, pfgrid=None)[source]
this routine computes the new pfdata which will will be used in computing pole figures for a new hkl pole
- calc_new_pole_figure(params, hkls=None, pfgrid=None, plot=False)[source]
calculate pole figure for new poles given by hkls. the data will be computed on the same grid as the input grid. this is done so that the spherical harmonics don’t have to be recomputed.
by default, we will pick the pf grid 5 degrees in theta and 10 degrees in azimuth
hkls has the shape nx3
- calc_pf_rings(params, eta_min=-3.141592653589793, eta_max=3.141592653589793, eta_step=0.0017453292519943296, calc_type='texture_factor')[source]
this functin computes the intensity variation along the debye-scherrer rings for each hkl in the material. the intensity variation around the ring is computed between eta_min and eta_max. Default values are (-pi,pi) which gives the full ring. eta_step is the angular step size in azimuth. Default value is 0.1 degrees for eta_step
- calc_residual(params)[source]
get the difference between the input pole figures and the calculated pole figures
- calc_texture_factor(params, eta_min=-3.141592653589793, eta_max=3.141592653589793, eta_step=0.017453292519943295)[source]
- calculate_harmonic_coefficients(params, hkls=None)[source]
precompute the spherical harmonics for the given hkls and sample directions
- convert_hkls_to_cartesian(hkls)[source]
this routine converts hkls in the crystallographic frame to the cartesian frame and normalizes them
- property csym
- property densest_grid
- property ell_max
- property etavec
- get_total_sym_harm(symtype)[source]
function to return the total symmetrized harmonics for a given degree and symmetry
- property gvecs
- property intensities
- property material
- property new_pf_plots_visible
- property num_pfs
number of pole figures (read only)
- property parameter_names
- property pfdata
- plot_new_pf(filled=False, grid=False, cmap='jet', colorbar=True, colorbar_label='m.r.d.', show=True)[source]
first get the layout of the subplot
- plot_pf(filled=False, grid=False, cmap='jet', colorbar=True, colorbar_label='m.r.d.', show=True, recalculated=False)[source]
# FIXME: there is a bug during plots when the 0/2pi or -pi/pi points are not filled in for some set of inputs. need to come up with a fix for this
08/25/25 SS added a fix which seems to work for some cases. needs more extensive testing
- precompute_spherical_harmonics(eta_min, eta_max, eta_step, calc_type='texture_factor')[source]
this function precomputes the spherical harmonic functions so we don’t keep repeating the calculations
- property ref_frame_rmat
- property rotated_angs
- property sample_normal
- property ssym
- property stereo_radius
- property weights
- class hexrd.wppf.texture.InversePoleFigures(sample_dir, sampling='equiangular', resolution=5.0)[source]
Bases:
objectthis class deals with everything related to inverse pole figures.
- property angs
- initialize_crystal_dir(samplingtype, resolution=5.0)[source]
this function prepares the unit vectors of the stereogram
- property resolution
- property sample_dir
sample direction for IPF
- property sampling
- hexrd.wppf.texture.SYMLIST = ['ci', 'c2h', 'd2h', 'c4h', 'd4h', 's6', 'd3d', 'c6h', 'd6h', 'th', 'oh', 'monoclinic', 'orthorhombic', 'triclinic', 'axial']
in this section we will list the constants we need for symmetrizing the spherical harmonics for the cubic crystals (sgnum 195-230). For cyclic and dihedral symmetries, the symmetrization is done by selection rules, so they don’t need to be explicitly written here
we will list all constants up to degree 16. If the user asks for anything more than that, we will need to compute it on the fly using the spherical python package. However, this will build an extra dependency, so not sure if we need that
- hexrd.wppf.texture.calc_sym_sph_harm(deg, theta, phi, sym='oh')[source]
get symmetrized harmonics with given degree and set of coefficients
Parameters
- degint
degree of the symmetrized harmonic.
- coeffnumpy.ndarray
coefficeints to get symmetrized harmonic only for cubic symmetry size is nx1
- thetanumpy.ndarray
polar angle in radians size is nx1
- phinumpy.ndarray
co-latiture in radians size is nx1
Returns
- numpy.ndarray
spherical harmonics
- hexrd.wppf.texture.check_symmetry(sym, symtype='either')[source]
helper functio to check crystal and sample symmetry
- hexrd.wppf.texture.harmonic_model
alias of
HarmonicModel
- hexrd.wppf.texture.inverse_polar_figures
alias of
InversePoleFigures