【问题标题】:'TypeError: a float is required' error when applying numpy fft on conjugate of numpy ndarray在 numpy ndarray 的共轭上应用 numpy fft 时出现“TypeError:需要浮点数”错误
【发布时间】:2019-01-29 21:13:13
【问题描述】:

我有一个 numpy 数组 X。我需要该数组的共轭上的 fft。以下鳕鱼:

      print(type(X.conjugate))
      print(type(M))

      Xf = np.fft.fft(X.conjugate, M).conjugate

产生:

带有错误消息:

第 189 行,在 fft 中 a = asarray(a).astype(复杂,复制=假) TypeError:需要浮点数

在 python3.5/site-packages/numpy/fft/fftpack.py 中。

当打印 print(type(X)) 我得到了

  • 浮动错误指的是什么?
  • 我该如何解决这个问题?
  • 通过共轭是否合法?它是否也被视为 ndarray?

【问题讨论】:

    标签: python-3.x debugging fft


    【解决方案1】:

    您是否尝试过使用numpy.conj,而不是使用X.conjugate 方法?

    由于它是一个数组,我认为X.conjugate 方法不会返回一个复杂的数组。

    【讨论】:

      猜你喜欢
      • 2022-01-06
      • 2014-09-03
      • 1970-01-01
      • 2019-05-15
      • 2018-10-10
      • 1970-01-01
      • 2018-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多