简体   繁体   English

np.fft.irfft()中的归一化因子是多少?

[英]What is the normalization factor in np.fft.irfft()?

I'm using np.fft.irfft() as part of a program to calculate the Wigner distribution. 我正在使用np.fft.irfft()作为程序的一部分来计算Wigner分布。 Since I don't want the normalized version of the fft, I need the normalization factor to "undo" the normalization. 由于我不想要fft的规范化版本,因此需要规范化因子来“撤消”规范化。

What is the normalization factor for np.fft.irfft()? np.fft.irfft()的归一化因子是多少?

I believe the norm of numpy.fft.irfft is 1 over array length. 我相信numpy.fft.irfft的规范是数组长度上的1。 To see that consider the following program: 要查看该代码,请考虑以下程序:

import numpy as np

t = np.array([0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
x = np.fft.irfft(t)

print  "Array length: ", len(t), "\t 1/n: ", 1.0/float(len(t)), "\t max x val: ", max(x)


x1 = np.array([0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])

t1 = np.fft.rfft(x1)

print  "Array length: ", len(t1), "\t 1/n: ", 1.0/float(len(t1)), "\t max t1 val: ", max(t1)

This outputs: 输出:

Array length:  128   1/n:  0.0078125     max x val:  0.00787401574803
Array length:  65    1/n:  0.0153846153846   max t1 val:  (1+0j)

From this I believe that the norm of the irfft is 1/n and from rfft it is 1. This would be in accordance with this reference (see Implementation details). 因此,我认为irfft的范数为1 / n,rfft的范数为1。这将与此参考相符(请参阅实现细节)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM