Skip to content

Commit

Permalink
changing hjeuristic for computing theta_cutoff
Browse files Browse the repository at this point in the history
  • Loading branch information
bonevbs committed Apr 16, 2024
1 parent 3e2376e commit 6cf099c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions torch_harmonics/convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ def __init__(
self.nlat_in, self.nlon_in = in_shape
self.nlat_out, self.nlon_out = out_shape

# compute theta cutoff based on the bandlimit of the input field
# heuristic to compute theta cutoff based on the bandlimit of the input field and overlaps of the basis functions
if theta_cutoff is None:
theta_cutoff = self.kernel_shape[0] * torch.pi / float(self.nlat_in - 1)
theta_cutoff = (self.kernel_shape[0] + 1) / 2 * torch.pi / float(self.nlat_out - 1)

if theta_cutoff <= 0.0:
raise ValueError("Error, theta_cutoff has to be positive.")
Expand Down Expand Up @@ -433,7 +433,7 @@ def __init__(

# bandlimit
if theta_cutoff is None:
theta_cutoff = self.kernel_shape[0] * torch.pi / float(self.nlat_in - 1)
theta_cutoff = (self.kernel_shape[0] + 1) / 2 * torch.pi / float(self.nlat_in - 1)

if theta_cutoff <= 0.0:
raise ValueError("Error, theta_cutoff has to be positive.")
Expand Down

0 comments on commit 6cf099c

Please sign in to comment.