some Numpy functions return ndarray instead of my subclass

后端 未结 1 1052
猫巷女王i
猫巷女王i 2020-12-15 10:15

I am subclassing Numpy\'s ndarray class, adding some meta-data and additional methods. I\'m trying to follow the instructions in this article and that one. However, some Nu

1条回答
  •  醉梦人生
    2020-12-15 10:41

    I am not sure about fft, but np.log10 is a ufunc. The following page explains how the output type of a ufunc is determined: http://docs.scipy.org/doc/numpy/reference/ufuncs.html#output-type-determination

    It wouldn't surprise me if fft always returned an ndarray though (I haven't looked at the source code, but the FFT clearly doesn't fit the definition of a ufunc). If that's the case, you can always write your own wrapper and call that instead.

    0 讨论(0)
提交回复
热议问题