From cbe0861ffdb63c8cef2e3507d31d082427d65a01 Mon Sep 17 00:00:00 2001 From: Saransh Singh Date: Tue, 25 Feb 2025 12:20:31 -0800 Subject: [PATCH] some fixes for simulating powder diffraction pattern on an instrument. --- hexrd/instrument/hedm_instrument.py | 7 +++++-- hexrd/wppf/WPPF.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hexrd/instrument/hedm_instrument.py b/hexrd/instrument/hedm_instrument.py index 9fc15a203..a31f390ab 100644 --- a/hexrd/instrument/hedm_instrument.py +++ b/hexrd/instrument/hedm_instrument.py @@ -517,8 +517,11 @@ def max_resolution(instr): axis=0 ).reshape(2, np.cumprod(panel.shape)[-1]).T ) - max_tth = min(max_tth, np.min(angps[:, 0])) - max_eta = min(max_eta, np.min(angps[:, 1])) + mask = ~np.logical_or( + np.isclose(angps[:,0], 0), + np.isclose(angps[:,1], 0)) + max_tth = min(max_tth, np.min(angps[mask, 0])) + max_eta = min(max_eta, np.min(angps[mask, 1])) return max_tth, max_eta diff --git a/hexrd/wppf/WPPF.py b/hexrd/wppf/WPPF.py index 5dd8bbddd..ac7785e5a 100644 --- a/hexrd/wppf/WPPF.py +++ b/hexrd/wppf/WPPF.py @@ -344,6 +344,7 @@ def calctth(self): self.dsp[p][k] = dsp[limit] if sf_f is not None and lfact_sf is not None: sf_f = sf_f[allowed] + lfact_sf = lfact_sf[allowed] self.sf_hkl_factors[p][k] = sf_f[limit] self.sf_lfactor[p][k] = lfact_sf[limit]