You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The C-API transforms version of gvec_to_xy does not return nans under the same conditions as the numpy version.
The numpy version uses two conditions to return an nan.
For diffraction to occur, the g-vector needs to make an acute angle with the negative beam direction. If that condition is not met, then nans are returned.
If the direction of the diffracted beam points away from the detector (dot product of diffracted beam direction and detector normal is nonnegative), then again the nans are returned.
* If we are here diffraction is possible so increment the number of
* admissable vectors
*/
doublebrMat[9];
makeBinaryRotMat_cfunc(gVec_l, brMat);
doubledVec_l[3];
m33_v3s_multiply(brMat, bHat_l, 1, dVec_l);
doubledenom=v3_v3s_dot(nVec_l, dVec_l, 1);
if (denom>ztol) {
doubleu=num/denom;
doublev3_tmp[3];
/* v3_tmp = P0_l + u*dVec_l - tVec_d */
for (intj=0; j<3; j++)
v3_tmp[j] =P0_l[j] +u*dVec_l[j] -tVec_d[j];
result[0] =v3_v3s_dot(v3_tmp, rMat_d+0, 3);
result[1] =v3_v3s_dot(v3_tmp, rMat_d+1, 3);
/* result when computation can be finished */
return;
}
}
/* default result when computation can't be finished */
result[0] =NAN;
result[1] =NAN;
Note that the diffracted beam direction in the C version (dvec_l) is the negative of the diffracted beam direction in numpy (also dvec_l), but the C version checks for denom > 0 while the numpy version checks for denom < -ztol, so they are the same except for the case that the diffracted beam is (very near) parallel to the detector plane.
So I don't understand how the C-version fails to return nans in so many cases.
The text was updated successfully, but these errors were encountered:
The C-API transforms version of
gvec_to_xy
does not returnnan
s under the same conditions as the numpy version.The numpy version uses two conditions to return an
nan
.nan
s are returned.nan
s are returned.The relevant section of code is:
hexrd/hexrd/transforms/xf.py
Lines 180 to 207 in 32009f3
The C-API version seems to check the same conditions (although in a slightly different way), but somehow they are ignored. The relevant code is:
hexrd/hexrd/transforms/transforms_CFUNC.c
Lines 461 to 493 in 32009f3
Note that the diffracted beam direction in the C version (
dvec_l
) is the negative of the diffracted beam direction in numpy (alsodvec_l
), but the C version checks fordenom > 0
while the numpy version checks fordenom < -ztol
, so they are the same except for the case that the diffracted beam is (very near) parallel to the detector plane.So I don't understand how the C-version fails to return
nan
s in so many cases.The text was updated successfully, but these errors were encountered: