Tag Info

New answers tagged python

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

Use phase from the start, and do not just multiply by time t - this is vital For each sine wave, use a variable to hold the current phase. Then for each time step, multiply ...
• 291

FFT of a gaussian signal in Python

There are two issues: The time axis is not long enough to capture a sufficient length of the Gaussian. The FFT is not properly scaled. For the first item mentioned regarding the time axis, the ...
• 36.1k

Why is this Python implementation of trigonometric interpolation not working properly?

I strongly suggest using the Dirichlet interpolation. The basic idea is the interpolation via the Fourier transform: $$f(x)=\sum_k \hat{f}(k)e^{ikx}$$ Here is an implementation for arbitrary chosen ...
1 vote

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

One solution I see is to concatenate the two, different amplitude sines at their zero crossings, making sure they have the same phase (e.g. if one goes up, the other has to go up, too). This way, the ...
• 1,393

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

A simple solution is to implement the waveform in phase versus time instead of frequency versus time which can then facilitate phase continuous transitions. Frequency is the time derivative of phase, ...
• 36.1k

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

IMO the best way to implement this is a rotating phasor. Recall that $$e^{jx} = \cos(x) + j \cdot \sin(x)$$ and $$e^{j\omega(n+1) } = e^{j\omega n } e^{j\omega}$$ That means we can calculate the a ...
• 30.6k

Simulation of Lock-In Amplification in Python makes no sense

Ok, the problems seems to be that I need to first low-pass filter both the d and q components separately before applying the norm operation, here is the corrected code: ...

Order analysis on sample vibration data to detect unbalance in python

I think you are doing basically right, you can selectively add two more steps: (1) Check max order for a new sampling rate in order domain, make sure you avoid aliasing. (2) Add some flexibility to up-...
• 11

Can the deconvolution Wiener filter reduce noise without having a blurred image?

Can a deconvolution Wiener filter reduce noise without blurring? Maybe. Maybe not. There is not one Wiener filter. Any concrete "Wiener filter" is a plain old filter that has been ...
• 8,071

Are there any order analysis functions in Python?

I am not sure if you can find an implementation to those functions (you might do if you will look long enough). Main point, each of those functions might be implemented in several lines so there is no ...
Accepted

Can the deconvolution Wiener filter reduce noise without having a blurred image?

For Salt and Pepper noise on medical or real world images using the Wiener Filter isn't recommended. The Wiener filter basically takes advantage only on the knowledge from the spectrum of the data. ...
• 39.1k

Python vs Matlab? Which one better for image processing?

MATLAB's Image Processing toolbox is much richer than what you'd find on Python except OpenCV. OpenCV on Python doesn't feel natural yet still give you access to basically the largest library of image ...
• 345

Python vs Matlab? Which one better for image processing?

I have spent the first 20 years of my career working extensively in MATLAB for signal processing applications. Six years ago I gravitated over to Python out of curiosity and it has since completely ...
• 36.1k
1 vote
Accepted

Butterworth filter cutoff attenuation is not exactly 0.707(-3dB)

Filter needs time to settle down. This settling process altered the beginning of time domain data and created the small difference. I took the second half of time domain filtered data and got a ratio ...
• 11
1 vote

Butterworth filter cutoff attenuation is not exactly 0.707(-3dB)

What you see there are margin issues. By not applying a window function to your signal before the FFT, you effectively convolute your spectrum with an $\text{si}$ function, which leads to artifacts ...
• 1,619
1 vote

How to achieve a periodized Mexican hat wavelet with period L by using Python?

This is quite straight forward, if you use Python's numpy library. It is capable of array operations and thus, this task is just a few lines. ...
• 1,619
1 vote
Accepted

A scaling difference between MATLAB's pwelch and Python's SciPy welch

MATLAB's function pwelch scales the PSD under the assumption that the DFT is executed across the range of $0:2 \pi$ in the event the sample frequency is not passed to the function. Thus, you have ...
• 26

Top 50 recent answers are included