Difference between scipy.fftpack and numpy.fft
scipy.fftpack 和 numpy.fft 的区别
When applying scipy.fftpack.rfft and numpy.fft.rfft I get the following plots respectively:
Scipy:

Numpy:

While the shape of the 2 FFTs are roughly the same with the correct ratios between the peaks, the numpy one looks much smoother, whereas the scipy one has slightly smaller max peaks, and has much more noise.
===========================================================================
From NumPy's doc for rfft:
Returns:
out : complex ndarray
The truncated or zero-padded input, transformed along the axis indicated by axis, or the last one if axis is not specified. If n is even, the length of the transformed axis is (n/2)+1. If n is odd, the length is (n+1)/2.
It is not written explicitly but the "transformed data" is here complex.
From SciPy's doc for rfft
z : real ndarray
The returned real array contains:
[y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2))] if n is even
[y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2)),Im(y(n/2))] if n is odd
Conclusion: the storage is different.
For a starter, look at the length of magnitude, it will be different in both cases. I give an example below for clarity:
In [33]: data = np.random.random(size=8) In [34]: np.fft.rfft(data)
Out[34]:
array([ 3.33822983+0.j , 0.15879369+0.48542266j,
0.00614876+0.03590621j, -0.67376592-0.69793372j, 1.51730861+0.j ]) In [35]: scipy.fftpack.rfft(data)
Out[35]:
array([ 3.33822983, 0.15879369, 0.48542266, 0.00614876, 0.03590621,
-0.67376592, -0.69793372, 1.51730861])
The first element in both cases is the so-called "DC component" (the mean of the signal).
Then, you can recognize in the SciPy version the succession of real and imaginary parts of the NumPy version.
Difference between scipy.fftpack and numpy.fft的更多相关文章
- scipy.fftpack fft
from scipy.fftpack import fft SciPy提供fftpack模块,可让用户计算快速傅立叶变换 例子: >>> a = np.arange(1,5) > ...
- SciPy fftpack(傅里叶变换)
章节 SciPy 介绍 SciPy 安装 SciPy 基础功能 SciPy 特殊函数 SciPy k均值聚类 SciPy 常量 SciPy fftpack(傅里叶变换) SciPy 积分 SciPy ...
- scipy几乎实现numpy的所有函数
NumPy和SciPy的关系? numpy提供了数组对象,面向的任何使用者.scipy在numpy的基础上,面向科学家和工程师,提供了更为精准和广泛的函数.scipy几乎实现numpy的所有函数, ...
- numpy教程:快速傅里叶变换模块numpy.fft
http://blog.csdn.net/pipisorry/article/details/51050297 快速傅里叶变换 NumPy中,fft模块提供了快速傅里叶变换的功能.在这个模块中,许多函 ...
- 使用 scipy.fft 进行Fourier Transform:Python 信号处理
摘要:Fourier transform 是一个强大的概念,用于各种领域,从纯数学到音频工程甚至金融. 本文分享自华为云社区<使用 scipy.fft 进行Fourier Transform:P ...
- python数值计算模块NumPy scipy安装
NumPy为Python提供了快速的多维数组处理的能力,而SciPy则在NumPy基础上添加了众多的科学计算所需的各种工具包,有了这两个库,Python就有几乎和Matlab一样的处理数据和计算的能力 ...
- Python下科学计算包numpy和SciPy的安装
转载自:http://blog.sina.com.cn/s/blog_62dfdc740101aoo6.html Python下大多数工具包的安装都很简单,只需要执行 “python setup.py ...
- maya2105 - windows8 - numpy/scipy
To compile numpy, create a site.cfg file in numpy's source directory with the following or similar c ...
- Windows下Python安装numpy+mkl,Scipy和statsmodels
最近做时间序列分析需要用到Python中的statsmodels,但是安装过程中遇到很头疼的问题,Google.Stackover各种都没有找到合适的解决办法,而且貌似还有很多同学也在吐槽Window ...
随机推荐
- Hadoop 3.1.2 下载安装和分布式搭建的准备
官方有详细文档:https://hadoop.apache.org/docs/r3.1.2/hadoop-project-dist/hadoop-common/SingleCluster.html 我 ...
- win10 下springcloud打包docker镜像部署。
1:建一个最简单的springcloud应用. 2:在根目录下新建dockerfile,文件如下: FROM openjdk:8-jdk-alpine VOLUME /tmp ARG JAR_FILE ...
- Mac拷贝/复制文件夹路径快捷键
快捷键:Option+Command+C 显示路径在Finder: defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES ...
- (转)zabbix之生产案例
原文: https://www.abcdocker.com/abcdocker/category/zabbix/ 原文: https://chegva.com/1170.html
- (转)Windows上使用CMake
CMake简介 原文:http://blog.gclxry.com/use-cmake-on-windows/ 你或许听过好几种 Make 工具,例如 GNU Make ,QT 的 qmake ,微软 ...
- php array_flip() 删除数组重复元素
在PHP中,用于删除数组中重复元素有一个可用的函数,那就是 array_unique(), 但是它并不是一个最高效的方法,使用array_flip() 函数将比array_uniqure()在速度上高 ...
- IDEA Maven Mybatis generator 自动生成代码
IDEA Maven Mybatis generator 自动生成代码 一.安装配置maven以及在Idea中配置maven 安装过程步骤可以看上面的博文,里面介绍得很详细. 二.建数据表 DROP ...
- guava学习:guava集合类型-Bimap
学习guava让我惊喜的第二个接口就是:Bimap BiMap是一种特殊的映射其保持映射,同时确保没有重复的值是存在于该映射和一个值可以安全地用于获取键背面的倒数映射. 最近开发过程中,经常会有这种根 ...
- jsf和facelets的生命周期
一.JSF生命周期 JSF是基于事件驱动.JSF生命周期分为两个主要阶段:执行阶段和渲染阶段. 1.执行阶段 分为六个阶段: 恢复视图阶段 当客户端请求一个JavaServer Faces页面时,Ja ...
- ubuntu关闭时间同步与centos更改时间
环境:ubuntu 源于一次项目需要修改系统时间,但是每次修改后又被同步回网络时间,找了好久发现是这个原因: NTP即Network Time Protocol(网络时间协议),是一个互联网协议,用于 ...