Questions tagged [numpy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
18 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 ...
user avatar
  • 11
15 votes
4 answers
2k 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 ...
user avatar
  • 151
0 votes
1 answer
31 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 ...
user avatar
0 votes
0 answers
49 views

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

...
user avatar
0 votes
0 answers
50 views

How to take amplitude and frequency from the power spectral density?

I try to take the amplitude and the frequency from the power spectral density. So I make a time series with a 5 component waves, then I draw the PSD with the welch method. Now I need to take the ...
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 ...
user avatar
0 votes
0 answers
13 views

Getting the detail coefficients as feature vectors

I am trying to get feature vectors from the coefficients I have generated. The spectra are decomposed using 8 levels and I am only choosing the coefficients of ...
user avatar
1 vote
1 answer
70 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 ...
user avatar
0 votes
0 answers
85 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. ...
user avatar
1 vote
1 answer
61 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 ...
user avatar
0 votes
1 answer
90 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 autoencoders. I feed the reverbered spectrogram to ...
user avatar
1 vote
1 answer
146 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: ...
user avatar
0 votes
0 answers
39 views

FFT filtering by hand in python - iffy issue - cannot get filtering right

I am trying to filter an image by hand (with no using the image processing libraries) to understand how fft.shift works in python. No luck. I take a png an image from MNIST, e.g.. Here is the code: <...
user avatar
0 votes
0 answers
15 views

How to use numpy covariance result to get a correction factor and make my second signal to exactly overlap on my first signal?

covariance = np.cov(y1_interp, y2_interp)[0][1] print('covariance is', covariance) covariance is 0.00010861874695023591 This number shows how different my signal 2 ...
user avatar
0 votes
1 answer
96 views

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

...
user avatar
0 votes
0 answers
40 views

Inconsistency in DFT in Python

...
user avatar
0 votes
1 answer
126 views

FFT of a Time series data

...
user avatar
0 votes
0 answers
53 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 ...
user avatar
  • 1
0 votes
1 answer
35 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 ...
user avatar
  • 103
-1 votes
2 answers
111 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 ...
user avatar
1 vote
0 answers
117 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 ...
user avatar
-1 votes
1 answer
62 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 ...
user avatar
  • 9
2 votes
2 answers
1k 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 ...
user avatar
-1 votes
1 answer
172 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....
user avatar
8 votes
2 answers
811 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: ...
user avatar
0 votes
1 answer
177 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 ...
user avatar
0 votes
1 answer
414 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 ...
user avatar
  • 103
0 votes
0 answers
78 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:...
user avatar
  • 101
1 vote
1 answer
221 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 ...
user avatar
  • 13
0 votes
1 answer
191 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, ...
user avatar
-1 votes
1 answer
567 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 ...
user avatar
0 votes
1 answer
114 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?
user avatar
  • 101
2 votes
0 answers
94 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\...
user avatar
0 votes
1 answer
49 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 ...
user avatar
1 vote
0 answers
129 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 ...
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 ...
user avatar
2 votes
1 answer
184 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 ...
user avatar
  • 23
0 votes
0 answers
30 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 ...
user avatar
0 votes
0 answers
461 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/...
user avatar
  • 141
0 votes
1 answer
903 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 ...
user avatar
  • 133
0 votes
1 answer
299 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 ...
user avatar
  • 79
0 votes
1 answer
3k 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: ...
user avatar
  • 1
1 vote
1 answer
172 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 ...
user avatar
1 vote
1 answer
8k views

Image processing based on wavelet transform in python [closed]

I take the dwt2 for an image and saved it's coefficients (LL,Lh, hl,hh) using pywt.dwt2 (image,'haar'),in my project I have to change them to uint8 but when I change their types and reconstruct the ...
user avatar
1 vote
1 answer
735 views

Fast Fourier Transform using numpy

I am a computer science student and didn't really have signal processing as a subject. Maybe I should be clear on the concepts of sampling rate and frequency of the signal but I am a little confused. ...
user avatar
  • 23
0 votes
3 answers
459 views

Shifting signal smaller than discrete step

I have a image that I need to shift with less than a pixel. My plan was to do a Fourier transform and multiply the signal with $e^{-aiu-biv}$ where $a, b$ are the shifts in x and y direction. This ...
user avatar
1 vote
0 answers
2k views

Acceleration time series to velocity conversion using DFTs

I have 1000 Hz time series data for acceleration (512 data points), which I want to convert to velocity. I am trying to use the omega arithmetic method to achieve this. Following are the steps I am ...
user avatar
1 vote
1 answer
3k views

Discrete Fourier transform of an exponential decay

I have a vector with an exponential decay, using Numpy: t=np.arange(128) k=0.1 decay=np.exp(-k*t) I would like to compute the discrete Fourier transform (DFT) of ...
user avatar
  • 121
2 votes
1 answer
4k views

Amplitude of frequency bin in FFT doesn't match time-domain amplitude

I have a sinusoidal current that I am sampling at about 357k SPS. The current signal is about 3A pk-pk @ 750hz (top figure). I am wondering why when I take the fft using numpy/scipy's fft function, ...
user avatar
  • 155
2 votes
1 answer
5k views

Numpy fft2 frequency shift

I don't understand how to make frequency shift in fft2 or higher dimensions. Could anyone explain it, please? import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import ...
user avatar