Skip to content

Commit

Permalink
Normalize sinc function
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewFilipovich committed Dec 3, 2024
1 parent 9614aa3 commit e8c52a1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions torchoptics/profiles/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit e8c52a1

Please sign in to comment.