Skip to content

Commit

Permalink
Cleanup freq_grid_i construction in _get_freq_grid (#51)
Browse files Browse the repository at this point in the history
This code looked a little weird and was bit packed together. Break it
apart into steps so it is easier to see what is happening in
`_get_freq_grid` to construct each `freq_grid_i` for each dimension.
  • Loading branch information
jakirkham committed Sep 2, 2018
1 parent edf472f commit eeb5a55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dask_image/ndfourier/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ def _get_freq_grid(shape, chunks, dtype=float):
sl[i] = slice(None)
sl = tuple(sl)

freq_grid_i = _compat._fftfreq(shape[i],
chunks=chunks[i]).astype(dtype)[sl]
freq_grid_i = _compat._fftfreq(shape[i], chunks=chunks[i])
freq_grid_i = freq_grid_i.astype(dtype)
freq_grid_i = freq_grid_i[sl]

for j in itertools.chain(range(i), range(i + 1, ndim)):
freq_grid_i = freq_grid_i.repeat(shape[j], axis=j)

Expand Down

0 comments on commit eeb5a55

Please sign in to comment.