Questions tagged [scipy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
6 votes
1 answer
686 views

Morphing between two FFTs

I'm a musician and I'm making a script that takes a wave file and snaps each of its frequencies from the fourier transforms to the nearest musical harmonic. Thanks to help from another question I ...
halbe's user avatar
  • 79
0 votes
1 answer
164 views

Unexpected peaks in power density following downsampling and filtering

I first applied a 100 Hz lowpass filter to my data, which was recorded at 30000 Hz: ...
T.Tran's user avatar
  • 1
0 votes
1 answer
1k views

Should scipy.signal.coherence be 1 for single input and output signals?

I am trying to calculate the coherence between input and output signals. I thought I could work with a single input and a single output time series and calculate the coherence $\gamma^2$ between them. ...
Bax Menker's user avatar
1 vote
1 answer
405 views

Help generating coefficients for basic FIR LPF

I'm trying to generate coefficients for a FIR low pass filter to be used in an FPGA. I'm using python (scipy.signal) to attempt to do this, but am having trouble getting coefficients in a usable form....
m3atwad's user avatar
  • 11
0 votes
1 answer
515 views

Outlier Detection after Detrending a Time Series With Missing Values or NaN

Goal Substitute outliers in a time series by most recent valid data Problem The time series (end-of-day stock prices) has several 'uncomfortable' properties: It is non-stationary and can have ...
ascripter's user avatar
  • 101
4 votes
1 answer
2k views

How to generate random samples of Gaussian distribution directly in the frequency domain?

One can easily draw (pseudo-)random samples from a normal (Gaussian) distribution by using, say, NumPy: ...
Herpes Free Engineer's user avatar
0 votes
2 answers
201 views

Can I combine an IIR (an EWMA) with a maximum?

I'd like to have a exponentially weighted moving average (EWMA) which is raised to the value of the input signal whenever this is higher than the filter output. This taking of the maximum shall take ...
Alfe's user avatar
  • 113
1 vote
2 answers
14k views

Avoiding "RuntimeWarning: invalid value encountered in log10" when converting FFT data to dBFS

I've attached some code below that I'm having some issues with. Basically, I need to write a function to get the dBFS value of a signal at a specified Hz value, at a given channel in a .wav file. ...
TJM's user avatar
  • 11
11 votes
5 answers
24k views

Why is Scipy implementation of Hilbert() function different from Matlab implementation of the function?

I am trying to fit Hilbert envelop to a high frequency ultrasonic signal of frequency 250 KHZ and sampling rate 12000000. Raw signal looks like below: . I used hilbert() function from scipy.signal ...
Spandyie's user avatar
  • 213
1 vote
1 answer
1k views

Trying to implement MATLAB $\tt pwelch$ in Python

I'm implementing an existing MATLAB script in Python and noticing some differences in the behaviour of MATLAB's pwelch function compared to ...
samb8s's user avatar
  • 121
0 votes
1 answer
1k views

Delay filters in Python using for loop and $\tt lfilter$

I have these two filters as given in recursive form: \begin{align} y_1[i] &= y[i] - y[i-d] + 1.2y_1[i-d] - 0.8y_1[i-2d]\\ y_2[i] &= y[i] - 2y[i-d] + y[i-2d] \end{align} where $d$ is an ...
mac13k's user avatar
  • 237
3 votes
1 answer
5k views

How to compute the power bands of an eeg signal using python?

so I have an eeg signal (edf format) that has 25 channels and 248832 entries, sampling frequency of 512Hz. I have to compute the frequency bands: – Delta: 0.1-4Hz – Theta: 4-8Hz – Alpha: 8-12Hz – ...
user3640476's user avatar
3 votes
0 answers
9k views

Downsampling and upsampling of a signal in Python

If I want to downsample a signal in Python, is it better to use method resample from SciPy Signal Processing module or method decimate from the same module? What is the difference between these two ...
Nela's user avatar
  • 31
1 vote
1 answer
2k views

Welch spectrogram

I have been using scipy's spectrogram function (STFT) to compute a PSD spectrogram for a non-stationary signal. I provide X length window (with nperseg = X/10) each ...
mike's user avatar
  • 59
1 vote
0 answers
358 views

Understanding why spectral flatness cannot be computed

I have a real signal recorded 512Hz for 1s. After resampling the signal at 256Hz, I would like to compute its spectral flatness. To do so, I start by taking its discrete Fourier transform with ...
Pouteri's user avatar
  • 49
3 votes
1 answer
31k views

Convert RGB Image to Grayscale and Display It (Python + Matplotlib) [closed]

I just started learning image processing and I was trying to read a RGB image then convert it to grayscale. I was hoping for something like this: However, what I get was: I tried using both scipy ...
Ulaai's user avatar
  • 33
2 votes
1 answer
428 views

consecutive filtered blocks with filtfilt

I'm doing basic signal processing in Python. I'm filtering consecutive blocks of a signal with scipy's filtfilt (to get zero phase). I would like to concatenate several blocks after filtering, however,...
mike's user avatar
  • 59
3 votes
1 answer
1k views

Python different autocorrelation with FFT and non-FFT

Im trying to calculate the autocorrelation of soundwaves when I noticed that I get different results with scipys FFT based and with numpys methods. The 4 functions Im using: ...
v.s.'s user avatar
  • 33
-1 votes
1 answer
956 views

Forward Backward filter Scipy - $\tt signal.filtfilt$ changes the amplitude when $\tt signal.butter$ is used with $\tt btype='high'$

In the plot below the blue wave is the original signal. The orange wave is after the low pass filter. The green wave is after the high pass filter. I have a noisy ECG signal stored in the ...
rasalghul's user avatar
1 vote
1 answer
593 views

Issue with the time vector returned by $\tt signal.spectrogram$ function

I'm puzzled by some very simple concept with building up a spectrogram. Here is a toy example of the issue: ...
mike's user avatar
  • 59
3 votes
1 answer
4k views

How to implement bandpass filter on complex valued signal?

I am using Scipy to implement bandpass filter but it assumes that positive normalized frequency is passed but I & Q samples range from [Fc-Fs/2,Fc+Fs/2] where Fs is sampling frequency & Fc is ...
Andre Smith's user avatar
1 vote
1 answer
3k views

How to design bandpass filter in python when centre frequency is greater than sampling frequency?

I implemented basic bandpass filter using Scipy resource. But how to implement the same when signal is centred at non-zero centre frequency with centre frequency > sampling frequency. I trying to ...
Andre Smith's user avatar
1 vote
1 answer
9k 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 ...
Devin Liner's user avatar
3 votes
2 answers
2k views

Do DCT results contain phase spectrum?

I've been working much with numpy.fft lately where just like the documentation says: When the input a is a time-domain signal and ...
mac13k's user avatar
  • 237
7 votes
3 answers
39k views

Calculating values of frequency bins in Python

I have to use FFT to determine the period of waves inside a signal. After applying FFT on a window of 10000 point from a signal, I get something like this: What I don't understand is that FFT is ...
Hamza Tahiri's user avatar
6 votes
2 answers
7k views

Python butter filter: choosing between analog and digital filter types

I have a system that performs wireless sampling of data about every 7.5ms (133Hz). Due to it being wireless, I get occasional data drop out. I want to construct a LP butter filter with cut-off ...
Geko's user avatar
  • 63
1 vote
2 answers
586 views

problem with decimate in scipy 0.18

I use scipy.signal.decimate to downsample a large spectroscopic data-set. This has worked superbly so far. ...
Marc-André Delsuc's user avatar
2 votes
2 answers
2k views

Why does python's scipy.signal.dimpulse introduce delay in impulse response?

Consider a simple linear, time invariant system of the form: $y_k = cy_{k-1} + (1-c)x_k$ The impulse response of this system can be computed by either dimpulse or by applying lfilter to a vector ...
rhz's user avatar
  • 375
1 vote
2 answers
386 views

Need of $\tt abs()$ method when plotting a power spectral density for a given dataset

I am a newbie in signal processing and would like to know the significance of using the abs() function and squaring the values received as an output of ...
Jalaj Maheshwari's user avatar
1 vote
1 answer
74 views

$n\textrm{ Hz}$ waveform sampled at $m\textrm{ Hz}$ per second

Here is an example of plotting a square wave given in SciPy Documentation A $5\textrm{ Hz}$ waveform sampled at $500\textrm{ Hz}$ for 1 second: ...
Vinodh's user avatar
  • 121
3 votes
2 answers
222 views

How to discard coefficients in the frequency domain without losing too much quality?

I was reading a text that shows that one can throw away 66% of the coefficients and gets an image that is still acceptable. I tried to replicate it using python (last example) and selectively ...
Leandro Moreira's user avatar
1 vote
2 answers
9k views

Is there a function in python which returns the Amplitude/Sound Pressure Level of a sound file(like .wav) file?

I found a function called scipy.io.wavefile.read() which returns the sampling rate and an array. But in the documentation, it is not specified that whether the ...
arjunrajpal's user avatar
0 votes
3 answers
545 views

Problems designing high pass FIR filter with $f_\textrm{cutoff} \ll f_\textrm{s}$

Is there any inherant problems with high-passing a signal with a very low cutoff frequency compared to the sampling rate? I'm not sure what I am missing as I cant find any info on it. Examples ...
trondhe's user avatar
  • 101
-1 votes
1 answer
3k views

Converting from radians/samples to normalized frequency range $[0.0, 1.0]$?

I'm trying to understand the following code, specifically how to use the results of scipy.signal.freqz where w in ...
mavavilj's user avatar
  • 1,404
2 votes
0 answers
311 views

Scipy.signal.dimpulse(system): how to translate a StateSpace to a "system"? [closed]

The command scipy.signal.dimpulse(system, x0=None, t=None, n=None) does not seem to accept a scipy StateSpace as an input to its ...
stevemuse's user avatar
0 votes
1 answer
1k views

How does scipy.signal.deconvolve work?

The deconvolve(signal, divisor) function of scipy ...
wsdzbm's user avatar
  • 207
3 votes
1 answer
4k views

Butterworth band pass filter

I am trying to build a Butterworth bandpass filter. My intent is to have a pass band between $250\textrm{ Hz}$ and $1000\textrm{ Hz}$. However the plot doesn't look right, as can be seen from the ...
MAS's user avatar
  • 133
0 votes
0 answers
351 views

Translating Bessel filter from python to C - odd behavior past the cutoff frequency

I recently translated the code from scipy.signal.bessel to C in order to implement a bessel filter in a piece of analysis ...
KBriggs's user avatar
  • 320
2 votes
1 answer
669 views

discrete digital filtering in python

I am not from DSP background and also not sure if I am posting this in right community. I have basic understanding of resistors, capacitors and filters. My requirement is as follows- The supply ...
knowledge_seeker's user avatar
1 vote
0 answers
3k views

How to design an interpolated notch filter in Python to filter powerline harmonics

I have a a time domain data set that records the magnetic field vs time, which must be processed to reveal an embedded signal. This data also contains power line harmonics (i.e. multiples of 60 Hz) ...
Jon's user avatar
  • 111
2 votes
2 answers
107 views

How to know when a sound in a given frequency starts and ends?

I need to detect two sounds (913 Hz and 1370 Hz), knowing the time in which each starts and ends. At this time, I am using a band pass filter (butter), and this is the result: Here is the first time ...
Dayvid Oliveira's user avatar
2 votes
2 answers
272 views

Beginner Question: Extracting Features for Image Classification

I'm a Python programmer, but a beginner to image processing :) Apologies if this isn't a suitable question for the forum, happy to rewrite or move. I want to create a supervised classifier to ...
Richard's user avatar
  • 121
2 votes
0 answers
207 views

Alternative to scipy maximum_filter to find peaks?

I'm using scipy maximum_filter together with binary_erosion to find peaks in my spectrum. I just wondering if there are any ...
moeseth's user avatar
  • 121

1 2 3
4