Questions tagged [scipy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
710 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 (...
PartialOrder's user avatar
0 votes
2 answers
918 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 ...
CBurton's user avatar
1 vote
3 answers
2k 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....
Cazador's user avatar
  • 13
1 vote
1 answer
461 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 ...
Beefy_Swain's user avatar
1 vote
1 answer
1k 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 ...
OverLordGoldDragon's user avatar
-1 votes
1 answer
106 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 ...
LTpy's user avatar
  • 1
4 votes
2 answers
2k 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 ...
Triceratops's user avatar
2 votes
0 answers
441 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 ...
Mathieu's user avatar
  • 191
1 vote
1 answer
711 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
Banasudhi's user avatar
0 votes
1 answer
552 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 ...
Mustafa's user avatar
0 votes
2 answers
1k 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 ...
Tiaro's user avatar
  • 3
3 votes
0 answers
53 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 ...
Pepijn's user avatar
  • 248
0 votes
1 answer
903 views

Difference between freqz vs freqresp in scipy?

I'm always confused that scipy has scipy.signal.freqz, but also scipy.signal.lti.freqresp / ...
bluenote10's user avatar
1 vote
2 answers
1k 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 ...
Rhecsu's user avatar
  • 35
0 votes
0 answers
159 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:...
Flovdis's user avatar
  • 101
0 votes
0 answers
108 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, ...
Sara's user avatar
  • 1
0 votes
1 answer
213 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 ...
biathlonc's user avatar
1 vote
1 answer
2k 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 ...
Mossmyr's user avatar
  • 113
2 votes
2 answers
948 views

Decimating Non-Uniform large time-series data

I'm working with accelerometer data that is sampled at a non-uniform rate. There are major gaps in the data. Below is a scatter plot of the data I can also give a sense of the frquencies at which ...
neezi's user avatar
  • 21
1 vote
0 answers
39 views

SciPy - Distinguish between two group of periodic samples [closed]

First of all, I'm sorry for my bad English writing, plus, I'm new to DSP. Background We have got motion data of 20 cows. 10 cows are healthy and 10 cows are slightly lame. Lameness is an abnormal ...
Fadavi's user avatar
  • 11
2 votes
2 answers
453 views

Why is my signal attenuated after applying a HighPass-filter?

I am new to DSP, but I've been attempting apply a butterworth high-pass filter on a 1D array (Values peeking at 300~) to eliminate any noise, yet when applying a high pass filter, I'm ending up with ...
CalEl's user avatar
  • 41
3 votes
4 answers
10k 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. ...
chaohuang's user avatar
  • 1,079
1 vote
0 answers
237 views

Is there a way to get output in second order sections (SOS) format from Scipy's signal.firwin

I am using Scipy's signal.firwin to implement a lowpass filter. Using the rule of thumb formula(s) to estimate the order of the filter, I am getting a very high number. I looked into this question, ...
Prav001's user avatar
  • 69
0 votes
1 answer
2k views

Demodulation of FSK signal

What kind of FSK signal is this and what demodulation technique can I use to demodulate it. Why is the phase of the 1's changing like that and how does that effect how it needs to be demodulated. I ...
Baz's user avatar
  • 275
2 votes
1 answer
2k views

SciPy Lfilter issue

For one of my DSP projects, I decided to use python to perform signal processing. While I am new to python, I understand that it is a very powerful and versatile language. For my processing, I opted ...
bessiethacow's user avatar
5 votes
6 answers
5k views

What Are The Semantics Of Wav-File Sample Values?

The title is the question. To make this concrete, assume I have a standard 16-bit single channel wav file, with (although it doesn't matter) a 16000 Hz sampling rate. Each sample magnitude will be a ...
Novak's user avatar
  • 175
1 vote
1 answer
791 views

How to implement Matlab welch in python with the same result?

I want to implement Matlab pwelch function in python. The Matlab code is shown blew: [PSD,f] = pwelch(data,length(data),[],[],2000); which data is a row vector ...
mhmmdrz92's user avatar
1 vote
0 answers
190 views

Why are low frequency peaks not sharp in scipy fft?

I am using numpy/scipy to plot graphs of sine waves. frequencies at 15 Hz or higher give nice, sharp peaks, but at lower frequencies, the peaks are smeared and the actual peak frequency can't be seen ...
azman's user avatar
  • 11
0 votes
1 answer
132 views

Can't seem to get welch function in scipy work correctly

I'm trying to learn DSP through using Python's scipy package. I have measure some 200Hz signal from a machine. Now I want to inspect the spectral density of the signal. Here's the signal plotted out: ...
Anh Tran's user avatar
  • 161
0 votes
2 answers
3k views

Python Hilbert does not seem to calculate the envelope

I am following the example from: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.hilbert.html And although I can replicate their example, it does not work with my data. This is the ...
Dr Sokoban's user avatar
0 votes
1 answer
317 views

Bandpass filter with very high sampling rate

Consider a bandpass filter with Low Cut 17Hz, High Cut 22 Hz, Fs = 45000 Hz and Order = 6. When I pass a mixture of multiple sinusoidal waves through this filter (with a sine wave of frequency 20 Hz), ...
Deepak's user avatar
  • 1
0 votes
0 answers
169 views

Negative Exponential Filter SciPy

I'm trying to transform a time series with a recursive filter to model a feedback. I was able to do a simple filter like : ...
nicola del verme's user avatar
0 votes
1 answer
2k views

How to convert a spectrogram back to a signal [duplicate]

I'm converting a signal to a spectrogram, manipulating that (nonlinear stuff), and then want to use the modified audio signal. I can make it so the segments are not overlapping, but am unsure how to ...
Nimitz14's user avatar
  • 199
1 vote
1 answer
156 views

How to pad a array representing music to pad the stft of this array?

I have an array named samples of size (2, 1321967) representing an audio file. When I pass it to scipy stft with ...
Statistic Dean's user avatar
0 votes
2 answers
1k views

Delay in Savitzky-Golay filtering

I am applying a Savitzky-Golay filter to a signal, using the scipy function. I need to calculate the lag of the filtered signal, and how much is it behind the original signal. Could someone shed ...
San Riente's user avatar
0 votes
0 answers
152 views

Scipy Deconvolve help

I was playing with the deconvolve method in scipy and I can't seem to get it working properly (I am still really new to DSP/deconvolution). I convolved a gaussian with a fwhm of 2.0e-9 with a ...
deconvolution_is_broke's user avatar
0 votes
0 answers
567 views

Filtering out different narrow-band frequencies at once

I have asked a closely related question on SO at https://stackoverflow.com/questions/55168460/python-implementation-for-filtering-out-multiple-distinct-narrow-band-frequencie but I am still unclear ...
Wall-E's user avatar
  • 141
1 vote
2 answers
4k views

Third octave bandpass filter with python

I am very new to signal processing and coding which is why my questions might be really basic. I have a signal of the acoustic pressure p'(t) and I would like to use a third octave bandpass filter in ...
Larzeb's user avatar
  • 11
6 votes
2 answers
472 views

Checking Parseval's Theorem for Gaussian Signal by Using Scipy

I'm trying to check Parseval's theorm for Gaussian signal. It's well known that fourier transform of $\exp(-t^2)$ is $\sqrt{\pi}\exp(-\pi^2 k^2)$. So I implement it by using quad and simps. I think ...
user10942748's user avatar
0 votes
0 answers
88 views

Scipy Welch's gives different first element

I've re-implemented Welch's method and want to compare it to scipy.signal.welch. However, the first two and last elements of the resulting array are different. My ...
skjerns's user avatar
  • 101
3 votes
2 answers
1k views

Why does a higher sampling frequency mess up my bandpass filter?

I was designing a bandpass filter in python using some of the scipy.signal modules. I am plotting the frequency response of my filter to verify that my desired frequency is in the passband. However, ...
kennyvh's user avatar
  • 165
1 vote
2 answers
3k views

How to calculate the PSD from the complex calculated STFT?

I have calculated the STFT with scipy python library: ...
baddy's user avatar
  • 113
0 votes
0 answers
158 views

How to know the time of my window to calculate the STFT with python knowing only the length?

I am trying to implement a work presented in an IEEE paper where they have mentioned that the STFT was performed on the signal measurements to obtain a spectrogram with no overlap window of 3 min : I ...
MakBad's user avatar
  • 1
0 votes
0 answers
213 views

how to detrend a carrier phase with butterworth filter?

I am new with detrending techniques, I have a carrier phase measurements and I want to detrend it by 6th order butterworth digital filter. After creating the digital filter I get its numerator (...
baddy's user avatar
  • 113
4 votes
1 answer
14k 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 ...
Tim Hilt's user avatar
  • 201
8 votes
1 answer
5k views

Scipy resample, "fourier method" explanation

I am seeking explanation of what "Fourier method" is that is described for resampling in documentation of resample() method. I want to downsample an array. I know what decimation is and how it works, ...
chess's user avatar
  • 83
2 votes
0 answers
1k views

real refractive index from Kramers Kronig relation

I have a measurement of the complex part of the refractive index $k$ (where the refractive index is $m = n + i\,k$) measured at a nonlinear grid of wavelengths or frequencies that span several orders ...
John Smith's user avatar
1 vote
1 answer
6k views

How to filter out those outliers

I'm struggling to filter some data from an accelerometer. I need to do it in python (and not just on the device collecting the data) to fix the data I have, so that I can build some classification ...
Jeremie's user avatar
  • 113
2 votes
1 answer
5k views

Amplitude of frequency bin in FFT doesn't match time-domain amplitude

I have a sinusoidal current that I am sampling at about 357k SPS. The current signal is about 3A pk-pk @ 750hz (top figure). I am wondering why when I take the fft using numpy/scipy's fft function, ...
kennyvh's user avatar
  • 165
4 votes
1 answer
2k views

How to Apply Gaussian Filter to Raw Audio Files in Python?

I am recording raw files in python to later break them into phonemes, but the noise in the surrounding environment is hampering the result. So, there is a need to apply a filter to the recorded raw ...
shreyansh's user avatar