Questions tagged [python]

Python is a high-level interpreted general programming language. Python has popular numerical and scientific libraries/packages, most notably numpy and scipy. The scipy.signal package is a powerful signal processing software collection. This tag covers the use of numpy, scipy, and other Python packages often used for SP computations.

Filter by
Sorted by
Tagged with
0
votes
1answer
166 views

Unit Step Response of an Integrator

Desinging a very basic 1st order integrator with the continous transfer function: $H(s) = -1 / (0.001 s)$ [No zeros, one pole at origin] I was expecting the unit step response to be positive-slope. ...
1
vote
0answers
646 views

How to envelope a non periodic Impulse signal?

I want to analyse a trc oscilloscope file, find impulses and envelope them. In the end I want to plot the envelope. data file (trc): https://ufile.io/z4m4d Code: (Python) ...
1
vote
1answer
274 views

Extreme quantization of audio

I would like to take an audio sample and reduce it to a very limited set of numbers, with one value for amplitude and another for length. Example: I want to find the dimensions of the red boxes, ...
2
votes
1answer
320 views

Calculating the first derivative of an image using DFT

I need to calculate the first derivative of a greyscale image (a 2D array) using a DFT function I built (which works). Unfortunately, the results don't seem to be correct. In the fourier domain, the ...
0
votes
1answer
2k views

Fourier Transform of ECG signal in Python

I have an ECG signal which I am analyzing using Python, as opposed to the mainstream MATLAB. So, I have digital form ECG in .dat file with .hea (header file). Below is the Fourier transform The ...
-1
votes
1answer
108 views

“Side Lobes” When Using a Butterworth filter

So I am attempting to filter a signal containing frequencies at 7Hz, 11Hz, and 74Hz. The signal lasts for 30s and looks like this between -1s and 1s: Using a butterworth filter of order 2 with lowcut=...
1
vote
1answer
5k 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 ...
4
votes
2answers
178 views

references for techniques to reduce recursive filter startup transients

I am trying to track down references (published articles or reports ideally) that establish the basis for some of the techniques being used to minimize the effect of recursive digital filter startup ...
1
vote
0answers
51 views

Frequency bins too powerful at the start and at the end of each sample computed DFT data

I've taken the following link http://coding-geek.com/how-shazam-works/#comments as a project to start practising and learning signal processing and python programming for me to get started in speech ...
1
vote
1answer
252 views

Red Blood Cell Color Image Segmentation

I want to segment this Red Blood Cell Image on HSI color space.I want to try the Otsu Method but from what I read that method work only on Grayscale image.Do you have any suggestion for suitable image ...
0
votes
2answers
150 views

Shifting signal smaller than discrete step

I have a image that I need to shift with less than a pixel. My plan was to do a Fourier transform and multiply the signal with $e^{-aiu-biv}$ where $a, b$ are the shifts in x and y direction. This ...
0
votes
1answer
807 views

Resampling from variable to fixed-rate [closed]

I have a gyroscope which reports x,y,z values to my embedded device. The rate that one sample appears is variable and has a jitter of around 10ms. However I later want to have a log file with a fixed ...
1
vote
1answer
904 views

Sound Source Location

I have four microphones which I want to use to locate the direction of an audio source. Is there any Python module that implements an algorithm that, given the recordings of the four microphones, will ...
2
votes
2answers
379 views

Why is my DFT/FFT always 90° out of phase?

I'm doing an FFT using Python and Numpy on one machine, and C# on another. I'm using some dummy data that mimics how I'll eventually be gathering data from sensors in the C#/UWP application. The two ...
1
vote
1answer
187 views

Finding audio “tics” in stereo wav files using python

I have thousands of audio files that I want to "batch" process searching for audio tics. This is easily done using a DAW but that requires opening each file independently, searching for the tic (...
2
votes
0answers
430 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 ...
1
vote
2answers
406 views

Simple way to determine square-ness of signal?

Not entirely sure if my term is correct. Feel free to edit title. I have a lot of time series, where the data quality is determined by how linear each sub-sequence is. It doesn't matter if it jumps ...
1
vote
1answer
835 views

How to remove ECG artifacts from EMG data?

I'm new to signal processing and try to analyze EMG data from pectoralis major and other respiratory muscles. Unfortunately, there are strong ECG artifacts in all recordings and I don't know how to ...
0
votes
1answer
106 views

Time-domain LPF not showing expected behavior

I am trying to implement a simple first-order Butterworth Low-Pass filter in Python. I have some code that makes use of scipy.signal.butter and scipy.signal.filtfilt. It works fine, but I wanted to ...
2
votes
2answers
118 views

How do MATLAB and/or Python treat $2^n$ samples rule in FFT

As far as I have read, an FFT requires that the number of original data points must be a power of 2. I'm wondering whether the tools like MATLAB or Python which have FFT functions take care of this ...
4
votes
2answers
16k views

Removing noisy lines from image - opencv - python

I want to process different type of image to extract actual text from noisy image .I am using open cv to do this job it is working fine but the problem is I need to set different lower threshold to ...
1
vote
1answer
233 views

zero padding shifting signal peak?

I am trying to find the fundamental frequency of a low-frequency signal. I need an estimate that is precise to .01 Hz based on only a few cycles, so I'm trying to code up a fft in Python. The signal ...
1
vote
1answer
101 views

Time signal FFT different for whole signal than half signal on high frequencies

I have a time signal of u from 0 to 1000 time units. If I chop the signal in two halves and compare the frequency spectrum of both it looks similar, as it should (...
1
vote
0answers
636 views

Remove a line in image with FFT

I would like to remove vertical line from an image (an example). I took a 2D FFT and try to apply a mask to suppress the line. Nonethelesse the approch is not very efficient, because i lose an ...
1
vote
1answer
361 views

Reconstruction of a signal from non-uniform samples [duplicate]

So I'm having some troubles with a signal that's been sampled but where the samples don't have consistent intervals. I've been looking into the NFFT (in python) as a starting point but I'm a complete ...
0
votes
1answer
658 views

Is there a way to obtain the transfer function from a bode plot on Python? (I know that it is possible on Matlab)

Quite simply, I have a bode plot obtained from a source signal. Now I wish to obtain the transfer function. I know it is possible with Matlab: http://www.mathworks.com/help/ident/examples/frequency-...
1
vote
2answers
391 views

wrong output using numpy fft on a tone

I am getting the wrong output with the following simple implementation of Python fft. Can someone please explain what I need to fix? ...
3
votes
1answer
1k views

Finding a signal inside another signal

I have a 1D array of 32 bit floating point numbers representing the current draw of a radio operating over a 40 minute span. The number of elements in the array is 29 million and change. There is a ...
0
votes
1answer
296 views

signal reconstruction [closed]

I'm new to DSP so the question might seem a little bit stupid: When using a low pass filter (say Butterworth filter) with Python, I came across an algorithm with which I can reconstruct my signal ...
0
votes
2answers
286 views

Window length in matplotlib's specgram

In the paper about speaker verification I can read that Two quantities have to be set: the length of the window and the shift between two consecutive windows. For the length of the window, two ...
1
vote
1answer
113 views

Reproducing paper results about a wavelet transformation using python [closed]

I have been reading this PhD theis about wavelets and I am trying to reproduce some of the results but I don't know the specific code to use to generate similar results. The original time series ...
0
votes
1answer
2k views

Computing the Power Spectrum Density (PSD) on a CSV File in Python

im quit new with signal processing and im trying to calculate the PSD of a signal im sampling. the signal is an output of a DC buck converter this is the code im using and this is the plot im getting ...
2
votes
1answer
894 views

How to Calculate the Ambiguity Function

(Maybe this should be on Stackoverflow instead ...) What is the best way to calculate the ambiguity function? There are different implementations out there for Python (like PyTFTB or from ...
1
vote
0answers
14 views

graph display problem [closed]

I have a problem with the end of my code. I would like to display the last two curves, the problem is that at the beginning the size of YY is 288 and then after the equality with diff, my size goes to ...
0
votes
1answer
305 views

How to find the probability of Kalman filter states? [OpenCV+Python]

I am working on a video object tracking problem. I am using Kalman filter to predict and correct the object position return by an algorithm such as CamShift. I want to adjust the likelihood ...
0
votes
2answers
3k views

Spectrogram from scipy.signal with Python

To test the python spectrogram (from scipy.signal) , I've created a signal with 2 harmonics: 2 Hz and 8 Hz. Then I've added 50Hz noise and a trend (https://i.imgur.com/t1SnQck.png). I wanted to ...
0
votes
1answer
90 views

Detect gradual increase then decrease in slightly noisy data

I have data thats not too noisy and I am trying to detect a pattern where it gradually increases then decreases in a short period of time (20 ticks? it should be roughly similar per session but can ...
0
votes
1answer
239 views

How to measure acoustic pressure level under water with a hydrophone?

this is my first post here and I am also new in signal processing. Let's say I have a hydrophone with amplifier which is connected to a sound card plugged in to a computer. I gather the sounds to a ...
0
votes
1answer
96 views

Is this jumbled image due to difference between Matlab and Python slicing?

When I import an image from Matlab I get the following jumbled image rather than the (224x224x3 RGB) image of a single elephant I expected I write the image from Matlab as a binary file ...
1
vote
1answer
2k 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 ...
0
votes
1answer
796 views

How do I apply a binary mask and STFT to produce an audio file?

So here's the idea: you can generate a spectrogram from an audio file using shorttime Fourier transform (stft). Then some people have generated something called a "binary mask" to generate different ...
0
votes
1answer
251 views

Spectral Subtraction python implementation error

I am trying to implement Spectral subtraction in python. I am new to DSP. I used this article as reference and below code is what I can come up with. Of course I did not get the expected output. I ...
1
vote
1answer
2k 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, ...
2
votes
1answer
589 views

Python toolboxes for state-space estimation via subspace estimation

Is there (open-source) toolboxes for state-space estimation via subspace estimation in Python? I know this is used in Matlab's n4sid function, but I didn't found any Python's implementation (even in ...
0
votes
2answers
1k views

Bandpass butterworth filter in python is not working

I've implemented this bandpass filter in matlab for the audio signals and it's working as expected. Now, I tried to implement the same thing in Python but it doesn't produced expected results, it just ...
0
votes
1answer
38 views

Extract jump location in data

I would like to extract the location of data jump (see figure below), the difficulty is that the data are noisy as you can see. I try with a median filter or a other regularization and it could move ...
0
votes
1answer
405 views

Matrix cross correlation in python

I'm currently performing matrix cross correlation in python using : C = scipy.signal.correlate2d(A,A) where A is a 2D matrix, typically a picture. As you can ...
0
votes
2answers
702 views

Trouble with time-syncing two radio signals using cross-correlation

I posted a similar question a while ago here (I'm posting this follow-up since I'd like to focus more on cross-correlation now). I have a setup where I have two software-defined radios connected to ...
1
vote
1answer
256 views

Unscented Kalman Filter - Multiple Consecutive Measurement Updates

In trying to implement an Unscented Kalman Filter (UKF), I have come across the issue of what to do when my measurement signals come in at a different rate than my control inputs, which I use in the ...
2
votes
1answer
370 views

Binarization, and then thinning/skeletonization

I have pictures of networks, like the one below, and my goal is to obtain the network's skeleton from processing those images. My approach lies in two steps, first I convert grayscale image to binary ...