Questions tagged [scipy]
The scipy tag has no usage guidance.
194
questions
4
votes
2
answers
522
views
Why doesn't the convolution of the impulse response match the system's output?
If you define an LTI system sys in scipy, you may conveniently feed an input x to it to get ...
1
vote
1
answer
2k
views
Can someone explain why signal.freqz() generates a different phase in the frequency fresponse than scipy.signal.dfreqresp()?
I have been using scipy to analyze filter performance for a single-pole IIR filter, and I noticed a disagreement between the phase in the outputs of the freqz() function compared to the output of the ...
0
votes
0
answers
71
views
Issues on EEG PSD feature extraction using signal.welch
I am new to EEG signal processing and I am having some issues on calculating PSD using scipy.signal.welch. I am trying to implement a function to extract PSD features. The input of this function is a ...
0
votes
1
answer
323
views
How to select parameters suitable parameters for a spectrogram
I have a limited background in DSP but I need to generate a spectrogram of an electrocardiography (ECG). I am using the scipy.signal.spectrogram and I need to set ...
6
votes
3
answers
1k
views
Role of window length and overlap in uncertainty principle?
I am trying to predict epilepsy using spectrograms and a convolutional neural network.
So far I have achieved a validation accuracy of 86% which i feel like is pretty good. Lots of the papers doing ...
1
vote
1
answer
366
views
Measure Frequency-Response of Sensor using a Signalsource and Reference-Sensor
Cheers, I want to measure the frequency response of an acceleration sensor.
I have:
A signal source (device similar to a loudspeaker that shakes the acceleration sensor), of which I do NOT know the ...
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:
...
0
votes
0
answers
135
views
How to design function for Random Decrement technique in python and implement the function?
I was looking into a technique called Random decrement technique from the following links/articles:
How can I use Random Decrement Method to convert a non-stationary
signal into a decay function ...
0
votes
1
answer
268
views
spectrogram of a (strongly) downsampled file
I downsampled an audio file to a very low sampling rate, 48hz.
This is because I stored some information in the file, that are not really audio information but the audio format was convenient to use.
...
1
vote
1
answer
435
views
IIR design: SciPy CMSIS-DSP coefficient format
How do you reconcile Scipy.signal's IIR design with CMSIS-DISP's API? Scipy.signal outputs in one of 3 forms:
Numerator/denominator
Pole Zero
Second-Order-Sections.
CMSIS requires an array of length ...
0
votes
2
answers
245
views
Find the equivalent of this python remez specs in C++ remez or Matlab firpm
I want to start with that I am quite new in this community, so if this question does not belong here, please point me to the right place. Thank you!
Background
I am learning and writing a half-band ...
2
votes
0
answers
156
views
Help with setting up transfer function correct format
I have a transfer function as:
H(s) = R / (sRC + 1)
V is the output and I is the input so we can write:
V(s) = I(s)*H(s)
Now the thing is that, I want to obtain I(t) for the given V(t). So I write:
I(...
0
votes
1
answer
685
views
Evaluate filter matlab function on scipy
I want to reproduce the result given by filter() MATLAB function using scipy.signal functions. The result is not consistent:
Matlab example:
...
-1
votes
1
answer
1k
views
How to specify parameters in scipy.stft to reproduce published analysis
I am starting a project on this Keggle dataset containing EEG registrations (sampled at 128 Hz) of several subjects. What I am really interested in is the final ...
1
vote
0
answers
498
views
Unexpected results of deconvolution with scipy.deconvolve
Below I have plotted the signal (Lifetime decay) I am trying to deconvolve from a known impulse response function (IRF), as well as the IRF itself. I'm using scipy.signal.deconvolve.
Please note for ...
1
vote
1
answer
5k
views
How to calculate the envelope of a complex signal using python [closed]
I used the scipy hilbert function to calculate the envelope of my signal. The problem is that the signal is complex, so it throws an error when I use Hilbert function. I tried to just use the real ...
2
votes
2
answers
2k
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
3
answers
2k
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
1
answer
2k
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-...
-1
votes
1
answer
277
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
1
answer
2k
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 ...
3
votes
1
answer
3k
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
1
answer
242
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
2
answers
929
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 ...
3
votes
2
answers
291
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
1
answer
78
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
1
answer
2k
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
1
answer
125
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
1
answer
1k
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
1
answer
335
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
1
answer
182
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
0
answers
910
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
0
answers
169
views
Periodogram/PSD from FFT amplitude
I have performed a STFT for signals and obtained the amplitude through
...
0
votes
0
answers
833
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 ...
4
votes
1
answer
5k
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 ...
1
vote
2
answers
832
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
1
answer
806
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, ...
2
votes
2
answers
394
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
1
answer
75
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
2
answers
3k
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 ...
-1
votes
1
answer
227
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 ...
3
votes
1
answer
594
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 ...
1
vote
0
answers
163
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....
5
votes
2
answers
433
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 ...
1
vote
1
answer
369
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
1
answer
121
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 ...
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 ...
2
votes
1
answer
2k
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
1
answer
876
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:
...
3
votes
3
answers
3k
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 in these two libraries are quite different:
In scipy.signal.stft, the stft result is ...