signal-processing

peak integration using trapz but not starting from baseline and visualization

peak integration using trapz but not starting from baseline and visualization Question: I am trying to integrate signal peaks using numpy.trapz or scipy.trapz. I do manually select the range of a peak min and max. the problem I am facing is that I think these functions integerates the AUC till the baseline. Sometimes my signal …

Total answers: 1

Explanation of signal.find_peaks() approach

Explanation of signal.find_peaks() approach Question: I have looked through the scipy.signal docs for an explanation of the peak finding approach used in find_peaks() and have been unable to find an explanation similar to the excellent explanation given but the cwt peak finding approach. Is anyone here able to explain the peak finding approach used by …

Total answers: 1

Matlab Dirichlet kernel equivalent in Python?

Matlab Dirichlet kernel equivalent in Python? Question: Is there an equivalent in Python for Matlab diric? The Dirichlet kernel DL(ω) is: DL(ω) = sin(ωL/2) / sin (ω/2) I found scipy.stats.Dirichlet, but that’s not related. That’s no big deal to write the expanded form, but there is a limit to manage: DL(0) = L. Asked By: …

Total answers: 1

How to create a 2D array of weighted+shifted unit impulses?

How to create a 2D array of weighted+shifted unit impulses? Question: I’m looking for an efficient way to get a 2D array like this: array([[ 2., -0., -0., 0., -0., -0., 0., 0., -0., 0.], [ 0., -1., -0., 0., -0., -0., 0., 0., -0., 0.], [ 0., -0., -5., 0., -0., -0., 0., 0., …

Total answers: 1

Detecting increasing trend and decreasing trend in time series data in Python

Detecting increasing trend and decreasing trend in time series data in Python Question: I need to find the window of increasing trend and decreasing trend in a time series data. For example in the below plot, it has 3 increasing trend and 2 decreasing trend. I need identify the windows having this trend. I tried …

Total answers: 1

IndexError when using Enumerated Indexes in NumPy

IndexError when using Enumerated Indexes in NumPy Question: I am trying to create a fifth-order FIR filter in Python described by the following difference equation (apologies dark mode users but LaTeX is not yet supported on SO): def filter(x): h = np.array([-0.0147, 0.173, 0.342, 0.342, 0.173, -0.0147]) y = np.zeros_like(x) buf_array = np.zeros_like(h) buf = …

Total answers: 1

Python Channelizer

Python Channelizer Question: After years of telling myself I would, I’m finally switching from MATLAB to Python. I am having difficulty finding a Python equivalent to MATLAB’s Channelizer. Is there one? Asked By: djg135 || Source Answers: Yes, PyFilterBank will do the trick. Answered By: Igor Rivin

Total answers: 1

Slicing audio given video frames

Slicing audio given video frames Question: I have audio from a video that I’ve loaded with PyTorch. Given a starting index and ending index corresponding to the video segment of interest, along with the video FPS and audio sampling rate, how would I go about extracting the slice of audio that matches the segment of …

Total answers: 2