Questions tagged [scipy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
28 views

Are scipy second-order Gaussian derivatives correct?

For an edge detection algorithm, I need to compute second-order derivatives of an image, and I do this with use of Gaussian derivatives. I assumed that the ...
2
votes
3answers
72 views

scipy.signal.spectrogram() - how to handle gaps in the timeseries data

Looking at the magnitude of variable stars - the dataset is from here: https://dogwood.physics.mcmaster.ca/Cepheid/URL/MW/BD-10d4669.html The magnitude plot: ...
0
votes
1answer
28 views

scipy.signal.spectrogram() with noverlap=nperseg-1, what are the possible side-effects?

I'm using a simulated data set which can be downloaded from the link in the fist paragraph on this page (it's an Excel file): https://www.analyticbridge.datasciencecentral.com/forum/topics/challenge-...
0
votes
1answer
33 views

scipy.signal.stft temporal resolution

Using the STFT function from scipy.signal has produced unexpected results for me. I am performing an STFT on 10 seconds of data, sampled at 25,000 Hz. I am using STFT settings of nperseg=256 and ...
1
vote
1answer
51 views

scipy cross-correlation: interpretation

I want to compute the phase shift between two 1-D signals of same frequency, but before I'm trying to compute the time shift between. The cross-correlation function seems to be ideal for that but I'm ...
2
votes
1answer
44 views

Deconvolution with Python in real life

I have measured a signal which is convolved with the profile of the measuring apparatus. Now I want to remove this contribution to get the "real" signal. I am trying to do this with Python. ...
0
votes
1answer
32 views

narrow band filtering of a signal that is sampled at high frequency

I have a signal that is sampled at 2KHz. The frequency band of interest is from 1/60 Hz to 1 Hz, and I want the final signal to be downsampled to 10 Hz. What is the best way to do this? I read that ...
2
votes
2answers
95 views

Invertible low-pass (Butterworth) filter in python (scipy)?

Question Is there an invertible low-pass filter built into scipy.signal (or other python package)? If so, what is it? If not, why not (is there something ...
2
votes
1answer
29 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
54 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
75 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
29 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
89 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: ...
2
votes
1answer
58 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
47 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
51 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
28 views

Periodogram/PSD from FFT amplitude

I have performed a STFT for signals and obtained the amplitude through ...
0
votes
0answers
115 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
20 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
320 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
63 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
130 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
35 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
404 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
102 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
54 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
123 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
72 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})}...
1
vote
0answers
45 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
64 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
94 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
67 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
42 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
265 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
34 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 ...
2
votes
1answer
412 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-...
1
vote
1answer
86 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
618 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
173 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
291 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
438 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
107 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
288 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 ...
-1
votes
1answer
65 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 ...
3
votes
2answers
741 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
79 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
115 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
102 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
311 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 ...