Dask 数组 rfft 似乎不起作用
Dask array rfft doesn't seems to work
我正在尝试在一些大型数组中做一些真正的 fft 并决定给出
尝试一下。我 运行 遇到一个问题,无论我做什么,函数 dask.array.rfft 似乎都不起作用。这是一个最小的例子。
import numpy as np
import dask.array as da
import dask
print('Dask version: {}'.format(dask.__version__))
x = np.random.random((10, 10))
dx = da.from_array(x, chunks=(2, x.shape[1]))
dx_fft = da.fft.fft(dx)
dx_ifft = da.fft.ifft(dx_fft)
dx_ifft.compute()
print('Regular fft worked out just fine.')
dx = da.from_array(x, chunks=(2, x.shape[1]))
dx_rfft = da.fft.rfft(dx, axis=1)
dx_irfft = da.fft.irfft(dx_rfft, axis=1)
dx_irfft.compute()
print('Real fft worked out just fine.')
程序的输出是。
Dask version: 0.7.5
Regular fft worked out just fine.
Traceback (most recent call last):
File "a.py", line 16, in <module>
dx_irfft = da.fft.irfft(dx_rfft, axis=1)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/fft.py", line 35, in func
chunks=chunks)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 449, in map_blocks
result = atop(func, out_ind, *args, name=name, dtype=dtype)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1420, in atop
chunkss, arrays = unify_chunks(*args)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1342, in unify_chunks
for a, i in arginds]
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1141, in rechunk
return rechunk(self, chunks)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/rechunk.py", line 232, in rechunk
return Array(x2, temp_name, chunks, dtype=x.dtype)
File "/home/heitor/anaconda/lib/python2.7/site-packages/toolz/functoolz.py", line 348, in memof
raise TypeError("Arguments to memoized function must be hashable")
TypeError: Arguments to memoized function must be hashable
无论我尝试用 dx_rfft 做什么操作,它 returns 都会出现同样的错误。我试过 Pythons 2 和 3,它们都有同样的问题。
我是不是遗漏了什么或者这是库的错误?
这不会发生在 dask master 上。最简单的解决方案可能是从那里安装。最简单的方法是
$ conda remove dask
$ pip install git+git://github.com/blaze/dask.git # might need root
或者您可以创建一个新的 conda 环境,这样您的系统 dask 就不必替换为可能损坏的开发版本
$ conda create -n myenv dask #create "myenv" environment and install dask + depedencies
$ source activate myenv
(myenv)$ conda remove dask
(myenv)$ pip install git+git://github.com/blaze/dask.git
我正在尝试在一些大型数组中做一些真正的 fft 并决定给出 尝试一下。我 运行 遇到一个问题,无论我做什么,函数 dask.array.rfft 似乎都不起作用。这是一个最小的例子。
import numpy as np
import dask.array as da
import dask
print('Dask version: {}'.format(dask.__version__))
x = np.random.random((10, 10))
dx = da.from_array(x, chunks=(2, x.shape[1]))
dx_fft = da.fft.fft(dx)
dx_ifft = da.fft.ifft(dx_fft)
dx_ifft.compute()
print('Regular fft worked out just fine.')
dx = da.from_array(x, chunks=(2, x.shape[1]))
dx_rfft = da.fft.rfft(dx, axis=1)
dx_irfft = da.fft.irfft(dx_rfft, axis=1)
dx_irfft.compute()
print('Real fft worked out just fine.')
程序的输出是。
Dask version: 0.7.5
Regular fft worked out just fine.
Traceback (most recent call last):
File "a.py", line 16, in <module>
dx_irfft = da.fft.irfft(dx_rfft, axis=1)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/fft.py", line 35, in func
chunks=chunks)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 449, in map_blocks
result = atop(func, out_ind, *args, name=name, dtype=dtype)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1420, in atop
chunkss, arrays = unify_chunks(*args)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1342, in unify_chunks
for a, i in arginds]
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1141, in rechunk
return rechunk(self, chunks)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/rechunk.py", line 232, in rechunk
return Array(x2, temp_name, chunks, dtype=x.dtype)
File "/home/heitor/anaconda/lib/python2.7/site-packages/toolz/functoolz.py", line 348, in memof
raise TypeError("Arguments to memoized function must be hashable")
TypeError: Arguments to memoized function must be hashable
无论我尝试用 dx_rfft 做什么操作,它 returns 都会出现同样的错误。我试过 Pythons 2 和 3,它们都有同样的问题。 我是不是遗漏了什么或者这是库的错误?
这不会发生在 dask master 上。最简单的解决方案可能是从那里安装。最简单的方法是
$ conda remove dask
$ pip install git+git://github.com/blaze/dask.git # might need root
或者您可以创建一个新的 conda 环境,这样您的系统 dask 就不必替换为可能损坏的开发版本
$ conda create -n myenv dask #create "myenv" environment and install dask + depedencies
$ source activate myenv
(myenv)$ conda remove dask
(myenv)$ pip install git+git://github.com/blaze/dask.git