Skip to content

Commit

Permalink
Add function to invalidate xys past critical beta
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Avery <[email protected]>
  • Loading branch information
psavery committed Jul 3, 2024
1 parent 8119695 commit 88866c4
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,

Check warning on line 204 in hexrd/xrdutil/phutil.py

View check run for this annotation

Codecov / codecov/patch

hexrd/xrdutil/phutil.py#L204

Added line #L204 was not covered by tests
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

Check warning on line 212 in hexrd/xrdutil/phutil.py

View check run for this annotation

Codecov / codecov/patch

hexrd/xrdutil/phutil.py#L209-L212

Added lines #L209 - L212 were not covered by tests


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

0 comments on commit 88866c4

Please sign in to comment.