Skip to content

Commit

Permalink
Merge pull request #668 from HEXRD/invalidate-past-critical-beta
Browse files Browse the repository at this point in the history
Add function to invalidate xys past critical beta
  • Loading branch information
saransh13 authored Jul 3, 2024
2 parents 8119695 + 88866c4 commit b32cf68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions hexrd/xrdutil/phutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ def tth_corr_sample_layer(panel, xy_pts,
return np.vstack([-tth_corr, ref_angs[:, 1]]).T


def invalidate_past_critical_beta(panel: Detector, xy_pts: np.ndarray,
pinhole_thickness: float,
pinhole_radius: float) -> None:
"""Set any xy_pts past critical beta to be nan"""
# Compute the critical beta angle. Anything past this is invalid.
critical_beta = np.arctan(2 * pinhole_radius / pinhole_thickness)
dhats = xfcapi.unitRowVector(panel.cart_to_dvecs(xy_pts))
cos_beta = -dhats[:, 2]
xy_pts[np.arccos(cos_beta) > critical_beta] = np.nan


def tth_corr_map_sample_layer(instrument,
layer_standoff, layer_thickness,
pinhole_thickness, pinhole_radius):
Expand Down

0 comments on commit b32cf68

Please sign in to comment.