Questions tagged [scipy]

The tag has no usage guidance.

43 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
0 answers
52 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
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
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(...
GNZ's user avatar
  • 171
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
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
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 vote
0 answers
39 views

STFT normalization

In Scipy's implementation of STFT, an argument allows to scale the result as a spectrum or as a psd : ...
hugopb82's user avatar
1 vote
0 answers
38 views

Convert MUSIC algorithm to EV

I write some code, but result looks very strange: ...
Dmitry  Sokolov's user avatar
1 vote
0 answers
95 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: ...
Dmitry  Sokolov's user avatar
1 vote
0 answers
524 views

Spectrogram of x,y,z data from accelerometer

Using scipy.signal.spectrogram for creating spectrogram and matplotlib's pcolormesh for plotting. I'm working on a project where I'm using a spectrogram to visualize the frequencies of the ...
Mathias's user avatar
  • 11
1 vote
0 answers
151 views

`signal.periodogram` output has no frequency 0 hz point,how to solve this problem?

...
kittygirl's user avatar
  • 175
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 ...
ISquared's user avatar
  • 121
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....
Martin Ueding's user avatar
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
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
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
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
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
72 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: ...
rhz's user avatar
  • 375
0 votes
0 answers
92 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 ...
GWSurfer's user avatar
0 votes
0 answers
15 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 ...
techcrazy's user avatar
0 votes
0 answers
308 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 ...
gladi8er's user avatar
0 votes
0 answers
83 views

Decimate a signal whose values are calculated, not stored

tl;dr I'm looking for something like Scipy's decimate function, but one that takes in a generator, rather than a Numpy array. I am turning on and off a light using ...
Kevin's user avatar
  • 101
0 votes
0 answers
130 views

Understanding FFT bins interpretability

I am familiar with the continuous Fourier transform yet the more I try to understand FFT, the more I'm confused. If we've got a discrete N sample signal, FFT is a faster way to calculate DFT. If ...
X HOxha's user avatar
0 votes
0 answers
19 views

Creating 60s strips from ecg signal recording ( .bat ) file and give it a label as per the datapoint present in it

I am working with https://physionet.org/content/mitdb/1.0.0/ dataset where we have 48 ecg signal files. Each recording is 30 minutes long and I Want to create 60s strips and give it a label. ie based ...
user2129623's user avatar
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 ...
Vicky Fi's user avatar
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 ...
WDpad159's user avatar
  • 145
0 votes
0 answers
908 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 ...
Peadar O Donnell's user avatar
0 votes
0 answers
168 views

Periodogram/PSD from FFT amplitude

I have performed a STFT for signals and obtained the amplitude through ...
Shan's user avatar
  • 29
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 ...
Zarathustra's user avatar
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
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
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
566 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
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
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
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
0 votes
1 answer
267 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. ...
buscon's user avatar
  • 23
-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 ...
fednem's user avatar
  • 11
-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 ...
caiuscosades'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