Dask数组rfft似乎不起作用

时间:2015-12-24 22:11:53

标签: python dask

我试图在一些大阵列中做一些真正的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做什么操作,都会返回相同的错误。我已经尝试过Pythons 2和3,两者都有同样的问题。 我错过了什么或者这是图书馆的错误吗?

1 个答案:

答案 0 :(得分:1)

这在dask master上不会发生。最简单的解决方案可能是从那里安装。最简单的方法是

var str = GetDangerousString().toString();
var secure = str.replace(/</g, '');

$('#safe').html(secure); // or
document.getElementById('safe').innerHTML = secure;

或者您可以创建一个全新的conda环境,因此您的系统dask不必替换为可能损坏的开发版本

$ conda remove dask
$ pip install git+git://github.com/blaze/dask.git # might need root
相关问题