Questions tagged [scipy]

The tag has no usage guidance.

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

Getting error while performing upsampling of an audio signal processing using low pass filter in python

I want to perform upsampling of an audio signal introducing zeros between samples to create a longer signal with factor of N=2. The sampling rate is 44100Hz, time = 5sec. ...
0
votes
1answer
49 views

Apply FFT to positive spiky signal

I have a signal that looks like this It has regularly occurring peaks 50 units apart, and offset from 0 by approximately 20. I thought I could apply the DTFT to this signal and extract the period (...
1
vote
1answer
52 views

Compare two Fourier transforms of two signals by calculating the coherence

My overall aim is to compare the edges of two images by comparing their Fourier Transforms (FFT) and to calculate one number as a key performance indicator that describes how much they are similar to ...
0
votes
1answer
26 views

Problem wih (diverging?) digital IIR filter for an online acquisition system

I am trying to plot windows of acquired data from an LSL-compatible system. For the example below, let's consider 1-second window of a 64 channel EEG system. In practice, I use shorter 0.2-window, but ...
0
votes
1answer
27 views

How to correctly set the zi parameter (initial condition) for a scipy IIR filter

Let's take as an example an IIR filter using the 'sos' output, as this is what I use the most. To apply a bandpass filter, you can do: ...
1
vote
1answer
29 views

Difference between MATLAB zp2sos and python zpk2sos functions

I am trying to port some code from MATLAB to python. The goal is to use Butterworth filter (4th order, bandpass) API and convert it to second-order sections. I get the same output between MATLAB and ...
0
votes
1answer
41 views

Obtaining real numbers from FFT with same length as original signal

In this article the real valued time domain signal is transformed to the frequency domain to extract some features like mean or variance. But after transform to the frequency domain I calculate ...
0
votes
0answers
25 views

Trying to implement matlab pwelch function in python using scipy welch

I am trying to port the statistics toolbox function pwelch from matlab into python, but when I am trying to implement it using scipy.signals.welch, it does not return the same results as it does in ...
0
votes
0answers
27 views

Periodogram/PSD from FFT amplitude

I have performed a STFT for signals and obtained the amplitude through ...
0
votes
0answers
66 views

Boundary effects with scipy.fftconvolve after convolution

I am having some numerical error in my code that propagates continuously, and has to do with the implementation of convolutions in Python; this is kind of struggling my progress and I would really ...
0
votes
0answers
17 views

Using Scipy.correlate2d output matrix to determine best image match

I'm struggling to wrap my head around how I can use the output of a correlation matrix to determine if my image is present. If I am trying to match characters, how can I compare the outputs of these ...
2
votes
1answer
107 views

Scalograms in python

I am reading this paper to learning basic concepts of dsp and I want to reproduce the following scalogram of a test signal (fig 4.2 of the paper): It has been produced from the discretization of the ...
0
votes
2answers
49 views

Designing digital low pass filter with low pass-band group delay

I'm interested in specifying a digital low pass filter with low (and near constant) pass band group delay. I tried python's spicy.signal.minimum_phase to transform ...
1
vote
1answer
78 views

Memory efficient filtering with scipy.signal in Python

I have several EEG channels that need filtering, and one channel may reach a recording length of 12 hours or potentially even more. This results in billions of data points stored which, when loaded, ...
0
votes
1answer
32 views

Is there an a method to fit a wave created from two wave?

I need to get the frequency and amplitude for a wave that consists of multiple function. for example, if I have a sine curve (created from two sine waves), How can I extract the parameters for this ...
0
votes
1answer
19 views

What is the function of init in Active Contour Model

In practice of image processing using scikit-image, I didn't understand the role of constructing init numpy array in Active Contour Model example. Is it the red section drawn in the example astronaut ...
1
vote
2answers
181 views

How to apply an anti-aliasing filter before downsampling

I have an eeg signal with two channels (f3m2 and f4m1) which is divided into epochs. I want to augment the data by taking every 5th sample. I can re-use the discarded samples to create 5 versions of ...
0
votes
0answers
67 views

Find corresponding wavenumber from FFT - Python

I have a set of data taken from a high speed camera. I've done some image processing which results in getting a pixel location at each frame. This oscillates with time and so I have performed an FFT ...
0
votes
1answer
44 views

Why use both a high pass and a low pass filter in a Butterworth implementation for noise reduction?

I am a new to audio processing . I want to develop an application that reduces audio noise using a Butterworth filter. I found some existing code doing this, but I still do not understand the use of ...
2
votes
1answer
103 views

Compute minimum phase version of a FIR

I am working with HRIR filters, in particular I am trying to interpolate them. One commod method in the literature to perform interpolation of HRIR is to use the minimum-phase decomposition and ...
0
votes
0answers
13 views

refractive index KK relation

I make Kramers Kroing relation(KK relation) with scipy.integrate.quad to change $\kappa(w)$ into $n(w)$. Their KK relation is $n(w) = 1 + \frac{1}{\pi}\int_{-\infty}^{\infty} \frac{\kappa(w^{\prime})}...
0
votes
0answers
34 views

Interpreting scipy spectrum from audio signal

I have recorded some audio and would like to obtain a spectrum from it. As the audio is a real valued signal, I figure that I could perform a FFT with some window and obtain a spectrum for that period....
4
votes
2answers
48 views

Why is FFT-based convolution efficient only for signals of large size?

According to the documentation of scipy.signal.fftconvolve This is generally much faster than convolve for large arrays (n > ~500), but can be slower when only ...
0
votes
0answers
63 views

The difference between tensorflow stft and scipy stft

I'm trying to wrap my head around stft, and checking the docs, tf.signal.stft and ...
1
vote
1answer
55 views

trying to reproduce the behavior of initial conditions for the filter delays of scipy lfilter with R

I'm trying to reproduce the behavior of lfilter and lfilter_zi (from scipy) in R (using signal package if possible). This is the example provided by ...
0
votes
1answer
39 views

Filter design for an unusual EEG experiment

I'm designing a quite unusual (in terms of signal analysis) EEG experiment, which forces me to design my own filter. I have never done this before, so kindly please check my work and suggest ...
1
vote
2answers
110 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 ...
0
votes
0answers
29 views

Why the inverse discrete fourier transform of the Ricker pulse isn't the same as the Ricker pulse in time domain?

Question I'm trying to use Python's scipy library to compute the IDFT of the Ricker wavelet function and compare it with the analytical time-domain version of the same function. When I compare the ...
1
vote
1answer
165 views

Dynamic filter in real time audio

Following my previous question: Removing cracking in real time audio, I'm trying to implement a dynamic filter in real time audio. What I want to do is to create a filter where I can change the cut-...
0
votes
1answer
52 views

Strange behavior from frequency to angular frequency in FFT

I have written a code to compute the Fast Fourier Transform of a simple complex exponential with frequency $f=50.0$, using scipy.fft. The code is written below: ...
1
vote
2answers
472 views

Difference between librosa.stft and scipy.signal.stft

I read the source code of librosa.stft and sicpy.signal.stft, and notice that the calculation results of STFT(short-time fourier transform) in these two libraries are quite different: In scipy.signal....
0
votes
2answers
125 views

Scipy Butterworth highpass filter results in distortion and bloated output

Trying to use Scipy Butterworth filter to filter frequencies below 54 Hz from audio files. Audio files are stored as WAVs. Sample rate is 44100. When I try using this filter the result is distorted (...
0
votes
2answers
207 views

Scipy fourier transform zero frequency spike (from DC offset) - de-meaning and hanning window have no effect

I am trying to plot the FFT of essentially a random signal that has a non-zero mean shown below. The FFT of the signal is peaked over the zero frequency which usually indicates a DC offset. Although ...
1
vote
3answers
277 views

How to practically correct for group delay imposed by a digital filter (Python)

I'm using Python to filter a signal using a Butterworth filter (scipy.signal.butter) and subsequently passing this through a forward-backward filter with cascaded second order sections (scipy.signal....
1
vote
1answer
90 views

Ripple in a SciPy Butterworth SOS Filter

I have a script using SciPy for checking the RMS of various Butterworth Bandpass Filters of varying orders. I would expect the RMS values to increase and decrease linearly and consistently as you get ...
1
vote
1answer
198 views

CWT at low scales: PyWavelets vs Scipy

Low scales are arguably the most challenging to implement due to limitations in discretized representations. Detailed comparison here; the principal difference is in how the two handle wavelets at ...
0
votes
1answer
55 views

How to calculate PSD if i have power vs freq spectrum?

i have a signal something like this how to calculate PSD? i have freq from 191000200 to 196500000 time gap or delta t = 1 or 2 sec, (what i mean is [tn] - [tn-1]) i will be computing in python any ...
0
votes
0answers
26 views

Python, Is there a way to find the properties of a subregion within a larger image region?

The goal: I have images with particles that I need to find the area of. Each particle also has four to five sub-regions that I need to know the area of. Think of a bunch of stripped shirts in a ...
3
votes
2answers
606 views

Are IIR filters (and specifically Butterworth filter) causal?

I am new to signal processing. I am learning now about filtering and I am trying to implement high pass filter (HPF),and later band-pass filter (BPF). I implement the filters in ...
2
votes
0answers
72 views

Filtering a square signal with a median filtering to preserve the edges

If needed, you can find my first post for this problem here. I am trying to clean the following signal: As proposed in the comment, I tried to use this post proposing 2 methods: median filtering and ...
1
vote
1answer
81 views

How do I set window length and shift length for computing STFT on Scipy?

Does nperseg=32, noverlap=16 mean the window length is 32mS with a shift of 16mS? Refer here for more details
0
votes
1answer
55 views

Showing specific values in an STFT plot

I have a short term fourier transform plot that I plot using matplotlib's pcolormesh() function: If I zoom in the plot, I see this: Now, I want the plot to just ...
0
votes
2answers
248 views

Complex Samples (IQ) - Baseband Filtering

We are currently analyzing a large set of IQ samples in a desktop application and we are interested in implementing many different bandpass filters dynamically. We realized, that working with scipy ...
3
votes
0answers
30 views

Are there any tools for generating fixed point filter implementations?

It's very easy to make a filter in Scipy or many other tools, but implementing this filter in fixed point in C or VHDL/Verilog is always a chore. I mean, in theory it's just a matter of adequately ...
0
votes
1answer
192 views

Difference between freqz vs freqresp in scipy?

I'm always confused that scipy has scipy.signal.freqz, but also scipy.signal.lti.freqresp / ...
1
vote
2answers
215 views

Hilbert transform with scipy.signal

I'm coding with python and I just started to use the Hilbert transform from scipy.signal. Consequently, to check the result I got I tried to verify a property of ...
0
votes
0answers
52 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:...
0
votes
0answers
63 views

Lowpass Butterworth filter equation

I am using a 5th order lowpass Butterworth filter with a varying cutoff frequency, $f_c$, to smoothen some data coming from a spectrometer. An example of a spectrum, plotted with the filtered data, ...
0
votes
1answer
68 views

How to Save FFT output for fast read-in?

For a project, I'm reading in hundreds of short (4 sec) wavefiles and giving them to scipy fft for the frequency information for further processing/experimenting in various ways. Problem is, I want to ...
1
vote
1answer
502 views

Why is the number of frequencies decomposed in scipy.signal.stft() equal to the hop size?

I asked this over on StackOverflow first but figured you fine people might know more about signal processing (duh). I'm trying to calculate the spectrogram of an audio file in python. There's a nice ...