# Questions tagged [scipy]

The tag has no usage guidance.

192 questions
Filter by
Sorted by
Tagged with
1 vote
58 views

### reproduce Scipy's stft

I failed to reproduce Scipy's stft. When I have tried to remove all the possible modifications and go the minimal example, I converge to the following: ...
62 views

### Numerical issues in scipy's Savitzky Golay filter coefficients for large polynomial order

Consider the design of a Savitzky-Golay filter of window length 101 and (high) polynomial order 20. Using scipy version 1.10.1, the filter coefficients can be obtained in python as: ...
1 vote
115 views

### How to construct a bandpass filter with minimal loss in amplitude/power near the lower and upper frequency limit in Python?

I am analyzing functional MRI data with a sampling rate of 1 second (1 Hz). The frequency band that I am interested in is 0.01-0.2 Hz. Regarding measurements, I am interested in computing (1) the ...
1 vote
74 views

...
886 views

### Why does scipy introduce its own convention for H(z) coefficients?

Conventionally, the definition of the system function for a IIR digital system is: $$H(z)=\frac{b_{0}+b_{1}z^{-1}+b_{2}z^{-2}+\cdots}{1-a_{1}z^{-1}-a_{2}z^{-2}-\cdots}$$ where coefficients are the ...
596 views

### Why is implementing a digital LPF with low cutoff frequency but high sampling frequency infeasible?

I am new to signal processing and I want to implement an LPF using SciPy. In order to do so, I used the following python code from: here The code itself looks like: ...
1 vote
146 views

### Filtering with scipy sosfiltfilt generates flat edge artifact

I need to filter some array of data before differentiating it, I do this so I don't drown the signal in noise. It's also important that no delay is applied to the signal, that's why I decided to use a ...
64 views

### Initial conditions of backward filter for forward-backward filtering on chunked real data in python

I have to apply a downsampling filter on a realtime data stream (signal) and I want to do it in python. The data is sampled at 16 kHz and loaded in a loop in chunks of 1 second. I have to downsample ...
446 views

### Scipy and Matlab Spectrogram not matching

I am trying to replicate a spectrogram from MATLAB in Python. I've read other posts but they either don't use complex data or the data doesn't match between languages. I've defined my FFT length (<...
347 views

### Scipy filter analog vs. digital

It would be greatly appreciated if the usage of the python package scipy's filter (e.g. butter) analog=True argument could be explained. I don't understand what is meant by this (any signal being ...
1 vote
99 views

### using scipy.signal.sosfilt to filter a stereo signal with zi, zf

I'm stuck trying to filter a two-channel signal using sosfilt() with the zi initial state. I need to use the zi parameter so I can carry the filter state over ...
484 views

### Amplitude extraction using STFT

I'm trying to recover amplitude/magnitude from an audio stream. I'm using FFT to go from time domain to frequency. If I feed in a signal of known amplitude, the results I get from either windowing or ...
204 views

### python how to demodulate iq fm signal that was moved to 0 frequency

I am struggling with implementing FM demodulation for IQ samples that has 0 center frequency from RTL-SDR ... I have found the following algorithm for FM demodulation, see FM demodulation: ...
14 views

### Extract PVC feature from singal to train the ML model with PVC characteristics

I have ML model which is trained on Afib, Normal, Other - 3 class. Currently when I am testing the model with unseen database, sometimes it identify PVC singals as Afib class. For example - enter ...
1 vote
120 views

### Possible error when finding group/phase delay in scipy

After designing a "least square optimal" FIR filter I wanted to find the group/phase delay, defined as: $P(\omega) \triangleq - \frac{\Theta(\omega)}{\omega}$ (Depending on the literature ...
155 views

### find out ideal window size for coherence analysis - python

Is there a general formula I could use to calculate the ideal window for the window argument in the function ...
228 views

### Signal Reconstruction Using Scipy.signal.cwt

Can someone explain to me how I can reconstruct a signal using the scipy.signal.morlet2? The codes in the link only allows one to do a fourier transform using the morlet wavelet, but there is no such ...
1 vote
37 views

### Convert MUSIC algorithm to EV

I write some code, but result looks very strange: ...
1 vote
80 views

### Prony method doesn't work

I have used the code from: https://github.com/quantumlib/OpenFermion/blob/v1.5.1/src/openfermion/linalg/wave_fitting.py#L41-L76 try using with my signal: ...
63 views

### Why is DFT magnitude less than expected?

Code for signal: ...
175 views

### scipy convolve and fftconvolve return different output [closed]

I'm writing an autocorrelation function using and I noticed a difference between fftconvolve and convolve that should use fft if it's faster. This is my function with convolve: ...
212 views

### Vectorizing a biquad filter (python / numpy)

I'm having a lot of fun writing signal processing code in Python / numpy, and I'm resisting the urge to pre-optimize the code. But my biquad implementation is slower than I want. Here's the inner ...
381 views

### How to convert between 2d convolution and 2d cross-correlation?

I am using cross-correlation for the purposes of image stabilisation. The images which I'm processing can sometimes be rather large. The contents of the image are often repeating patterns. For these ...
1 vote
343 views

### detrend a signal with break point but without jumps

Yesterday I asked a question and got the answer to detrend my time series which I think is really better than applying a highpass filter. So I read the description of scipy.signal.detrend and there I ...
841 views

### filtering EEG data with scipy.signal

I have EEG data recorded with a sampling rate of 256 Hz. Each recording contains 19 EEG channels. Other channels (like ECG data) are ignored. The recordings of 10 patients are 20 minutes long each, ...
1 vote
642 views

### How to generate a first order Gauss-Markov process in Python

I would like to synthesize a first order Gauss-Markov process from a white Gaussian noise. I know from signal processing theory that it could be realized using a noise shaping filter designed properly ...
336 views

### How to get scipy remez to give matlab firpm answer?

If I run this in matlab: h = firpm(100,[0 0.1 0.2 1],[0 0 1 1]) and this in scipy: h = remez(100,[0, 0.05, 0.1, 0.5],[0, 1]) I ...
1 vote
995 views