Skip to content

Commit

Permalink
Divide sigma by -2 (#59)
Browse files Browse the repository at this point in the history
Instead of negating the result of `(sigma ** 2) / 2`, which may be a
Dask Array meaning this would add more nodes to the graph, simply divide
by `-2` instead. This ensures the sign still changes as intended, but
this is included as part of the division step. Thus this avoids
potentially adding more nodes to the Dask graph (assuming `sigma` is not
concrete).
  • Loading branch information
jakirkham committed Sep 6, 2018
1 parent e3d5265 commit 2490065
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dask_image/ndfourier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def fourier_gaussian(input, sigma, n=-1, axis=-1):
)

# Compute Fourier transformed Gaussian
scale = - (sigma ** 2) / 2
scale = (sigma ** 2) / -2
gaussian = dask.array.exp(
dask.array.tensordot(scale, ang_freq_grid ** 2, axes=1)
)
Expand Down

0 comments on commit 2490065

Please sign in to comment.