Questions tagged [numpy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
93 views

Replicating SDR transmitter and receiver (shifting of a quadrature signal)

I am trying to implement an SDR transmitter and receiver based on the description here. ...
Ladislav Ondris's user avatar
-1 votes
1 answer
111 views

Why does my irFFT function have a small discrepancy distributed through the entire output?

Since I've last posted on dsp@stackexchange, I have been working on my algorithms and recently came across a useful radix-2 implementation which delivers performance as good or better than that of ...
HFGCS's user avatar
  • 27
0 votes
1 answer
327 views

python how to demodulate iq fm signal that was moved to 0 frequency

I am struggling with implementing FM demodulation for IQ samples that has 0 center frequency from RTL-SDR ... I have found the following algorithm for FM demodulation, see FM demodulation: ...
Denis Kotov's user avatar
1 vote
1 answer
225 views

Overlap and Add/Save Inverse Short-Time Fourier transform

Edited for conciseness, please see below: Question: How does overlap and save work, in the context of array buffers? How does overlap and add work? For a specific use case involving STFT, which one is ...
HFGCS's user avatar
  • 27
1 vote
0 answers
105 views

Segment Hand Image into Palm and Fingers

Here is my code, i want to extract only the fingers and save them as a new image ...
Paul Daniels's user avatar
2 votes
3 answers
272 views

polynomial is not fitting well

I have two signal spectrums. I represent them with polynomial coefficients and then do convolution. fig 1 & 2 are the two signal spectrums and their corresponding polynomial representations. (I ...
MRR's user avatar
  • 25
0 votes
1 answer
256 views

Vectorizing a biquad filter (python / numpy)

I'm having a lot of fun writing signal processing code in Python / numpy, and I'm resisting the urge to pre-optimize the code. But my biquad implementation is slower than I want. Here's the inner ...
fearless_fool's user avatar
1 vote
1 answer
187 views

Weird Noise arises on the small scales: one question about the fast CWT algorithm implemented in real space

Background: I am learning an interesting Fast CWT algorithm(PPCWT) by reading this paper published in 2019. The algorithm is summarized as below. The continuous wavelet transform of a signal can be ...
Wang Yun's user avatar
  • 124
1 vote
1 answer
109 views

Does the resolution of a timeseries affect the estimate of the power-spectrum when using np.fft.rfft and does it comply with parseval's theorem?

I have been trying to estimate the power spectrum of a timeseries using fourier transform. I have tried to do this using two variations of the spectral density estimate using np.fft.rfft. The two ...
Jokerp's user avatar
  • 179
0 votes
0 answers
170 views

SDR - Manual FFT PSD vs pylab PSD

I am trying to calculate the power spectral density step by step using numpy FFT and comparing it to the PSD calculated by pylab PSD. Difference b/w plots of both methods can be visualized from in ...
Abdul wahab's user avatar
0 votes
0 answers
83 views

Decimate a signal whose values are calculated, not stored

tl;dr I'm looking for something like Scipy's decimate function, but one that takes in a generator, rather than a Numpy array. I am turning on and off a light using ...
Kevin's user avatar
  • 101
2 votes
0 answers
39 views

How to achieve uniform gaussian profile? Beam profile has grainy/multimode pattern

Hi apologies in advance if this (optics & image-process) is not where I should post this question. Thanks for the help! I'm required to make a jig that measures the divergence angle of a ...
Hazman's user avatar
  • 21
15 votes
4 answers
5k views

When concatenating sine waves, how do I phase shift in order to prevent "pops" caused by sudden jumps in amplitude?

I'm writing a synthesizer using numpy and python. I've run into a problem where concatenating sine waves causes 'pops' or 'clicks' when they are outputted to audio, say, via ...
Tim's user avatar
  • 151
0 votes
1 answer
339 views

Simulation of Lock-In Amplification in Python makes no sense

I would like to simulate a basic lock-in amplification for post-processing some data. I wrote a basic Python script for this purpose but the output of the lock-in amplification does not seem to make ...
Mantabit's user avatar
  • 121
0 votes
0 answers
306 views

How can I generate long time series data of band limited gaussian white noise in Python?

...
Subhadip Saha's user avatar
0 votes
0 answers
28 views

How can to obtain the transfer function of a bandpass digital filter? [duplicate]

I've been asked to: create a bandpass filter amplifier in python, determine the transfer function, graph the bode diagram, and print the highcut frequency, lowcut frequency, the bode constant and the ...
Marcia Cocozza's user avatar
1 vote
1 answer
310 views

Resample signal and start from a different point with numpy.interp

I am trying to resample a signal in Python, only by giving the new and the old step. My function works fine until here. But now I want to start the resampled signal at a specific point other than the ...
frank.lv's user avatar
0 votes
0 answers
576 views

More Efficient Frequency Shift + FIR Decimation

I am dealing with complex IQ data from a software defined radio. I'd like to digitally shift the spectrum by some amount to center an off-center signal, then decimate down to that signal only. ...
Projectile Fish's user avatar
1 vote
1 answer
442 views

How to center the FFT of sine wave in matplotlib?

I want to plot the FFT of a sine wave using matplotlib and I want to plot a single line at a frequency where the sine wave belongs. here's my code ...
iwrestledthebeartwice's user avatar
2 votes
2 answers
571 views

How to train a FCNN with Spectrogram images?

I'm working on a audio dereverberation deep learning model, based on the U-net architecture. The idea of my project came from image denoising with auto-encoders. I feed the reverberated spectrogram to ...
Lorenzoncina's user avatar
1 vote
1 answer
355 views

Scipy FFT and Numpy FFT disagree on pulse train spectrum?

I am doing an FFT on a series of pulses. The series is one pulse of amplitude 1 every 7 days over a total of 367 days. The code below is what I run: ...
MikeB2019x's user avatar
-1 votes
1 answer
115 views

Why is FFT module for smaller df showing uexpected malfunctioning in Python?

...
Subhadip Saha's user avatar
0 votes
0 answers
54 views

Inconsistency in DFT in Python

...
Subhadip Saha's user avatar
0 votes
1 answer
454 views

FFT of a Time series data

...
Subhadip Saha's user avatar
0 votes
0 answers
186 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 ...
Condor's user avatar
  • 1
0 votes
1 answer
37 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 ...
Abhigyan's user avatar
  • 103
-1 votes
2 answers
160 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 ...
chrismec's user avatar
1 vote
0 answers
260 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 ...
Jacob wood's user avatar
-1 votes
1 answer
83 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 ...
lima0's user avatar
  • 9
2 votes
2 answers
3k 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 ...
user1919542's user avatar
-1 votes
1 answer
282 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....
NeoChiri's user avatar
8 votes
3 answers
1k 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: ...
Tom Verbeure's user avatar
0 votes
1 answer
287 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 ...
opengisapprendice's user avatar
0 votes
1 answer
636 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 ...
prl900's user avatar
  • 103
0 votes
0 answers
159 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:...
Flovdis's user avatar
  • 101
1 vote
1 answer
458 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 ...
nlhnt's user avatar
  • 13
0 votes
1 answer
359 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, ...
minifigmaster125's user avatar
-1 votes
1 answer
911 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 ...
Vishnu CS's user avatar
0 votes
1 answer
244 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?
Adam Wilson's user avatar
2 votes
0 answers
204 views

fft formula convention

I try to code up an algorithm from a scientific paper where they solve a differential equation using Fourier transforms. In the paper, they use the FT convention $\rho(x_i) = \sum_{k=-m}^m r_k e^{i2\...
reloh100's user avatar
0 votes
1 answer
83 views

How to produce color image using edge detected images?

Hi I am trying to produce an image which is a combination of multiple images such as in focus stacking. Now I have 6 photos and I want to produce a final image such that the final image uses blocks of ...
user45676's user avatar
1 vote
0 answers
190 views

Why are low frequency peaks not sharp in scipy fft?

I am using numpy/scipy to plot graphs of sine waves. frequencies at 15 Hz or higher give nice, sharp peaks, but at lower frequencies, the peaks are smeared and the actual peak frequency can't be seen ...
azman's user avatar
  • 11
0 votes
1 answer
1k views

Signal processing using numpy python

To process a .wav audio file with numpy (using fast Fourier transform algorithm). I want to process an audio signal at a particular interval with a sampling frequency 44100hz and sampling rate of 20ms ...
user44806's user avatar
3 votes
1 answer
293 views

How to get an interpolation weight from a mathematical definition

It was recently explained to me that a "Nearest neighbor" kernel for 1D interpolation can be implemented like this using NumPy ...
Ralph's user avatar
  • 33
0 votes
0 answers
39 views

delayed result in sinc upsampled signal

I have implemented an infinite kernel sinc interpolation. For some signals I notice an artifact, visible at the right end of the plot. I am wondering: is it a bug in my code or a phenomenon usual for ...
Artur Pschybysz's user avatar
0 votes
0 answers
570 views

Is there any python code for applying a-law/mu-law on 3D numpy array?

I have 3D numpy array of probabilities between [0,1], I need to emphasize on some area with lower probabilities. I was suggested to apply a-law and mu-law. I am wondering if there is python library/...
S.EB's user avatar
  • 161
0 votes
1 answer
1k views

Extrapolate a 2D array using Fourier Transform

I need to extrapolate a given 2D array to a larger domain, keeping the spatial frequency. This is the original field: (the data file in numpy npz format and a Jupyter notebook to plot it can be found ...
Ohm's user avatar
  • 133
0 votes
1 answer
416 views

Choppy output when trying play through a callback buffer

I am trying to make a keyboard in python where every note's frequency is a ratio of the previous note but my output is strangely choppy for some reason. Here's an example of what I mean. I'm using ...
halbe's user avatar
  • 79
0 votes
1 answer
4k views

Autocorrelation: numpy versus FFT

I have a series a of values (0 and 1) coming from a Brownian process with drift for which I am studying the autocorrelation. I used two methods: 1) numpy autocorrelation: ...
simgh's user avatar
  • 1
1 vote
1 answer
232 views

OFDM Simulation process

I'm trying to understand OFDM by making a simulation. Are these steps correct? generate M random complex QAM symbols. example: (1+j,1-j,-1-j,1-j....) Split my M samples into a N 2048 sized arrays ...
Alexander Armen Berian's user avatar