From 902c69085115692a8bdf55310aab481138c5df4e Mon Sep 17 00:00:00 2001 From: Talon Chandler Date: Wed, 2 Oct 2024 08:30:20 -0700 Subject: [PATCH] fix dc term --- waveorder/optics.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/waveorder/optics.py b/waveorder/optics.py index 06de46e..6ae5c6c 100644 --- a/waveorder/optics.py +++ b/waveorder/optics.py @@ -239,6 +239,9 @@ def rotation_matrix(nu_z, nu_y, nu_x, wavelength): out = torch.stack((row0, row1, row2), dim=0) + # KLUDGE: fix the DC term manually, avoiding nan + out[..., 0, 0] = torch.tensor([[0, 0], [1, 0], [0, 1]])[..., None] + return torch.nan_to_num(out, nan=0.0)