Skip to content

Commit

Permalink
validated and user warning
Browse files Browse the repository at this point in the history
  • Loading branch information
daubners committed Nov 18, 2024
1 parent f721715 commit 11eff49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion taufactor/taufactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def __init__(self, img, spacing, bc=(-0.5, 0.5), D_0=1, device=torch.device('cud
raise ValueError("spacing must be a list or tuple with three elements (dx, dy, dz)")
if not all(isinstance(x, (int, float)) for x in spacing):
raise ValueError("All elements in spacing must be integers or floats")
if (np.max(spacing)/np.min(spacing) > 10):
warnings.warn("This computation is very questionable for largely different spacings e.g. dz >> dx.")
dx, dy, dz = spacing
self.Ky = (dx/dy)**2
self.Kz = (dx/dz)**2
Expand All @@ -270,7 +272,6 @@ def init_nn(self, img):
# avoid div 0 errors
nn[img == 0] = torch.inf
nn[nn == 0] = torch.inf
print("lol rofl")
return nn.to(self.device)

def solve(self, iter_limit=5000, verbose=True, conv_crit=2*10**-2):
Expand Down

0 comments on commit 11eff49

Please sign in to comment.