Dask数组rfft似乎

2024-04-26 10:04:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图在一些大数组中做一些真正的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\u rfft做什么操作,它都返回相同的错误。我试过Python2和Python3,都有同样的问题。 我是遗漏了什么还是这是图书馆的错误?你知道吗


Tags: inpyffthomeliblinesiteanaconda
1条回答
网友
1楼 · 发布于 2024-04-26 10:04:19

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

$ 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

相关问题 更多 >