Skip to main content

Questions tagged [scipy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
90 views

How do you properly cut out negative frequencies from FFT of a real signal if it reduces sample size?

If a real time signal has $N$ samples, then the magnitude of its FFT will also have $N$ samples--half of which will have positive frequencies and half of which will have negative frequencies. The ...
1 vote
2 answers
85 views

Debugging a Haar wavelet transform in the Fourier domain

I'm trying to get a minimum-viable prototype going for a project on sensor fault detection using a scale-zero Haar wavelet (frequency-domain locality is not important). After some Googling, I managed ...
0 votes
2 answers
89 views

Implementing a Butterworth low-pass filter in Python without knowing the order

I am relatively inexperienced with respect to lowpass filters, but I am trying to replicate parts of this paper, which deals with the processing of 3D accelerometer and 3D gyroscope data, both from ...
4 votes
2 answers
255 views

Inverse filtering to undo a convolution blows up

Essentially, I'm writing a paper in which I want a figure that shows the effect of convolving an arbitrary curve with a Gaussian. Then, I want to show that you can deconvolve it by taking the FFT of ...
1 vote
1 answer
110 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
1 answer
72 views

How do you filter a signal, split in batches, using an IIR filter?

I have a signal that is measured by an optical sensor that is connected to an ESP-32. I am trying to apply a band pass filter "in real time" on this microcontroller. The signal is comming in ...
1 vote
1 answer
20 views

convert ndarray with properties in Matlab

I am testing to call a Scipy function of Decimate from Matlab and get a ndarray from this function with structure as below ...
1 vote
1 answer
42 views

call decimate function from matlab

I tried to call decimate function in Scipy from Matlab but met an error. Can somebody point me in a direction, please? Here is a code of Matlab ...
0 votes
0 answers
30 views

How does padding two vectors for cross correlation affect result of time delay?

For example, i have two signals (x and y). If I zero pad both vectors at the end by length ...
0 votes
1 answer
48 views

Aligning/syncing one audio file to another using Python

I have 2 audio files recorded using laptop mic and one with external mic. Laptop mic recording starts after external mic. The time difference could be 2-60 seconds. So I wrote this code which is ...
1 vote
1 answer
30 views

Amplitude Modulation in Scipy Documentation on Hilbert transform

I was reading the documentation on the scipy.signal.hilbert and an example was given there to illustrate the principle. To make it easier to understand, I copied ...
1 vote
1 answer
50 views

Ignoring Negative Frequencies from FFT on Real Time Series Seems Inconsistent With Time Series

I ran an FFT on real financial monthly time series data. If I plot the FFT frequency domain output on the interval $[0, f_s)$, the dominant frequency pair peaks occur at $f_{A1}$ $\approx$ $0.02 \ ...
0 votes
1 answer
50 views

Binning and Frequency for FFT on Financial Time Series Data

I'm trying to analyze financial market time series data, so are there any particular concerns in using FFT for that kind of data? The data seems to be relatively covariance stationary. My sampling ...
1 vote
2 answers
10k views

How to normalize output of $\tt scipy.signal.correlate$

I have 2 different signals and I'm trying to cross-correlate then using Python 2.7 and scipy.signal.correlate. How do I normalize my results (such that the max ...
0 votes
1 answer
54 views

Unstable high-pass filter on mouse-generated signal

I am making a Desktop application using PyQT as the app is a Digital Filter You can add zeros and poles to a unit circle and apply the filter to the data the data can be of two types 1- saved data on ...
4 votes
1 answer
15k views

Write a 440 Hz Sine Wave to .wav-File using Python and SciPy [closed]

This is my first post on DSP.SE! I'm a student in Computer Sciences and am just getting started with Signals and Systems, thus getting in touch with discrete signals and analyzing them. I wanted to ...
2 votes
3 answers
634 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 ...
1 vote
2 answers
81 views

Unstable high-pass filter on mouse-generated signal using Python

I am practicing some DSP techniques along with desktop application development using Python and PyQt. In my filter design application, I am able to create a filter by placing zeros and poles on a unit ...
1 vote
0 answers
86 views

STFT normalization

In Scipy's implementation of STFT, an argument allows to scale the result as a spectrum or as a psd : ...
0 votes
1 answer
57 views

Welch method implementation not smooth

I have been trying to recreate the welch method implemented in scipy.signal by hand but my results don't look close enough in my opinion. How come the scipy.signal.welch method is displaying much ...
2 votes
1 answer
2k views

Help on audio filter with FFT on python

I need to take a .wav audio file that's noisy and filter out some noise. I have to do it using Fourier Transform. After some days researching and experimenting, I finally made a working function, the ...
1 vote
1 answer
134 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: ...
0 votes
2 answers
987 views

(Python - Scipy - Wave files) Can a float signal be written with values higher than 1?

While developing an application, I noticed strange behaviour while using scipy.io.wavfile to write audio files. The documentation says that floating-point data is written within a range between -1 and ...
1 vote
2 answers
253 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 ...
4 votes
2 answers
644 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 ...
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 ...
1 vote
1 answer
208 views

scipy/signal/_filter_design.py:1746: BadCoefficients: Badly conditioned filter coefficients

...
1 vote
2 answers
2k views

Rolling average in pandas using a Gaussian window

I want to estimate the rolling average of a time series B using a Gaussian window. The equation to do this would correspond to $$\tilde{B_{s}}(t_{n}) = \frac{1}{A_{s}} \sum_{t_{m}= t_{n}-3s}^{t_{n}+3s}...
2 votes
1 answer
1k 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 ...
5 votes
2 answers
828 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: ...
3 votes
2 answers
969 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 ...
1 vote
2 answers
1k 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 (<...
1 vote
1 answer
435 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 ...
0 votes
0 answers
135 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 ...
3 votes
2 answers
1k 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 ...
2 votes
2 answers
805 views

Why does changing the format of an audio file from int16 to float produce jitter?

I read an audio file (an instrumental music file that is mono and 16000) with wav.read (read function from scipy.io.wavfile.) This function gives me a data file in int16 format. When I change the type ...
4 votes
1 answer
489 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 ...
0 votes
0 answers
173 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:...
1 vote
1 answer
231 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 ...
0 votes
1 answer
534 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: ...
1 vote
2 answers
196 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 ...
3 votes
4 answers
11k views

downsample signal to a specific number of samples in Python

The Python Scipy library provides several functions to downsample signals, but they all have limitations: The resample function is based on Fourier method, which means it assumes periodic signals. ...
2 votes
1 answer
313 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 ...
0 votes
1 answer
525 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
0 answers
43 views

Convert MUSIC algorithm to EV

I write some code, but result looks very strange: ...
1 vote
0 answers
107 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: ...
0 votes
1 answer
65 views

Why is DFT magnitude less than expected?

Code for signal: ...
2 votes
1 answer
296 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: ...
0 votes
1 answer
347 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 ...
0 votes
0 answers
397 views

Jerk detection in accelerometer data

I want to detect jerk from accelerator data i.e. values beyond 1.57 m/s^2, but due to the high frequency nature of the sensor (400 values per second), it gives multiple jerks instead of one. How can I ...

1
2 3 4 5