Questions tagged [numpy]

The tag has no usage guidance.

46 questions
Filter by
Sorted by
Tagged with
7 views

Numpy 2D FFT produces corona that is not uniform around center

Tldr: Numpy FFT creates non uniform output when output is wanted to be uniform. I want the output to be a uniform corona. I am trying to eventually run a Gerchberg-Saxton phase retrieval algorithm. I ...
32 views

What is the difference between sampling over $-4\pi$ to $4\pi$ and 0 to $8\pi$

I see no difference in magnitude, but the phase plots vary significantly while using NumPy and MatPlotLib to plot. Looking at the phase plots, I feel like I'm missing something important. Also, I'm a ...
69 views

FFT on continuous fifo data - Is y axis magnitude sum of all samples?

I'm running an fft once a second on a buffer of data 60 seconds long. The data is sampled at 558Hz and is placed into the fifo buffer once per second. FFT is numpy.rfft. The data is scaled to psia ...
67 views

Why does numpy FFT only work for samples of 10,20,30 sec?

I'm using numpy FFT functions to find the amplitude, frequency and phase of low frequency signals. focusing between 0-10 hz.Part of my project is to vary the time over which the sample is taken and ...
43 views

Visualise/compare numpy arrays from Matlab/Octave to matplotlib

I'm new to python and matplotlib, and I'd like to visualise / compare 3 mfcc files stored as numpy arrays in txt format. I have the Octave code below, and I'd like to know how it can be done using ...
171 views

Scipy butter filter - remove DC offset w/ high sample rate

I am having a hard time figuring out how to employ a high pass filter to remove the DC offset of my data signal with the "scipy butter" function because my sample rate is quite high. The ...
47 views

Establish instantaneous amplitude of signal

I'm using the YIN algorithm to establish the pitch of my humming / whistling voice. This is a time domain algorithm and gives me the instantaneous frequency as a function of time ($f(t)$). I now wish ...
90 views

Wrong values calculating FFT with EEG Bands using Numpy

First of all I have to say I am very new to these matters. I am trying to apply FFT algorithm to some values obtained by EEG bands. I found the following code but I am unable to make it work correctly....
617 views

Quantization SNR of sine wave doesn't match 1.761 + 6.02 * Q

I am trying to show with numpy that the quantization noise of a sine wave matches the SNR formula of SNR = 1.761 + 6.02 * Q. The numpy code is simple: ...
123 views

Equal probability quantizer in Python

I am trying to apply Haralick textures to a SAR image (float32). As far as I know, the image first needs to be quantized to a reasonable bit depth prior to calculate the co-ocurrence matrix. In the ...
190 views

FFT of shifted image in Numpy

I want to prove using numpy the theory of Fourier transforms in which translation in space corresponds to a shift in the phase domain (frequency domain remains constant). I have generated these three ...
54 views

Why is there a difference in the spectrum of an audio file between Sonic Visualizer and my Python script?

I am working on a script which is creating a spectrum analysis from an audio file using SciPy and NumPy. Before I started, I analyzed the file using Sonic Visualizer, which got me the following result:...
116 views

Gaussian signal generation

Edit: Could the following be the answer? Generate WGN-like-signal which is centered around a set dBm value. Treat that signal like it was a frequency domain representation of an unknown X time-domain ...
112 views

Autocorrelation - Understanding reduced correlation at periodic time shifts using np.correlate (versus statistical autocorrelation)?

I'm going through the Think DSP by Allen B. Downey, and I'm struggling to understand a specific aspect of np.correlate and how it differs from statistic autocorrelation. The question is at the bottom, ...
332 views

Analyze PCM data

I am getting some 16 bit PCM data (raw bits) from a serial port . I need to collect this stream of bits using some python application running in PC and store it somewhere(Assume it in an array). I ...
67 views

Output shape of numpy's rfft function

For numpy's rfft function, the length of the output is about half of N, the length of the input sequence. What is the reason behind this? What are the frequency bins?
63 views

3k views

Result of inverse FFT is sometimes shifted in real space

I am using the Numpy fft2, ifft2, and related functions and I am sometimes running into a strange situation where the output ...
2k views

How to generate random samples of Gaussian distribution directly in the frequency domain?

One can easily draw (pseudo-)random samples from a normal (Gaussian) distribution by using, say, NumPy: ...
12k views

Avoiding “RuntimeWarning: invalid value encountered in log10” when converting FFT data to dBFS

I've attached some code below that I'm having some issues with. Basically, I need to write a function to get the dBFS value of a signal at a specified Hz value, at a given channel in a .wav file. ...