From e8c52a11a7d5a239f6f563329b2f27dc26724c46 Mon Sep 17 00:00:00 2001 From: Matthew Filipovich <42307495+MatthewFilipovich@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:59:34 +0000 Subject: [PATCH] Normalize `sinc` function --- torchoptics/profiles/special.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/torchoptics/profiles/special.py b/torchoptics/profiles/special.py index 6410d6a..fec70c9 100644 --- a/torchoptics/profiles/special.py +++ b/torchoptics/profiles/special.py @@ -57,7 +57,8 @@ def sinc( The sinc profile is defined by the following equation: .. math:: - \psi(x, y) = \text{sinc}\left(\frac{x}{a}\right) \cdot \text{sinc}\left(\frac{y}{b}\right) + \psi(x, y) = \frac{1}{\sqrt{ab}}\text{sinc}\left(\frac{x}{a}\right) + \cdot \text{sinc}\left(\frac{y}{b}\right) where: @@ -76,5 +77,5 @@ def sinc( """ x, y = PlanarGeometry(shape, 0, spacing, offset).meshgrid() scale = initialize_tensor("scale", scale, (2,), fill_value=True, validate_positive=True) - sinc_pattern = torch.sinc(x / scale[0]) * torch.sinc(y / scale[1]) + sinc_pattern = torch.sinc(x / scale[0]) * torch.sinc(y / scale[1]) / (scale[0] * scale[1]) ** 0.5 return sinc_pattern